Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[contract-call-view] Add contract-call-view Strategy #1382

Closed
wants to merge 2 commits into from

Conversation

tkowalczyk
Copy link

Changes proposed in this pull request:

  • Discord Ticket-1779
  • This strategy allows to call functions which returns multiple values instead of one like contract-call

@ChaituVR ChaituVR changed the title Add contract-call-view Strategy [contract-call-view] Add contract-call-view Strategy Jan 8, 2024
Copy link
Member

@ChaituVR ChaituVR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @tkowalczyk contract-call strategy already accepts a param output

@tkowalczyk
Copy link
Author

@ChaituVR you are right but contract-call do not support functions which returns more than one value as output, in this strategy you are able to provide index of returned value and use this one.

@ChaituVR
Copy link
Member

ChaituVR commented Jan 9, 2024

@tkowalczyk Could you add a new param on contract-call itself?

@tkowalczyk
Copy link
Author

@ChaituVR to be honest it will require to rewrite the contract-call strategy and also adjust tests for it so I would prefer to stay with proposed in this PR solution in separate strategy, would it be possible or rewrite the contract-call strategy is the prefered solution?

@ChaituVR
Copy link
Member

@tkowalczyk Did you try something like here

@tkowalczyk
Copy link
Author

@ChaituVR , Yes of course...

I am not able to deal with contract-call with function which return more than 1 value in the response:

https://snapshot.org/#/playground/contract-call?query=eyJwYXJhbXMiOnsiYWRkcmVzcyI6IjB4NWNBMEYzM2YxZWJEMTQwZGVmODc3MjEyOTFGRjMxM0E5MTQxRjc5ZSIsIm1ldGhvZEFCSSI6eyJpbnB1dHMiOlt7ImludGVybmFsVHlwZSI6ImFkZHJlc3MiLCJuYW1lIjoiIiwidHlwZSI6ImFkZHJlc3MifV0sIm5hbWUiOiJ1c2VySW5mbyIsIm91dHB1dHMiOlt7ImludGVybmFsVHlwZSI6InVpbnQyNTYiLCJuYW1lIjoibGFzdFN0YWtlVGltZSIsInR5cGUiOiJ1aW50MjU2In0seyJpbnRlcm5hbFR5cGUiOiJ1aW50MjU2IiwibmFtZSI6ImFtb3VudCIsInR5cGUiOiJ1aW50MjU2In0seyJpbnRlcm5hbFR5cGUiOiJ1aW50MjU2IiwibmFtZSI6IndhaXRpbmdSZXdhcmRzIiwidHlwZSI6InVpbnQyNTYifV0sInN0YXRlTXV0YWJpbGl0eSI6InZpZXciLCJ0eXBlIjoiZnVuY3Rpb24ifX0sIm5ldHdvcmsiOiI0MjE2MSIsInNuYXBzaG90IjoiMTY2NzAzMzc0IiwiYWRkcmVzc2VzIjpbIjB4OGNmZDJjZWE2ZDU3MzEzYzMyZjlkOTc5NWQ5ODQwZmEyMzE2NTcwOCJdfQ..

and when I specify only one return value I got the value but for the first one not the one I provide

https://snapshot.org/#/playground/contract-call?query=eyJwYXJhbXMiOnsiYWRkcmVzcyI6IjB4NWNBMEYzM2YxZWJEMTQwZGVmODc3MjEyOTFGRjMxM0E5MTQxRjc5ZSIsIm1ldGhvZEFCSSI6eyJpbnB1dHMiOlt7ImludGVybmFsVHlwZSI6ImFkZHJlc3MiLCJuYW1lIjoiIiwidHlwZSI6ImFkZHJlc3MifV0sIm5hbWUiOiJ1c2VySW5mbyIsIm91dHB1dHMiOlt7ImludGVybmFsVHlwZSI6InVpbnQyNTYiLCJuYW1lIjoiYW1vdW50IiwidHlwZSI6InVpbnQyNTYifV0sInN0YXRlTXV0YWJpbGl0eSI6InZpZXciLCJ0eXBlIjoiZnVuY3Rpb24ifX0sIm5ldHdvcmsiOiI0MjE2MSIsInNuYXBzaG90IjoiMTY2NzE0OTg2IiwiYWRkcmVzc2VzIjpbIjB4OGNmZDJjZWE2ZDU3MzEzYzMyZjlkOTc5NWQ5ODQwZmEyMzE2NTcwOCJdfQ..

obraz

@ChaituVR
Copy link
Member

I mean like this:

{
  "address": "0x5cA0F33f1ebD140def87721291FF313A9141F79e",
  "output": "1",
  "methodABI": {
    "inputs": [
      {
        "internalType": "address",
        "name": "",
        "type": "address"
      }
    ],
    "name": "userInfo",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "lastStakeTime",
        "type": "uint256"
      },
      {
        "internalType": "uint256",
        "name": "amount",
        "type": "uint256"
      },
      {
        "internalType": "uint256",
        "name": "waitingRewards",
        "type": "uint256"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  }
}

@tkowalczyk
Copy link
Author

It looks ok

@ChaituVR
Copy link
Member

Thanks for testing @tkowalczyk it is just to avoid similar strategies :) hope you understand, so closing this PR for now. feel free to reopen if you need it

@ChaituVR ChaituVR closed this Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants