dapptools
dapptools copied to clipboard
support tuples in abi encoding
pragma experimental "ABIEncoderV2";
contract A {
struct A {
uint x;
uint y;
}
function test_A(A calldata a) external {
}
}
There is a workaround: structs are abiencoded as their components, so for example a function:
pragma experimental "ABIEncoderV2";
contract A {
struct A {
uint x;
uint y;
}
function test_A(A calldata a) external {
}
}
the function signature for test_A is
0x772d5055: test_A((uint256,uint256))
aka seth sig "test_A((uint256,uint256)).
However, if you do seth calldata "test_A((uint256,uint256))" 1 2 you will run into problems in parsing the extra parens (it's not valid solidity syntax). But the encoding of the arguments is the same, only the function signature differs. So you can cut in the correct function signature but use the normal way of encoding the arguments:
echo $(seth sig "test_A((uint256,uint256)")$(seth calldata "test_A(uint256,uint256)" 1 2 | cut -c 11-)
It seems there is a typo on the suggestion above - one extra "(" in front of test_A. So I think the intention was the following:
echo $(seth sign "test_A(uint256,uint256)")$(seth calldata "test_A(uint256,uint256)" 1 2 | cut -c 11-)