Skip to main content

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:
Verify your installation:

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:
This will install:
  • 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:
Configure the following environment variables:
.env
You can get free RPC endpoints from Alchemy, Infura, or use public endpoints from PublicNode.

Foundry Configuration

The project comes with a pre-configured foundry.toml file that includes:
foundry.toml

Build the Project

Compile the smart contracts using Forge:
This command runs 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:
Check formatting without making changes:

Linting

Run Solhint to check for code quality issues:
Automatically fix linting issues:

Local Development Network

Start a local Anvil node forked from Ethereum mainnet:
This starts a local node at 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:
If all tests pass, your development environment is ready!

Next Steps

Running Tests

Learn how to run and write tests

Deployment

Deploy contracts to networks

Troubleshooting

Make sure Foundry is properly installed and added to your PATH. Run foundryup to update to the latest version.
Ensure you’re using Solidity version 0.8.28. Run forge --version to check your compiler version.
The project requires significant memory for compilation. Try increasing your system’s available memory or reducing the memory_limit in foundry.toml.
Verify your RPC endpoints in the .env file are valid and have sufficient rate limits.