struct EnforcedOptionParam {
uint32 eid;
uint16 msgType;
bytes options;
}
function setEnforcedOptions(EnforcedOptionParam[] calldata _enforcedOptions) public virtual onlyOwner {
_setEnforcedOptions(_enforcedOptions);
}
I am using tronbox console to call the contract:
tronbox(shasta)> OtcMarket.deployed().then(otc => otc.setEnforcedOptions(
[
[40245, 0, "0x0003010021010000000000000000000000000098968000000000000000000000000000e4e1c0"],
[40245, 1, "0x000301001101000000000000000000000000000186a001000104"]
])
);
I am getting the following error
ERROR: types/values length mismatch (count={"types":1,"values":2},
value={"types":["tuple(uint32,uint16,bytes)[]"],
"values":[
[40245,0,"0x0003010021010000000000000000000000000098968000000000000000000000000000e4e1c0"],
[40245,1,"0x000301001101000000000000000000000000000186a001000104"]
]}, code=INVALID_ARGUMENT, version=abi/5.7.0)
Zartaj
2
I think tuples are supposed to be passed in curly braces.
Can you try passing this instead:
[
{ eid: 40245, msgType: 0, options: "0x0003010021010000000000000000000000000098968000000000000000000000000000e4e1c0" },
{ eid: 40245, msgType: 1, options: "0x000301001101000000000000000000000000000186a001000104" }
]
OR just simply:
[
{ 40245, 0, "0x0003010021010000000000000000000000000098968000000000000000000000000000e4e1c0" },
{ 40245, 1, "0x000301001101000000000000000000000000000186a001000104" }
]
The first one gives the following error:
tronbox(shasta)> OtcMarket.deployed().then(otc => otc.setEnforcedOptions(
[
{ eid: 40245, msgType: 0, options: "0x0003010021010000000000000000000000000098968000000000000000000000000000e4e1c0" },
{ eid: 40245, msgType: 1, options: "0x000301001101000000000000000000000000000186a001000104" }
])
);
ERROR: cannot encode object for signature with missing names (argument="values",
coder={"name":"uint32","type":"uint32","localName":null,"dynamic":false,"size":4,"signed":false},
value={"eid":40245,"msgType":0,"options":"0x0003010021010000000000000000000000000098968000000000000000000000000000e4e1c0"}, code=INVALID_ARGUMENT, version=abi/5.7.0)
The second one:
OtcMarket.deployed().then(otc => otc.setEnforcedOptions([ { 40245, 0, "0x0003010021010000000000000000000000000098968000000000000000000000000000e4e1c0" }]))
^^^^^
Uncaught SyntaxError: Unexpected number