etherwallet icon indicating copy to clipboard operation
etherwallet copied to clipboard

Error calling contract with address[] parameter

Open rizhenkov opened this issue 8 years ago • 8 comments
trafficstars

My contract can get array of "address" values as method parameter. But when I try to execute that method from MyEtherWallet (by pressing Write button), it fails with console errors. image Of course is "not a number" it's an address.

At the web interface this method displayed correctly: image

rizhenkov avatar Sep 20 '17 17:09 rizhenkov

I believe the issue here isn't that it's not a number, but that it is an array, not a single address. Unfortunately, I personally have no idea how to address this.

Can you please send the contract ABI / address so I may talk with the team and debug? Thank you!

tayvano avatar Oct 03 '17 05:10 tayvano

I'm facing same problem.

ernaneluis avatar Oct 03 '17 12:10 ernaneluis

Hi, same problem here, but I think I know what is wrong. Try formatting input like this: 0x7cB57B5A97eAbe94205C07890BE4c1aD31E486A8,0x7cB57B5A97eAbe94205C07890BE4c1aD31E486A8 ommit [ and ". The reason is MEW is not validating this input properly, beacause it is not treating address arrays address[] as addresses. You can type anything in the field and it becomes "green".

Your example didn't go through at least, but one can type something like this: 0x7cB57B5A97eAbe94,0x7cB57B5A97eAbe94205C0,0x7cB57B5A97eAb (too short addresses) and transaction could still be created for some contracts functions. '0's would be padded on the left for those array elements(addresses). This might lead to broadcasting badly formatted transactions(wasting gas).

I'm am not 100% that is the case, so please be carefull and test it first.

ghost avatar Oct 12 '17 07:10 ghost

Same here by using uint256[]

alessandro-c avatar Dec 30 '17 09:12 alessandro-c

Can confirm, just ran into this. @johnerfx's solution worked. UI should be updated to reflect this, but not sure of BC breaks it might cause. Will study and possibly submit PR.

Swader avatar Feb 25 '18 14:02 Swader

I will look into this as well

kvhnuke avatar Feb 25 '18 17:02 kvhnuke

To add to this, I need to pass a null address and an empty array. It doesn't look like this is possible currently.

AC0DEM0NK3Y avatar May 04 '18 08:05 AC0DEM0NK3Y

The suggestion above doesn't seem to be working atm. Neither are any other options like wrapping each address in " or []

Screen Shot 2019-05-13 at 14 37 34

elenadimitrova avatar May 13 '19 11:05 elenadimitrova