Overview
Foundry is a Rust-based smart contract development toolchain built by Paradigm. It handles compilation, testing, deployment, and on-chain interaction from the command line. Foundry is fast, has a built-in fuzz tester, and works with Avalanche C-Chain and L1s out of the box.
Features
- Written in Rust: Fast compilation and test execution compared to JavaScript-based alternatives.
- Forge: Compile and test contracts with unit tests, fuzz tests, and invariant tests -- all written in Solidity.
- Cast: CLI tool for interacting with deployed contracts, sending transactions, and querying chain state.
- Anvil: Local EVM node for development and testing.
- Script-Based Deployment: Write deployment scripts in Solidity using
forge script.
Getting Started
- Install Foundry by following the instructions at book.getfoundry.sh.
- Initialize a project with
forge init. - Write your contracts and tests in
src/andtest/. - Run
forge testto execute your test suite. - Deploy to Avalanche C-Chain or an L1 using
forge scriptorforge create. - Use
castto interact with deployed contracts from the command line.
Documentation
For installation, tutorials, and CLI references, see the Foundry Book.
Use Cases
- Contract Development: Write, compile, and test Solidity contracts with a fast feedback loop.
- Fuzz Testing: Use Foundry’s built-in fuzzer to find edge cases in your contract logic.
- Scripted Deployments: Manage multi-step deployments with Solidity-based scripts.
- On-Chain Interaction: Query contract state and send transactions from the CLI with
cast.
Is this guide helpful?
Developer:
Paradigm
Categories:
Developer Tooling
Available For:
C-Chain
All Avalanche L1s
Website:
https://book.getfoundry.sh/Documentation:
https://book.getfoundry.sh/