Perp Mechanics
This page explains the core perpetual-market mechanics used by perps. in Mainnet Beta.
Mark Price vs Index Price
Index price is the external/reference price path used by the system.
Mark price is the internal execution and PNL reference used for position state.
Trading, unrealized PNL, and liquidation checks are driven by mark/index relationships.
Funding
Funding is the mechanism that helps align perp pricing with underlying spot behavior.
When perps trade above spot reference, longs typically pay shorts.
When perps trade below spot reference, shorts typically pay longs.
Funding values shown in UI are market-state dependent and may change as positioning changes.
Margin and Leverage
Positions are opened with posted margin (collateral).
Leverage scales notional exposure relative to margin.
Higher leverage increases sensitivity to price moves and liquidation risk.
Maximum leverage depends on market and risk settings.
Liquidation Basics
A position can be liquidated when margin is no longer sufficient for maintenance requirements.
Liquidation thresholds depend on entry price, side (long/short), position size, and margin.
The liquidation price shown in UI is an estimate under current market conditions.
Liquidation Formula
In PerpEngine, liquidation is triggered when:
marginRatio < 1000 (BPS), i.e. below 10%.
Where:
marginRatio = (equity / currentNotional) * 10,000equity = margin + pnl + fundingPayment
And currentNotional is computed from the vAMM using the notional required to close the position at current curve state (not a fixed linear mark-only model).
Equivalent trigger condition:
margin + pnl + fundingPayment < 0.10 * currentNotional
Side-Specific Form (using contract PnL definitions)
Long:
pnl = currentNotional - openNotionalShort:
pnl = openNotional - currentNotional
So liquidation boundary can be written as:
Long:
margin + fundingPayment + currentNotional - openNotional < 0.10 * currentNotionalShort:
margin + fundingPayment + openNotional - currentNotional < 0.10 * currentNotional
Simplified Price Approximation (educational)
If you ignore vAMM slippage and funding, and approximate notional as |size| * price:
Long liquidation price (approx):
P_liq ≈ (P_entry - margin/|size|) / 0.9Short liquidation price (approx):
P_liq ≈ (P_entry + margin/|size|) / 1.1
These are directional guides only. The on-chain liquidation check uses the exact vAMM notional and funding-adjusted equity.
Execution and Slippage
Orders are constrained by market conditions and slippage bounds.
If execution deviates beyond the allowed threshold, the transaction can revert.
During fast moves or low liquidity, fills can be harder and execution risk increases.
Practical Notes for Users
Start with lower leverage when testing a new market.
Review entry, estimated liquidation, and fees before confirming.
Keep margin management active after entry, not only at open.
Current Risk Controls
The current hardening branch adds the following risk controls at the contract level:
maximum market open interest caps
maximum market skew caps
maximum position notional caps
a global pause switch for opening new positions
insurance-fund accounting
market-level realized bad-debt tracking
These controls are part of the platform's move from MVP behavior toward production-grade risk boundaries.
Last updated