A foundry library for working with Huff contracts using huff-neo. Take a look at the project template to start your own project.
See the CHANGELOG for breaking changes and details.
First, install the huff neo compiler (command hnc) by running:
curl -L https://raw.githubusercontent.com/cakevm/huff-neo/main/hnc-up/install | bash
Then, install this library with forge:
forge install cakevm/foundry-huff-neo
Import the library:
import {HuffNeoDeployer} from "foundry-huff-neo/HuffNeoDeployer.sol";Deploy a contract:
address addr = HuffNeoDeployer.deploy("src/MyContract.huff");Deploy with constructor arguments:
address addr = HuffNeoDeployer
.config()
.with_args(abi.encode(arg1, arg2))
.deploy("src/MyContract.huff");Deploy to a network using a Foundry script:
import {HuffNeoDeployer} from "foundry-huff-neo/HuffNeoDeployer.sol";
import {Script} from "forge-std/Script.sol";
contract Deploy is Script {
function run() public returns (address) {
return HuffNeoDeployer.broadcast("src/MyContract.huff");
}
}forge script scripts/Deploy.s.sol --rpc-url <RPC_URL> --broadcastThis project is a hard-fork from foundry-huff. Many thanks to all contributors and to the authors who maintained it for such a long period! Thanks to Huff-Console for the inspiration for the logging.
This project is licensed under the Apache 2.0 license.