2

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?

2

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'
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.