Overview
Overview
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. EMA Price (Smoothed 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.
Borrowing & Collateralization
Each user can deposit either Token0 or Token1 as collateral. Debt is tracked per user using debt shares, ensuring proportional interest accrual.
Let:
: collateral in Token0
: debt in Token1
: collateral factor (e.g. 85%)
Then borrowing is allowed if:
Solvency is checked against EMA prices, not spot, to prevent manipulation.
Interest Rate Model
Each pool uses a dynamic interest rate model that adjusts based on utilization:
Depending on , the borrow rate evolves:
Utilization Bands:
Low: → rate decays (halves) exponentially
High: → rate grows (doubles) exponentially
In-between: rate remains stable
The model uses an exponential formula with a tunable half-life ( T_{1/2} ):
Accrued interest is computed as:
Where the integral is calculated using:
The rate is updated on any pool interaction (swap
, borrow
, repay
, etc.).
Liquidation & Solvency Enforcement
There are no auctions or instant liquidations. Instead, when a borrower exceeds their limit:
Their position is marked as insolvent.
Their debt is written off (removed from the debt pool).
This model avoids large price impacts, frontrunning, and incentivizes safe borrowing by LPs and traders alike.
Liquidation protection logic ensures:
Pool stays solvent even if collateral drops in value.
LPs do not suffer withdrawal failures due to shortfall in reserves.
Recursive Leverage (Looping)
To take leveraged positions on a token (say ), users can:
Deposit as collateral.
Borrow .
Swap → .
Repeat steps 1–3.
This loop effectively increases exposure to , achieving leverage.
Leverage achievable is capped by the collateral factor :
Example with :
This model is similar to recursive borrowing in protocols like Compound or Aave, but is achieved here within a single isolated pool, avoiding cross-asset risk.
Summary
Pricing
Spot (for swaps), EMA (for lending)
Liquidations
Streaming write-off
Interest Rates
Exponential decay/growth based on utilization
Borrowing Model
Isolated per pool
Leverage
Recursive, within single pool
Oracles
Not required
Omnipair combines capital efficiency with safety by avoiding systemic liquidation risks, external oracles, and governance bottlenecks.
Last updated