Appearance
Factory Deployment Flow
This diagram shows the complete pool deployment sequence via the PoolFactory contract.
Process Overview
The PoolFactory deploys a complete pool system in a single transaction:
- Deploy StructuredPool (BeaconProxy) - includes integrated credit line functionality
- Register pool in Registry
- Deploy Tranche (BeaconProxy)
- Deploy immutable Reserve (in Tranche constructor)
- Register tranche with pool
Gas Costs
| Component | Type | Approximate Gas |
|---|---|---|
| StructuredPool | BeaconProxy | ~200k gas |
| Tranche | BeaconProxy | ~200k gas |
| Reserve | New Instance | ~1M gas |
| Total | ~1.4M gas |
Key Points
- Atomic Deployment: Everything deployed in single transaction
- Gas Efficient: BeaconProxies save ~94% gas vs full contract deployments
- Integrated Credit Line: StructuredPool includes built-in credit line management (no separate controller)
- Immutable Custody: Reserve has no upgrade mechanism
- Mass Upgradeable: StructuredPool and Tranche use BeaconProxy pattern
- Timelock Protected: All beacon upgrades require 2-day timelock
- Two-Party Auth: Upgrades require both PROTOCOL_ADMIN and TIMELOCK_ADMIN
- Registry Integration: Immediate registration ensures consistency
Contract Upgradeability
| Contract | Upgradeable | Pattern | Notes |
|---|---|---|---|
| StructuredPool | ✅ Yes | BeaconProxy | Mass upgrade via poolBeacon (includes credit line logic) |
| Tranche | ✅ Yes | BeaconProxy | Mass upgrade via trancheBeacon |
| Reserve | ❌ No | Regular | Immutable custody contract |
Upgrade Process
To upgrade any pool component:
- PROTOCOL_ADMIN schedules upgrade on the respective beacon (poolBeacon or trancheBeacon)
- Wait 2-day timelock period
- PROTOCOL_ADMIN executes upgrade
- All instances of that contract type are immediately upgraded
See Upgradeability Guide for detailed upgrade procedures.
Related Documentation
- Upgradeability Guide - Complete guide to upgrading all protocol components
- Architecture Overview - Complete system architecture
- Developer Guide - How to deploy pools programmatically
- Auditor Introduction - Security considerations and upgrade patterns