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

∥☆過路亽.° 提交于 2019-12-11 01:17:15

问题


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?


回答1:


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

bytes4(keccak256("test((uint256,string))"): 6056f4cc


来源:https://stackoverflow.com/questions/51757569/how-solidity-make-function-signature-with-tuplenested-abi

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!