Shared enums (Side, Mode, CloseReason, FeeType, MarginMode), structs (Position, MarginConfig, OracleConfig, ForwardRound), and constants (PRICE_PRECISION, BPS_DENOMINATOR, EUR_USD_PAIR_ID, USD_JPY_PAIR_ID) used across all protocol contracts
All shared type definitions live in Types.sol and are imported by every contract. This page is the canonical reference — individual contract pages link here rather than duplicating definitions.
There is noTenor enum. Tenors are stored as raw uint32 tenorSeconds values in a dynamic registry on Config. New maturities are added permissionlessly via Config.registerTenor(tenorSeconds) and removed via Config.disableTenor(tenorSeconds).Currently registered on Sepolia:
Label
Seconds
1D
86,400
1W
604,800
1M
2,592,000
3M
7,776,000
6M
15,552,000
1Y
31,536,000
Read the live set with Config.getEnabledTenors(). The TypeScript and Rust SDKs ship a bundled cache (TENORS) sourced from the canonical defaults file, but consumers should prefer the on-chain getter for authoritative state.
Every position is stored onchain as a Position struct:
struct Position { address account; // Owner address bytes32 pairId; // Currency pair identifier (e.g., keccak256("EUR/USD")) Side side; // LONG or SHORT uint256 notional; // Position size in USDC (6 decimals) uint32 tenorSeconds; // Tenor duration in seconds (dynamic registry) uint64 openTimestamp; // Block timestamp when opened uint64 fixingTimestamp; // Maturity date (business day adjusted) int256 entryStrike; // Forward price at open (18 decimals) uint64 entryOracleRoundId; // Oracle round ID at open uint256 imLocked; // Locked initial margin (mutable via add/remove) uint256 mmThreshold; // Maintenance margin liquidation threshold PositionStatus status; // OPEN or CLOSED CloseReason closeReason; // Why it was closed (NONE while open) uint64 closeTimestamp; // When closed (0 while open) int256 closePrice; // Settlement price at close (18 decimals) int256 realizedPnl; // Capped PnL used for accounting int256 marketPnl; // Uncapped true mathematical PnL uint16 snapshotImBps; // IM factor at time of open uint16 snapshotMmBps; // MM factor at time of open uint16 snapshotTradingFeeBps; // Trading fee rate at time of open uint16 snapshotLiquidationPenaltyBps; // Liquidation penalty at time of open uint256 snapshotOracleFee; // Oracle fee at time of open MarginMode marginMode; // ISOLATED (M2 only)}
The imLocked field is the only mutable economic field on an open position. It changes when the trader adds or removes margin. All snapshot* fields are immutable after position creation.
struct OpenPositionParams { bytes32 pairId; // Currency pair (e.g., EUR_USD_PAIR_ID) Side side; // LONG or SHORT uint256 notional; // Position size in USDC (6 decimals) uint32 tenorSeconds; // Contract duration in seconds (must be enabled in Config) uint256 margin; // Initial margin to lock (6 decimals)}
struct FixingConfig { uint8 fixingHourUtc; // Hour of fixing time (0-23) uint8 fixingMinuteUtc; // Minute of fixing time (0-59) uint8 fixingSecondUtc; // Second of fixing time (0-59)}