Prerequisites
Before you begin, ensure you have the following installed on your system:- Git - Version control system
- A Unix-like environment - macOS, Linux, or WSL on Windows
Installation
Install Foundry
Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.Install Foundry using the following command:After installation, run
foundryup to install the latest versions of forge, cast, anvil, and chisel:Foundry has daily updates. Run
foundryup regularly to keep forge and cast up to date.Install Dependencies
The CTF Exchange uses Foundry’s submodule system for dependencies. Install all required dependencies:This will install all the dependencies specified in the project, including:
- OpenZeppelin contracts
- Conditional Tokens Framework
- Other necessary libraries
Project Structure
After installation, your project directory will have the following structure:Foundry Configuration
The project’sfoundry.toml file contains important configuration settings:
Key Configuration Details
Solidity Version
The project uses Solidity
0.8.15 for compilationOptimizer
Runs with 1,000,000 optimizer runs for maximum gas efficiency
Fuzz Testing
Default: 256 runs, Intense profile: 10,000 runs
FFI Enabled
Foreign Function Interface is enabled for advanced testing
Managing Dependencies
Adding New Dependencies
To install a new Foundry submodule:Removing Dependencies
To remove a dependency:Next Steps
Now that you have the development environment set up, you can proceed to:Configuration
Set up environment variables and deployment scripts
Testing
Learn about the testing framework and patterns