3

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?

Paul Razvan Berg
  • 17,902
  • 6
  • 73
  • 143

1 Answers1

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