| User Book | Crate Docs |
The Huff Neo Compiler hnc
can be used as drop-in replacement for huffc
. This repository is a hard-fork from huff-rs, hopefully until huff2 is available. The compiler comes with update dependencies, improved codebase, and several fixes (see CHANGELOG). This compiler is for all those that require a production-ready compiler right now, as the original repository is archived and not supported anymore. As before, be warned that you are responsible for the contracts you deploy. Find the documentation here.
Highlights:
- Fixed line number and lexing/parsing error reporting
- Additional error handling and more details for debugging
- Migration from
ethers
toalloy
and using latestrevm
version - Improved stability and updated all dependencies
Feel free to report any issues. Since there is more than just the compiler, the foundry-huff-neo has you covered for testing and deployment, and huff-neo-toolchain for your CI/CD needs.
Since the original huff-rs repository is archived, it makes it more clear that this is something new. You can overwrite the original huffc
or use it as intended as hnc
with all the other related tools for Foundry and CI/CD.
Huff is a low-level programming language designed for developing highly optimized smart contracts. For a more detailed explanation, see the original repository huff-rs.
The PR to add the Huff Language support on GitHub is still pending.
These are the projects that are maintained for Huff Neo:
Project | Scope | Support |
---|---|---|
huff-neo | Compiler (This repo) | ✅ |
foundry-huff-neo | Foundry Plugin | ✅ |
huff-neo-toolchain | GitHub Action (Compiler) | ✅ |
huff-neo-tests-action | GitHub Action (Tests) | ✅ |
huff-neo-project-template | Project Template | ✅ |
huffmate-neo | Example Contracts | ✅ |
Supported IDEs:
Project | Editor | Status |
---|---|---|
intellij-huff-plugin | IntelliJ | ✅ |
We are very happy that someone picked up the work. In the meantime we still need some compiler to work with. We are trying to keep the original compiler up-to-date with the latest dependencies. Many, many thanks in advance to the huff2 team!
Choose one of the following methods to install the Huff Neo Compiler:
Option 1: You can use the installer hnc-up
to install the latest version of hnc
from a release or nightly build:
curl -L https://raw.githubusercontent.com/cakevm/huff-neo/main/hnc-up/install | bash
Option 2: Build it by cloning the repository and running the following command:
make release
Option 3: Install the latest version with cargo:
cargo install --git https://github.com/cakevm/huff-neo.git hnc --bins --locked
- core: The core module to huff-neo-rs. Resolves source file paths, executes compilation, and exports artifacts.
- cli: The command line interface for the Huff compiler.
- js: A wasm compatible interface to the Huff compiler for JavaScript bindings.
- lexer: Takes in the source of a
.huff
file and generates a vector ofToken
s. - parser: Crafts a
Contract
AST from the vector ofToken
s generated by huff-lexer. - codegen: EVM Bytecode generation module that accepts an AST generated by huff-parser.
- utils: Various utilities and types used by all modules.
- hnc-up: Update or revert to a specific huff-neo-rs branch with ease. (Forked from foundry)
Feel free to create any issue or PR. We are always looking for contributors to help us improve the project.
Before submitting a PR, please make sure to run the following commands:
make pre-release
Caution
Please be aware that the resulting bytecode can be unsafe. It is your responsibility to ensure that the contracts are safe and secure. The authors of this project are not responsible for any misuse or loss of funds.
Many thanks to all huff-rs contributors and to the authors who maintained it for such a long period! Many thanks as well to the huff-docs contributors. The book
directory is a hard-fork from this repository. Again thanks to the original Huff Language compiler: huffc
. Thanks to ripc, and big shoutout to Paradigm. Without Foundry the original implementation would not be possible.
The all code and content except the book
directory is, as the original huff-rs, dual licensed under Apache 2.0 or MIT licence. The book
directory is a hard-fork from huff-docs and licensed as the source under the MIT license.