gochain/web3

Cannot send array to parameter

bitcoinmeetups opened this issue · 9 comments

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.

@bitcoinmeetups could you share an ABI please?

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

ok so the case in the adress[] input

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

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?

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

Yep here is the example:

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