Skip to content

cakevm/foundry-huff-neo

Repository files navigation

CI Telegram Chat

Foundry Huff Neo

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.

Installing

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

Usage

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");

Deployment

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> --broadcast

Acknowledgements

This 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.

License

This project is licensed under the Apache 2.0 license.

About

A Foundry Library for compiling, debugging, and working with Huff contracts in Solidity.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 17