Skip to main content
The protocol deploys eight contracts around a central Protocol Registry. Singleton contracts (Config, OracleModule, ModeController, RiskManager) serve all pools. Pool-scoped contracts (PositionManager, SettlementEngine, PoolVault, MarginAccounts) are instantiated per collateral token — currently USDC only.

Contract Architecture

The Protocol Registry is the root — all contracts discover each other through it rather than storing direct addresses. Solid arrows show ownership, dotted arrows show runtime reads.

Contract Summary

ContractPurposeKey Functions
PositionManagerPosition lifecycle: open, increase, reduce, margin adjustopenPosition, increasePosition, addPositionMargin, removePositionMargin
SettlementEngineSettlement at maturity, liquidation, early terminationsettlePosition, liquidatePosition, closePosition, reducePosition
PoolVaultERC-4626 LP vault, counterparty to all trader positionsdeposit, withdraw, mint, redeem, applyPnl
MarginAccountsTrader collateral custody and per-position margin lockingdeposit, withdraw, lockMargin, settlePosition
OracleModulePyth spot prices, publisher forward prices, fixing pricespublishForwardRound, recordFixingPriceFromPyth, getForwardPrice
ConfigProtocol parameters: margin, fees, tenors, pricingsetMarginConfig, setPricingConfig, setTimeConfig
ModeControllerOperating mode state machine (NORMAL → DEGRADED → REDUCE_ONLY → PAUSED)enterPausedMode, exitPausedMode, setReduceOnly, checkOracleAndPause
RiskManagerPer-position, per-account, pool exposure caps, rate-of-change throttlingvalidateOpenPosition, maxNetExposure, maxPositionNotional

Access Control

RoleCapabilities
DEFAULT_ADMIN_ROLEFull admin — set config, manage roles, mode transitions
PAUSER_ROLEEmergency pause/unpause only
PUBLISHER_ROLESubmit forward prices via OracleModule
ORACLE_ADMIN_ROLEConfigure oracle safeguard parameters
RISK_ADMIN_ROLEConfigure risk caps and rate-of-change limits

Architecture

Full system architecture including off-chain services.

Types Reference

Shared enums, structs, and constants used across all contracts.

Errors Reference

Complete reference of custom errors by contract.