General Automated Market Maker
Omnipair is powered by a Generalized Automated Market Maker (GAMM), a primitive that combines constant-product AMM functionality with isolated lending logic. This allows a single pool to support both spot trading and margin borrowing without oracles or centralized risk config.
Each pool holds a token pair and provides:
Swap functionality via spot prices
Margin borrowing based on time-weighted EMA prices
Interest accrual via utilization-based dynamic rates
Liquidation through write-offs and streaming collateral
Each pool is defined by two tokens (, ). Liquidity is added in a constant product — where — fashion, and reserves are tracked.` Each pool contains two types of reserves:
Virtual Reserve
Actual Reserve
1. Spot Price
Derived from the pool's token virtual reserves:
Used for swap execution and is updated by every spot trade, while Lent liquidity is not calculated in the virtual reserves:
2. Time-weighted EMA Price (Lending price)
A time-weighted Exponential Moving Average of the spot price. EMA pricing smooths volatility and prevents manipulation around liquidation events.
Where:
: Time since last update
: Exponential decay constant (half-life converted to continuous time)
This price is used to compute borrowing power and liquidation thresholds.
Last updated