Liquidation System and Insurance Fund
Rationale
The liquidation mechanism safeguards the solvency of each perpetual market by ensuring that positions whose collateral no longer covers potential losses can be closed in a timely manner. When a margin ratio falls below the defined thresholds, the position is flagged as liquidatable. At this point, any external liquidator can step in to acquire the exposure at a discount, securing a profit while protecting the protocol.
Liquidation Bands
Liquidation is triggered when a position’s margin ratio (MR) drops below defined thresholds:
| Band | Threshold (default) | Action | Result |
|---|---|---|---|
| Soft (partial) | 2% < MR < 4% | Up to 50% of the position can be purchased by a liquidator. | MR is recalculated; position may survive |
| Hard (full) | MR < 2% | Full liquidation allowed | Trader is force-exited from the market entirely |
These thresholds are governance-configurable and may be fine-tuned over time. The 2% floor is a conservative default designed to shield vaults from most gap-risk scenarios.
Dynamic Discount Mechanism
Unlike flat-fee systems, Denaria applies a margin-ratio–dependent discount to liquidations.
- At higher MR levels (near the 4% soft threshold), the liquidator receives the base discount.
- As MR decreases toward the 2% hard threshold, the discount scales upward.
- At very low MR values, liquidators capture the maximum discount, reflecting the elevated systemic risk.
This design ensures liquidators are naturally incentivized to prioritize the riskiest positions first, those closest to default, thereby protecting vault solvency while keeping the incentive structure economically sustainable and avoiding bad debt
Liquidation Workflow
- Flagging – When a position’s MR falls into a liquidation band, it is automatically marked as liquidatable.
- Acquisition – Any liquidator can call
liquidate(positionId, size)to purchase part or all of the position. The acquisition price will depend on the amount of liquidity available in the system rather than the oracle price, in order to ensure that the liquidator, after closing the position, secures a profit from the operation. - Optional Close – The liquidator can:
- Immediately close the acquired exposure on the dynAMM within the same transaction (e.g., via flash-close), realizing the discount profit minus trading fees.
- Hold the exposure, assuming directional risk.
- Settlement – The trader’s debt is netted against liquidation proceeds. Surplus collateral, if any, is returned to the trader. If collateral is insufficient, the deficit becomes bad debt and is absorbed by the insurance fund.
Bad Debt Condition
A position enters bad debt when its margin ratio drops below zero:
MR < 0% ⇒ Bad Debt
In this state, the collateral is fully exhausted and cannot cover the outstanding obligation. The insurance fund steps in to absorb the deficit.
However, the likelihood and size of bad debt also depend on two additional parameters:
- Market Price – If the underlying asset price moves sharply against the trader, the collateral’s value can fall below the notional debt. This accelerates the path to MR < 0%.
- Liquidator Discount – Liquidations must occur before MR reaches 0%, since liquidators need an incentive to act. The trader effectively “pays” this incentive through a discounted transfer of their position. This means part of their remaining margin is set aside to cover the liquidator’s profit, reducing the buffer against insolvency.
Together, these dynamics explain why bad debt can still occur even when liquidations are timely:
- Fast market moves erode collateral faster than liquidation can recover it.
- Discount costs ensure liquidations remain attractive to liquidators, but this margin is lost to the trader.!

Fees & Incentives
During liquidations, liquidators acquire the position at a discounted notional value:
- The liquidator pays less than the oracle notional, securing a built-in profit margin.
- The trader forfeits the discount, which is split between the liquidator (execution incentive) and the insurance fund (system protection).
- The discount magnitude is a function of MR, with higher discounts for more under-collateralized positions.
This structure guarantees that liquidations remain profitable for external actors, even under high gas fees or sharp price moves, while continuously strengthening the insurance fund.
Insurance Fund – Purpose and Role
The Insurance Fund is the protocol’s final line of defense against insolvency. It activates only when a liquidated position’s collateral fails to fully cover its outstanding debt, typically due to sudden price gaps, oracle delays, or liquidity exhaustion. In such cases, the fund absorbs the shortfall, ensuring that:
- Liquidity providers are not exposed to protocol losses,
- The solvency of each vault remains intact,
- User trust is preserved, even in extreme conditions.
The fund is automatically replenished through a portion of trading fees.
Example – Hard Liquidation
Setup: A trader opens a long position of +3 vBTC at $100/vBTC, using $100 in collateral (3× leverage). This creates a $300 notional exposure.
| Event | Price | MR | Action |
|---|---|---|---|
| Entry | 100 | 33% | Position is healthy |
| Market drops | 70 | 3,33% | MR enters soft band |
| Further drop | 68 | 1,33% | MR enters hard band → full liquidation |