Prerequisites
Before you begin, ensure you have the following tools installed:Foundry
Ethereum development toolkit
Node.js v20+
JavaScript runtime environment
Yarn
Package manager
Install Foundry
Foundry is the primary development framework for Reserve Folio. Install it using the following command:Install Node.js
Reserve Folio requires Node.js version 20 or higher. We recommend using nvm to manage Node.js versions:Install Yarn
Install Yarn globally using npm:Clone the Repository
Clone the Reserve Folio repository and navigate to the project directory:Install Dependencies
Install the required dependencies using Yarn:- OpenZeppelin Contracts: Standard smart contract libraries
- PRB Math: Advanced fixed-point math library
- Reserve Governor: Governance framework
- Trusted Fillers: Auction filling mechanisms
- Forge Standard Library: Testing utilities
Configuration
Environment Variables
Create a.env file in the project root based on .env.example:
.env
You can get free RPC endpoints from Alchemy, Infura, or use public endpoints from PublicNode.
Foundry Configuration
The project comes with a pre-configuredfoundry.toml file that includes:
foundry.toml
Build the Project
Compile the smart contracts using Forge:forge compile and generates the contract artifacts in the out/ directory.
Check Contract Sizes
To verify that contracts are within the size limit:Code Quality
Formatting
Format Solidity, TypeScript, and configuration files:Linting
Run Solhint to check for code quality issues:Local Development Network
Start a local Anvil node forked from Ethereum mainnet:http://127.0.0.1:8545 with chain ID 31337, forked from Ethereum mainnet.
The local node uses historical state from Ethereum mainnet, allowing you to test against real deployed contracts and token balances.
Verify Your Setup
Run the test suite to verify your setup is working correctly:Next Steps
Running Tests
Learn how to run and write tests
Deployment
Deploy contracts to networks
Troubleshooting
Forge command not found
Forge command not found
Make sure Foundry is properly installed and added to your PATH. Run
foundryup to update to the latest version.Compilation errors
Compilation errors
Ensure you’re using Solidity version 0.8.28. Run
forge --version to check your compiler version.Out of memory errors
Out of memory errors
The project requires significant memory for compilation. Try increasing your system’s available memory or reducing the
memory_limit in foundry.toml.RPC connection issues
RPC connection issues
Verify your RPC endpoints in the
.env file are valid and have sufficient rate limits.