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 send array to parameter #218

Closed
bitcoinmeetups opened this issue Aug 29, 2021 · 9 comments
Closed

Cannot send array to parameter #218

bitcoinmeetups opened this issue Aug 29, 2021 · 9 comments
Assignees

Comments

@bitcoinmeetups
Copy link

Hi,

Trying to call the following function (4 parameters) with the following input data (5 pieces of data):

web3 contract call --address 0x92c819e24Cb020e35Fce434a33E39Fd5C85AB2aA --abi qs.abi --function swapExactETHForTokens 138607273911012674 0d500b1d8e8ef31e21c99d1db9a6444d3adf1270 8f3cf7ad23cd3cadbd9735aff958023239c6a063 e5d77ab5fea649ca621f4f6c8a9b542fef88ab8b 3260059519

However, this generates the following error message:

ERROR: Error calling contract: mismatched argument (4) and parameter (5) counts

This is the transaction that I'm trying to replicate:

https://polygonscan.com/tx/0xcaf7358788aed4fd73b4fc26717e44a54750811fc1c62e6997db9bb0ae9f7585

Moved from discussion because this seems to be an issue.

@r-gochain
Copy link
Contributor

@bitcoinmeetups could you share an ABI please?

@r-gochain
Copy link
Contributor

@r-gochain
Copy link
Contributor

image
Hey @bitcoinmeetups this function has exactly 4 arguments
If you want to set gas price/limit and amount you could use command line options

gas-limit
gas-price
amount

@r-gochain
Copy link
Contributor

ok so the case in the adress[] input

@r-gochain
Copy link
Contributor

@bitcoinmeetups could you take a look at this TX - https://explorer.gochain.io/tx/0x73a474f6bbf5088ace19c0698d61d25543d5106264043a68735303c2e1039d1c - is that what you need?

@treeder
Copy link
Contributor

treeder commented Sep 29, 2021

https://github.com/gochain/web3/releases/tag/v0.2.71 release has this in it, please upgrade and give it a try.

@bitcoinmeetups
Copy link
Author

Hi @treeder,

I still get this error message when I run the command above:

ERROR: Error calling contract: mismatched argument (4) and parameter (5) counts

Anything I can do to fix the input?

@treeder
Copy link
Contributor

treeder commented Oct 11, 2021

Ahh, should have mentioned, the input for an array argument is [x,y,z] (I think, @r-gochain can you confirm?).

@r-gochain
Copy link
Contributor

Yep here is the example:

web3 contract call --address 0x92c819e24Cb020e35Fce434a33E39Fd5C85AB2aA --abi qs.abi --function swapExactETHForTokens 138607273911012674 [0d500b1d8e8ef31e21c99d1db9a6444d3adf1270,8f3cf7ad23cd3cadbd9735aff958023239c6a063,e5d77ab5fea649ca621f4f6c8a9b542fef88ab8b] 3260059519

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