Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/reserve-protocol/reserve-index-dtf/llms.txt

Use this file to discover all available pages before exploring further.

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:
curl -L https://foundry.paradigm.xyz | bash
foundryup
Verify your installation:
forge --version

Install Node.js

Reserve Folio requires Node.js version 20 or higher. We recommend using nvm to manage Node.js versions:
nvm install 20
nvm use 20

Install Yarn

Install Yarn globally using npm:
npm install -g yarn

Clone the Repository

Clone the Reserve Folio repository and navigate to the project directory:
git clone https://github.com/reserve-protocol/reserve-index-dtf.git
cd reserve-index-dtf

Install Dependencies

Install the required dependencies using Yarn:
yarn install
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:
cp .env.example .env
Configure the following environment variables:
.env
FORK_RPC_MAINNET="your-ethereum-mainnet-rpc-url"
FORK_RPC_ARBITRUM="your-arbitrum-rpc-url"
FORK_RPC_BASE="your-base-rpc-url"
ETHERSCAN_KEY="your-etherscan-api-key"
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
[profile.default]
script = "script"
src = "contracts"
test = "test"

gas_limit = "18446744073709551615"
memory_limit = 1073741824

optimizer = true
optimizer_runs = 200
solc_version = "0.8.28"
evm_version = "paris"

[rpc_endpoints]
base = "https://base-rpc.publicnode.com"
bsc = "https://bsc-rpc.publicnode.com"
mainnet = "https://ethereum-rpc.publicnode.com"

Build the Project

Compile the smart contracts using Forge:
yarn compile
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:
yarn size

Code Quality

Formatting

Format Solidity, TypeScript, and configuration files:
yarn format
Check formatting without making changes:
yarn format:check

Linting

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

Local Development Network

Start a local Anvil node forked from Ethereum mainnet:
yarn anvil
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:
yarn test
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.

Build docs developers (and LLMs) love