I am using Foundry, and I need to calculate the 4-byte selector of a custom error. How can I do this with the cast CLI?
Asked
Active
Viewed 326 times
3
Paul Razvan Berg
- 17,902
- 6
- 73
- 143
1 Answers
3
You can use cast sig for this, which takes a single input in the form of NAME(type1,type2,...).
Here's an example:
$ cast sig "transfer(address,uint256)"
Will output:
0xa9059cbb
Paul Razvan Berg
- 17,902
- 6
- 73
- 143