How solidity make function signature with tuple(nested abi)?
Asked Answered
B

1

6
struct Test {
  uint ui;
  string s;
}
function test(Test t) public {
  emit Log(t.ui, t.s);
}

I have some knowledge about ABI. I made this contract with experimental ABIEncoderV2 option. In conclusion, this function's signature is 0x6056f4cc, I found this value in opcode. I tried some case test(uint256,string), test(tuple(uint256,string)), test(tuple), test(tuple[uint256,string])) with sha3... but no one make correct signature. How solidity make function signature with tuple?

Bushman answered 9/8, 2018 at 1:12 Comment(0)
B
5

You're close with the first one. The actual encoding is done from test((uint256,string)).

bytes4(keccak256("test((uint256,string))"): 6056f4cc
Beggarly answered 9/8, 2018 at 5:25 Comment(1)
Here's the online encoder if you need one: piyolab.github.io/playground/ethereum/…Tillis

© 2022 - 2024 — McMap. All rights reserved.