If a function takes an enum as a parameter
function foo(MyEnum arg1, uint256 arg2) public returns (bool);
how do I properly compute the function selector for that function?
Ethereum Stack Exchange is a question and answer site for users of Ethereum, the decentralized application platform and smart contract enabled blockchain. It only takes a minute to sign up.
Sign up to join this communityIf a function takes an enum as a parameter
function foo(MyEnum arg1, uint256 arg2) public returns (bool);
how do I properly compute the function selector for that function?
If you compile a contract with that function in it and take a look at the generated ABI, you'll see that the enum parameter ends up being a uint8
. So compute the selector like this:
web3.sha3('foo(uint8,uint256)').substring(0,10) === '0xfec108d0'