Skip to main content

Overview

Reserve Folio uses Foundry’s scripting system for deterministic, reproducible deployments. The deployment process handles both genesis deployments (protocol infrastructure) and follow-up deployments (Folio instances).

Deployment Architecture

Deployments occur in two phases:
1

Genesis Deployment

Deploy core protocol infrastructure:
  • FolioDAOFeeRegistry: DAO fee management
  • FolioVersionRegistry: Version control for upgrades
  • TrustedFillerRegistry: Whitelisted auction fillers
2

Protocol Deployment

Deploy protocol contracts:
  • FolioDeployer: Factory for creating Folios
  • GovernanceDeployer: Factory for governance systems
  • Implementation contracts (Governor, Timelock, StakingVault)
  • Periphery contracts (Fillers, Lens)

Deployment Script

The main deployment script is located at script/Deploy.s.sol:
Deploy.s.sol

Supported Networks

Production Networks

Ethereum Mainnet

Chain ID: 1

Base

Chain ID: 8453

BNB Chain

Chain ID: 56

Network Configuration

Each network has predefined deployment parameters:

Deployment Process

Prerequisites

1

Private Key Setup

Create a .seed file containing your mnemonic phrase:
Never commit .seed to version control. It’s already in .gitignore.
2

Environment Variables

Set required environment variables:
.env
3

Fund Deployer Address

The deployer address (derived from your seed phrase) must have sufficient ETH for:
  • Gas fees (estimated: 0.1-0.5 ETH depending on network)
  • Contract creation costs

Deployment Commands

Deploy to Ethereum Mainnet

Deploy to Base

Deploy to BNB Chain

The --verify flag automatically verifies contracts on block explorers. The API key is read from ETHERSCAN_KEY environment variable and works for all explorers (Etherscan, Basescan, BscScan).

Custom RPC Endpoint

Use a custom RPC URL:

Deployment Modes

The deployment script supports two modes:

Production Mode

Uses canonical production parameters for:
  • Role registries
  • Fee recipients (DAO multisig)
  • Version registries
  • Trusted filler registries

Testing Mode

Uses test parameters for:
  • Development testing
  • Integration testing
  • Staging environments
Always verify the deployment mode is set correctly before deploying to mainnet!

Local Deployment

Deploy to Local Anvil

1

Start Local Node

2

Deploy Contracts

In a new terminal:
Local deployments automatically use mock contracts for:
  • MockRoleRegistry: Simplified role management
  • Burn address for fees (address(1))

Deployment Output

Successful deployment outputs contract addresses:
Save these addresses for future reference and verification.

Contract Verification

Contracts are automatically verified when using the --verify flag. Manual verification:

Post-Deployment

Verify Deployment

1

Check Contract Addresses

Verify all contracts deployed successfully and addresses are non-zero.
2

Verify Registry Configuration

3

Verify Role Configuration

Ensure the role registry is correctly configured for the network.
4

Test Basic Functionality

Deploy a test Folio instance to verify the system works end-to-end.

Register Version

After deployment, register the new Folio version:

Deployment Checklist

Troubleshooting

Ensure the deployer address has enough ETH for gas fees. Check your balance:
  • Verify the ETHERSCAN_KEY is correct
  • Check that the contract bytecode matches
  • Wait a few minutes and retry verification
  • Use the --watch flag for automatic retries
The script automatically selects parameters based on block.chainid. Verify you’re connected to the correct network:
Another transaction may be pending. Wait for it to complete or increase the nonce manually.

Security Considerations

  • Never commit private keys or seed phrases
  • Use hardware wallets for mainnet deployments when possible
  • Verify all addresses and parameters before broadcasting
  • Test thoroughly on testnets before mainnet deployment
  • Use multisig wallets for protocol ownership

Next Steps

Testing

Run comprehensive tests

Contributing

Contribute to the protocol