0

Apologies in advance about my English but I'm still learning :)

I'm doing some tests with a contract that has this concrete function

function createBuyOrder(
    address token, 
    uint tokensTotal,
    uint8[] exchanges,
    address[5][] orderAddresses,
    uint[6][] orderValues,
    uint[] exchangeFees,
    uint8[] v,
    bytes32[] r,
    bytes32[] s
  ) 

as you can see, I need to pass 2 nested arrays to the function, but when I do it in remix I get this error: "Error encoding arguments".

The arguments im passing are:

token: "0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359"

tokensTotal: 1233

exchanges: [1]

orderAddresses:

[["0x0004e79c978b95974dca16f56b516be0c50cc652"], ["0x0000000000000000000000000000000000000000"],["0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"],["0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359"],["0xa258b39954cef5cb142fd567a46cddb31a670124"]]

orderValues:

[[20000000000000000000], [13826078276400000000000],[0],[0],[1526956201,[44981771799304801685616814501018498376938501293606517488617232210966542022274]]

exchangeFees: [0]

v: [27]

r:["0xde7ff8f42676ba3bb5986f869ac00b6aa061f41a281b943f9e8c88c3c17cd4fa"]

s:["0x2628b4330c1cb3e3ee6be748cc5c55ed19374a016063ebd9a0b1c77fd91e8024"]

1

Ok, I played a bit with twodimensional arrays after reading your question and it turns out that when you expect argument in that form:

uint[6][] orderValues

your outer 'array' may have any size, but each 'inner' must contain exactly six elements.

So for example, instead of providing argument like that

[[1],[1],[1],[1],[1],[1]]

you should provide it like that:

[[1,1,1,1,1,1]]

If it doesn't fit your model, you have to rearange it somehow.

Edit: I also noticed that trying provide some very big number as uint argument, like 20000000000000000000 in your example, you may also get some error. To resolve that, you may try putting this value in double quotes, even though it is uint and not a string, like that: "20000000000000000000"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.