Skip to content
/ chuff Public

Common Solidity contract patterns, based on OpenZeppelin's contract library, implemented in the Huff language

Notifications You must be signed in to change notification settings

alexroan/chuff

Repository files navigation

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

Getting Started

Requirements

Please install the following:

  • Git
    • You'll know you've done it right if you can run git --version
  • Foundry / Foundryup
    • This will install forge, cast, and anvil
    • 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
  • 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

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!

Resources

Helpful Debugging Resources:

About

Common Solidity contract patterns, based on OpenZeppelin's contract library, implemented in the Huff language

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages