chuff
chuff copied to clipboard
Common Solidity contract patterns, based on OpenZeppelin's contract library, implemented in the Huff language
Chuff - Huff Utility Contracts
Common Solidity contract patterns, based on Openzeppelin's contract library, implemented in the Huff language:
- Access Control:
access/Ownable.huff
- Safe Math:
math/SafeMath.huff
Spoiler: It's cheap.
Table Of Contents
- Table Of Contents
-
Getting Started
- Requirements
- Quickstart
- Gas Comparison
- Testing
-
Misc
- Disclaimer
- Contributing
- Resources
- Helpful Debugging Resources:
Getting Started
Requirements
Please install the following:
-
Git
- You'll know you've done it right if you can run
git --version
- You'll know you've done it right if you can run
-
Foundry / Foundryup
- This will install
forge
,cast
, andanvil
- You can test you've installed them right by running
forge --version
and get an output like:forge 0.2.0 (f016135 2022-07-04T00:15:02.930499Z)
- To get the latest of each, just run
foundryup
- This will install
-
Huff Compiler
- You'll know you've done it right if you can run
huffc --version
and get an output like:huffc 0.2.0
- You'll know you've done it right if you can run
Quickstart
git clone https://github.com/alexroan/huff-math.git
cd huff-math
make
Gas Comparison
Gas comparison tests between the Huff implementation and native Solidity checked math can be found in the test files. The naming convention for these comparisons are:
function test<function_name>Gas[Huff/Solidity]() public {...}
Results can be found in .gas-snapshot in the repo root.
Testing
make test
or forge test
Misc
Disclaimer
None of the contacts have been audited, use at your own risk.
Contributing
Contributions are always welcome! Open a PR or an issue!
Thank You!