Home

Awesome

<br/> <p align="center"> <a href="https://chain.link" target="_blank"> <img src="./img/chainlink-huff.png" width="225" alt="Chainlink Huff logo"> </a> </p> <br/>

A template repository for building a huff based smart contract project with Foundry.

For more information on using foundry with solidity, check out the foundry-starter-kit

Implementation of the following 2 Chainlink features using the Foundry & Huff development environment:

Table Of Contents

Getting Started

Requirements

Please install the following:

Quickstart

git clone https://github.com/smartcontractkit/huff-starter-kit
cd huff-starter-kit
make # This installs the project's dependencies.
make test

Testing

make test

or

forge test

Usage

Deploying to a network uses the foundry scripting system, where you write your deploy scripts in solidity!

Deploying to a local network

Foundry comes with local network anvil baked in, and allows us to deploy to our local network for quick testing locally.

To start a local network run:

make anvil

This will spin up a local blockchain with a determined private key, so you can use the same private key each time.

Then, you can deploy it with:

make deploy-anvil contract=<CONTRACT_NAME>

Deploying to a testnet or mainnet network

Setup

We'll demo using the Sepolia testnet. (Go here for testnet sepolia ETH.)

You'll need to add the following variables to a .env file:

Deploying

make deploy-sepolia contract=<CONTRACT_NAME>

For example:

make deploy-sepolia contract=PriceFeedConsumer

This will run the forge script, the script it's running is:

@forge script script/${contract}.s.sol:Deploy${contract} --rpc-url ${SEPOLIA_RPC_URL}  --private-key ${PRIVATE_KEY} --broadcast --verify --etherscan-api-key ${ETHERSCAN_API_KEY}  -vvvv

If you don't have an ETHERSCAN_API_KEY, you can also just run:

@forge script script/${contract}.s.sol:Deploy${contract} --rpc-url ${SEPOLIA_RPC_URL}  --private-key ${PRIVATE_KEY} --broadcast

These pull from the files in the script folder.

Misc

Disclaimer

None of the contacts have been audited, use at your own risk.

Acknowledgments

Contributing

Contributions are always welcome! Open a PR or an issue!

Thank You!

Resources

Helpful Debugging Resources: