Contract Architecture

The CLOB system is composed of multiple contracts with clearly defined responsibilities and interactions.

Contract Hierarchy


Contract Responsibilities

ContractLayerResponsibility
CLOBRouterEntryUser-facing API for orders, deposits, withdrawals
CLOBSwapRouterEntryOptimized swap execution across pools
PoolManagerManagementPool lifecycle, trading rules, OrderBook deployment
OrderBookCoreOrder matching and trade execution
BalanceManagerCoreFund custody, locking, fee collection
HooksRegistryExtensionCustom hook registration and execution
MarketMakingVaultExtensionAutomated market making strategies
VaultGaugeExtensionIncentive 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

ContractAuthorized Callers
OrderBookCLOBRouter, PoolManager
BalanceManagerCLOBRouter, OrderBook
HooksRegistryOrderBook

Role-Based Access

RolePermissions
OwnerUpgrade contracts, configure fees, pause trading
OperatorCreate pools, modify trading rules
RouterPlace/cancel orders, manage balances
OrderBookLock/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

ContractAddress
CLOBRouter0xb48e7Be0F7765F5298DC748990B7f075F047cBBf
CLOBPoolManager0x0756D47160E2d1Ad04ddc2aB95e57e7Dd0588Dd0
CLOBBalanceManager0x86507244cc1d15FBb929A1E222a31A92784aEf66