A CLI tool that scans Solidity files for error declarations and generates their corresponding 4-byte error codes.
- Clone this repository
- Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # On Linux/Mac
# or
.\venv\Scripts\activate # On Windows
- Install the required dependencies:
pip install -r requirements.txt
Run the script by providing the directory to scan:
python scanner.py /path/to/solidity/files
The tool will:
- Recursively scan all
.sol
files in the specified directory - Find error declarations (e.g.,
error INSUFFICIENT_MINT_FEE();
) - Generate and print the 4-byte error codes for each error found
In file: /path/to/file.sol
Error: INSUFFICIENT_MINT_FEE
Code: 0x2c5211c6