CLOB Architecture
Contract Architecture
Contract hierarchy, responsibilities, and authorization model
Contract Architecture
The CLOB system is composed of multiple contracts with clearly defined responsibilities and interactions.
Contract Hierarchy
Contract Responsibilities
| Contract | Layer | Responsibility |
|---|---|---|
| CLOBRouter | Entry | User-facing API for orders, deposits, withdrawals |
| CLOBSwapRouter | Entry | Optimized swap execution across pools |
| PoolManager | Management | Pool lifecycle, trading rules, OrderBook deployment |
| OrderBook | Core | Order matching and trade execution |
| BalanceManager | Core | Fund custody, locking, fee collection |
| HooksRegistry | Extension | Custom hook registration and execution |
| MarketMakingVault | Extension | Automated market making strategies |
| VaultGauge | Extension | Incentive distribution for LPs |
Beacon Proxy Pattern
OrderBook contracts are deployed as Beacon Proxies, allowing efficient upgrades across all trading pairs.
Benefits:
- Single upgrade transaction affects all pools
- Lower deployment cost per pool
- Consistent behavior across all trading pairs
Authorization Model
The system implements a strict authorization hierarchy:
Caller Authorization
| Contract | Authorized Callers |
|---|---|
| OrderBook | CLOBRouter, PoolManager |
| BalanceManager | CLOBRouter, OrderBook |
| HooksRegistry | OrderBook |
Role-Based Access
| Role | Permissions |
|---|---|
| Owner | Upgrade contracts, configure fees, pause trading |
| Operator | Create pools, modify trading rules |
| Router | Place/cancel orders, manage balances |
| OrderBook | Lock/unlock funds, execute transfers |
Upgradeability
The contracts use ERC-7201 namespaced storage for safe upgrades.
What Can Be Upgraded
- OrderBook implementation (via beacon)
- Router logic
- BalanceManager logic
- Hooks implementation
What Cannot Be Changed
- Core authorization relationships
- Fund custody guarantees
Contract Addresses
| Contract | Address |
|---|---|
| CLOB Router | Coming soon |
| CLOB Pool Manager | Coming soon |
| CLOB Balance Manager | Coming soon |
| CLOB Quoter | Coming soon |
| Contract | Address |
|---|---|
| CLOB Router | 0x6E613404350c32f3F864D4b852CcD573ECEb4679 |
| CLOB Pool Manager | 0x997De90D186aFE1c0b6cFe97B42942D9F6537869 |
| CLOB Balance Manager | 0x8d777945EF39A2191111ba16F362C29C75774a74 |
| CLOB Quoter | 0x891684a15072Fc8A284ae19462a5B95259DF2727 |