This is a template project to quickly bootstrap Ethereum application development using Foundry. Foundry is a blazing-fast, modular toolkit for Ethereum development written in Rust.
This template provides a basic setup for using Foundry's tools like Forge, Cast, Anvil, and Chisel. Whether you are building, testing, deploying, or interacting with smart contracts, this template will give you a solid foundation.
Foundry is a fast, portable, and modular toolkit for Ethereum application development. It includes:
- Forge: Ethereum testing framework (like Truffle, Hardhat, and DappTools).
- Cast: A Swiss army knife for interacting with EVM smart contracts, sending transactions, and getting chain data.
- Anvil: A local Ethereum node, similar to Ganache or Hardhat Network.
- Chisel: A fast, utilitarian Solidity REPL.
For detailed documentation, refer to the official Foundry book: Foundry Documentation
To get started with this project, make sure you have Foundry installed. If not, follow the instructions in the official documentation to set it up.
First, install Foundry by running the following command:
curl -L https://foundry.paradigm.xyz | bashThen, run the following command to install the necessary tools:
foundryuppre-commit is a tool to manage and maintain multi-language pre-commit hooks. It ensures that your code is checked before committing to the repository.
Install pre-commit using pipx:
pipx install pre-commitAfter installation, run the following command to set up pre-commit in your project:
pre-commit installtypos is a tool for spelling checks in your project. It helps catch common spelling mistakes in your codebase.
Install typos with Cargo:
cargo install typos-cliYou can run it using:
typosgit-cliff is a tool that generates changelogs from your commit history. It automatically creates a structured changelog for your project.
To install git-cliff, run:
cargo install git-cliffGenerate a changelog using:
git cliff --output CHANGELOG.mdTitle: Initialize Foundry Project
Description: This set of commands creates a new directory named my-project, navigates into that directory, and then initializes a new Foundry project using a custom template from the specified GitHub repository.
mkdir my-project
cd my-project/
forge init --template https://github.com/qiaopengjun5162/foundry-templateTo build the project, run the following command:
forge buildTo run tests, use the following command:
forge testTo format your Solidity code, use:
forge fmtTo take gas snapshots of your transactions, use:
forge snapshotTo start an Anvil instance, use:
anvilTo deploy contracts using Foundry, use:
forge script script/Counter.s.sol:CounterScript --rpc-url <your_rpc_url> --private-key <your_private_key>cast is a tool to interact with Ethereum smart contracts. You can use various subcommands:
cast <subcommand>For more information about cast, run:
cast --helpFor a list of available commands and options:
forge --helpanvil --helpcast --help
This project is licensed under the MIT License. See the LICENSE file for details.
Happy Coding! 🚀