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

Cannot parse ABI with tuple[] #358

Closed
izakpavel opened this issue Aug 9, 2021 · 4 comments
Closed

Cannot parse ABI with tuple[] #358

izakpavel opened this issue Aug 9, 2021 · 4 comments

Comments

@izakpavel
Copy link
Contributor

izakpavel commented Aug 9, 2021

I am trying to use multicall smart contract (https://etherscan.io/address/0x5BA1e12693Dc8F9c48aAD8770482f4739bEeD696#code), but there is an issue when parsing the ABI with web3swift:

The tuple[] input parameter is parsed as an array of tuples, but there is a missing information about the tuple components which later prevents correct execution of the function...

the ABI: "[ { \"inputs\": [ { \"internalType\": \"bool\", \"name\": \"requireSuccess\", \"type\": \"bool\" }, { \"components\": [ {\"internalType\": \"address\", \"name\": \"target\", \"type\": \"address\" }, { \"internalType\": \"bytes\", \"name\": \"callData\", \"type\": \"bytes\" } ], \"internalType\": \"struct Multicall2.Call[]\", \"name\": \"calls\", \"type\": \"tuple[]\" } ], \"name\": \"tryAggregate\", \"outputs\": [ { \"components\": [ { \"internalType\": \"bool\", \"name\": \"success\", \"type\": \"bool\" }, { \"internalType\": \"bytes\", \"name\": \"returnData\", \"type\": \"bytes\" } ], \"internalType\": \"struct Multicall2.Result[]\", \"name\": \"returnData\", \"type\": \"tuple[]\" } ], \"stateMutability\": \"nonpayable\", \"type\": \"function\" } ]"

@izakpavel
Copy link
Contributor Author

also, the method signatures are different to what js library produces when there are tuples involved

web3swift created method signature tryAggregate(bool,tuple(address,bytes)[]) but it needs to be just tryAggregate(bool,(address,bytes)[]) to get the correct keccak hash

@dangell7
Copy link

Can you create a basic smart contract with a tuple for us to test? If not I can try to create one and test.

What solidity version are you using to compile the contract?

@izakpavel
Copy link
Contributor Author

As I said, I was using multicall smart contract when faced the issue... I cannot create a testing one :(

My fixes are in this PR: #379

@dangell7
Copy link

Well that's good news!!

@Iysbaera Iysbaera closed this as completed Nov 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants