Crates.io | selectoor |
lib.rs | selectoor |
version | 0.1.0 |
source | src |
created_at | 2023-01-03 05:14:02.496029 |
updated_at | 2023-01-03 05:14:02.496029 |
description | An easy-to-use CLI tool to generate optimal function selectors for Solidity smart contracts |
homepage | |
repository | https://github.com/adithyanarayan/selectoor |
max_upload_size | |
id | 749917 |
size | 436,646 |
Selectoor is a CLI tool that generates optimal function names so that the solidity function selector has a good number of zero bytes. This helps reduce the gas cost of calling the function due to cheaper zero byte calldata.
To install this tool, first clone the repository.
git clone git@github.com:AdithyaNarayan/selectoor.git
Install the tool globally using cargo
.
cargo install --path selectoor
After installation, the binary will be available as selectoor
.
Pull up the help screen with --help
selectoor --help
selectoor generate --help
Currently, the tool supports providing human-readable abi or function signature using the -s
flag and the generated ABI JSON artifact using the -a
flag.
selectoor generate -s "transfer(address _to, uint256 _amount)"
The CLI will automatically strip the variable names and generate a list of function signatures with optimal selectors.
The CLI does this by generating prefixes of fixed length to the function name, so as to not compromise on readability while maintaining low gas cost. Example: transfer(address,uint256)
-> transfer_XXXX(address,uint256)
selectoor fmt
that modifies all *.sol
files and replaces the function singaturesPlease feel free to raise a pull request or issues for more features.