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?
1 Answer
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