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 managementFolioVersionRegistry: Version control for upgradesTrustedFillerRegistry: Whitelisted auction fillers
2
Protocol Deployment
Deploy protocol contracts:
FolioDeployer: Factory for creating FoliosGovernanceDeployer: Factory for governance systems- Implementation contracts (Governor, Timelock, StakingVault)
- Periphery contracts (Fillers, Lens)
Deployment Script
The main deployment script is located atscript/Deploy.s.sol:
Deploy.s.sol
Supported Networks
Production Networks
Ethereum Mainnet
Chain ID:
1Base
Chain ID:
8453BNB Chain
Chain ID:
56Network Configuration
Each network has predefined deployment parameters:Deployment Process
Prerequisites
1
Private Key Setup
Create a
.seed file containing your mnemonic phrase: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
- Role registries
- Fee recipients (DAO multisig)
- Version registries
- Trusted filler registries
Testing Mode
- Development testing
- Integration testing
- Staging environments
Local Deployment
Deploy to Local Anvil
1
Start Local Node
2
Deploy Contracts
In a new terminal:
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
Deployment fails with 'insufficient funds'
Deployment fails with 'insufficient funds'
Ensure the deployer address has enough ETH for gas fees. Check your balance:
Verification fails
Verification fails
- Verify the
ETHERSCAN_KEYis correct - Check that the contract bytecode matches
- Wait a few minutes and retry verification
- Use the
--watchflag for automatic retries
Wrong network parameters
Wrong network parameters
The script automatically selects parameters based on
block.chainid. Verify you’re connected to the correct network:Nonce too low error
Nonce too low error
Another transaction may be pending. Wait for it to complete or increase the nonce manually.
Security Considerations
Next Steps
Testing
Run comprehensive tests
Contributing
Contribute to the protocol