Liquidation
Proactive liquidation mechanics to ensure protocol solvency
Liquidation ensures protocol solvency by allowing third-party keepers (or anyone) to intervene when a user's equity falls below the maintenance margin. This prevents bad debt from cascading during market volatility.
Liquidation Trigger
A user becomes liquidatable when:
Important: Both longs AND shorts can be liquidated if their equity falls below maintenance margin. The key difference is in their risk profiles:
| Position Type | Max Settlement Loss | Margin Basis | Can Be Liquidated? |
|---|---|---|---|
| Option Long + Premium Payer | Premium Payer obligation (bounded, deterministic) | Option stress loss + Notional Buffer | Yes |
| Option Short + Premium Receiver | Stressed intrinsic - Premium receivable | Stressed option loss + Notional Buffer | Yes |
| Mixed portfolios | Combined exposure | Portfolio stress loss + Notional Buffer | Yes |
Note: In the Four-Instrument Model, option positions and premium positions are separate instruments. A typical buyer holds both an Option Long AND a Premium Payer position. The premium obligation comes from the Premium Payer instrument, not from the Option Long.
See Margin System: Long Only for detailed margin calculations.
The Liquidation Process
- Trigger: Keeper detects Equity < MM
- Calculate: Determine debt and positions to close
- Transfer Positions at penalized mark price:
- Long positions: Liquidator pays user at mark × (1 - penalty%) and receives the optionBalance
- Short positions: User pays liquidator at mark × (1 + penalty%) for taking the obligation
- Pay Bounty: Liquidator receives 5% of debt (from user's collateral first, insurance covers any shortfall)
- Cover Remaining Debt: If user still has negative equity after transfers, insurance fund covers
Important: Only the optionBalance transfers to the liquidator. The user's premiumBalance (premium obligations) remains with the user and settles at expiry. Liquidators must have deposited collateral (USDC) to pay for acquiring long positions.
Position Transfer Cash Flows
Liquidation uses a position transfer model — the liquidator acquires positions rather than closing them on the market. This creates bidirectional USDC flows through the vault:
┌─────────────────────────────────────────────────────────────────────┐
│ LONG POSITIONS: Liquidator buys at discount │
├─────────────────────────────────────────────────────────────────────┤
│ │
│ Liquidator ────USDC (mark × (1 - penalty%))────► User (liquidated) │
│ │ │ │
│ │ Receives position │ │
│ │ (at discount) Receives cash │
│ ▼ (loses position) │
│ │
└─────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────┐
│ SHORT POSITIONS: Liquidator takes obligation for payment │
├─────────────────────────────────────────────────────────────────────┤
│ │
│ User (liquidated) ────USDC (mark × (1 + penalty%))────► Liquidator │
│ │ │ │
│ │ Pays to transfer Receives cash │
│ │ short obligation + takes obligation │
│ ▼ │
│ │
└─────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────┐
│ BOUNTY + SHORTFALL COVERAGE │
├─────────────────────────────────────────────────────────────────────┤
│ │
│ 1. Bounty (5% of debt): User ────────────────► Liquidator │
│ If user cannot cover: Insurance Fund ─────► Liquidator │
│ │
│ 2. Bad Debt: If user equity still negative after transfers │
│ Insurance Fund covers remaining shortfall │
│ │
└─────────────────────────────────────────────────────────────────────┘Cash Flow Summary
| Step | Direction | Amount | Purpose |
|---|---|---|---|
| 1. Longs | Liquidator → User | longsCost | Pay for long positions (optionBalance) |
| 2. Shorts | User → Liquidator | shortsCost | Transfer short obligations (optionBalance) |
| 3. Bounty | User → Liquidator | 5% × debt | Incentive payment |
| 4. Bounty shortfall | Insurance → Liquidator | remainder | Guarantee bounty |
| 5. Bad debt | Insurance → Protocol | as needed | Cover negative equity |
See DiffusalLiquidationEngine for implementation details.
Debt Calculation
If Debt > 0 and Equity < MM, the user is underwater and liquidation is triggered.
Mark Price Liquidation
Liquidations use the mark price (Black-Scholes theoretical) directly. They do not go through the orderbook or RFQ system.
The liquidator buys positions directly from the liquidated user at a penalized mark price:
| Position Type | Liquidation Price | Effect |
|---|---|---|
| Long (size > 0) | mark × (1 - penalty%) | Liquidator buys at discount |
| Short (size < 0) | mark × (1 + penalty%) | Liquidator buys back at premium |
The liquidator immediately earns the penalty as profit. They can then sell the acquired positions via orderbook or RFQ.
Volatility-Adjusted Penalty
The liquidation penalty scales with implied volatility to properly incentivize liquidators during market stress:
Examples
| IV | Penalty Calculation | Rate |
|---|---|---|
| 50% | 1% + (50-50)/100 | 1.0% |
| 75% | 1% + (75-50)/100 | 1.25% |
| 100% | 1% + (100-50)/100 | 1.5% |
| 150% | 1% + (150-50)/100 | 2.0% |
Penalty Rate Bounds
| Parameter | Value | Description |
|---|---|---|
| Minimum | 1.0% | Base rate (when IV ≤ 50%) |
| At baseline | 1.0% | When IV = 50% |
| Maximum | 100% | Capped to ensure liquidators don't pay more than position value |
Note: The penalty rate is capped at 100% to ensure liquidations remain viable even in extreme IV conditions. In extreme IV environments, liquidators need large discounts to take on risk, but above 100% would mean paying more than the position's value, which would never be profitable.
Why Volatility Adjustment Matters
In high volatility environments:
- Positions move faster - A barely underwater position can become deeply underwater within blocks
- Liquidators take more risk - Prices may move against them before they can hedge
- Higher penalties compensate - Ensures liquidators remain incentivized during stress
Without vol-adjustment, liquidators might delay during market stress (when liquidations are most critical), leading to bad debt accumulation.
Partial vs Full Liquidation
The protocol supports partial liquidation to give users a chance to recover.
Key Insight
Margin requirements use stressed scenarios (±30% spot, +50% IV), but liquidation executes at current mark prices. This means:
- Selling positions at current mark barely reduces equity (just the penalty)
- But it dramatically reduces the margin requirement (which was stress-based)
- So partial liquidation often restores health without destroying the user
The Asymmetry That Enables Partial Liquidation
The margin system uses stressed prices for requirements, but liquidation uses current prices:
| Option | Current Mark | Stressed (Scenario 1) | Difference |
|---|---|---|---|
| ETH Call ($3,200 strike) | $116.25 | $4.73 | -$111.52 |
| ETH Put ($2,800 strike) | $92.00 | $709.69 | +$617.69 |
Why this matters:
- Margin requirement uses $710 put value → requires ~$7,100 collateral per 10 short puts
- Liquidation uses $92 put value → transfer costs only ~$920 per 10 short puts
- This $618 spread per contract is why closing 50% of positions often restores health
The stress scenarios assume extreme market moves that may never happen. When liquidation executes at current prices, the actual cost is much lower than what the margin system reserved for.
Position Selection: Longest-Dated First
The protocol liquidates positions starting with the longest-dated positions first. This ordering:
- Prioritizes positions furthest from expiry (most liquid, easiest for liquidators to hedge)
- Preserves near-expiry positions that may settle soon
- Ensures predictable liquidation behavior
Notional-Based Partial Liquidation
Partial liquidation calculates how much notional value to liquidate based on the debt-to-margin ratio:
The protocol supports partial position liquidation — a single position can be partially liquidated to hit the exact target notional. This is more capital-efficient than rounding up to whole positions.
Liquidation Process
- Trigger: Equity < MM
- Sort: Order all positions by expiry descending (longest-dated first)
- First Attempt: Liquidate positions until target notional is reached, starting from longest-dated. Supports partial liquidation within a single position.
- Re-check: Is user now healthy? (Equity ≥ MM)?
- If yes, stop and user retains remaining positions
- If no, automatically escalate to full liquidation (close remaining positions)
Why Longest-Dated First?
- Liquidity: Longer-dated options typically have better liquidity for liquidators to exit
- Preservation: Near-expiry positions may settle naturally, avoiding forced liquidation costs
- Predictability: Clear ordering removes ambiguity about which positions get closed
After liquidation, the user retains any remaining equity and positions (if partial was sufficient).
Liquidator Incentives
Liquidators are compensated through two mechanisms:
1. Penalty Profit (1-2%+)
Liquidators acquire positions at a discount/premium from mark price:
Long positions: Liquidator pays at mark × (1 - penalty%), immediately gaining the penalty as profit. For example, with mark price $100 and penalty 1.5%, the liquidator pays $98.50 for a position worth $100.
Short positions: User pays liquidator at mark × (1 + penalty%) to take the obligation. The liquidator is compensated for assuming the risk.
2. Bounty (5% of debt)
The bounty is always paid to incentivize liquidators:
- First drawn from user's collateral (after position transfers)
- Any shortfall is covered by the insurance fund
This ensures liquidators are compensated even when liquidating deeply underwater users.
Bounty Scenarios
| Scenario | Debt | Bounty (5%) | User Remaining | Insurance Pays | Liquidator Gets |
|---|---|---|---|---|---|
| Healthy surplus | $5,000 | $250 | $3,000 | $0 | $250 |
| Tight margin | $5,000 | $250 | $200 | $50 | $250 |
| Deep underwater | $10,000 | $500 | $0 | $500 | $500 |
| Extreme deficit | $20,000 | $1,000 | -$5,000 | $1,000 + bad debt | $1,000 |
Key: Liquidators always receive the full bounty. The insurance fund guarantees this regardless of how underwater the user is.
Total Liquidator Profit
This incentivizes keepers to monitor positions and liquidate promptly, especially during high volatility when the penalty (and thus profit) is higher.
Liquidator Requirements
Liquidators must have deposited collateral to participate:
- For long positions: Liquidator needs USDC to pay for the positions
- For short positions: No upfront payment needed (user pays liquidator)
- Liquidator must remain healthy (equity ≥ MM) after acquiring positions
If the liquidator would become unhealthy after acquiring positions, the transaction reverts with LiquidatorUnhealthy().
Liquidator Health Check Example
Scenario: A liquidator with insufficient collateral attempts to acquire positions.
Liquidated user's positions:
- Long 10 ETH Call ($3,200 strike, 90d) — mark $296.23
- Short 5 ETH Put ($2,800 strike, 60d) — mark $165.58
Liquidator state:
| Item | Before | After Acquisition |
|---|---|---|
| Deposit | $10,000 | $10,000 - $2,932.68 (paid for longs) + $836.18 (received for shorts) = $7,903.50 |
| Positions | None | +10 long calls, -5 short puts |
| Option Value | $0 | ($296.23 × 10) + ($165.58 × -5) = $2,134.40 |
| Premium Balance | $0 | $0 (liquidator doesn't inherit user's premium) |
| Equity | $10,000 | $7,903.50 + $2,134.40 + $0 = $10,037.90 |
| New IM | $0 | $9,418.41 |
| New MM | $0 | $7,534.73 |
Health check: $10,037.90 > $7,534.73 → HEALTHY ✓
When liquidation fails: If the liquidator had less initial deposit (e.g., $5,000), they might still become unhealthy after paying for longs and taking on the margin requirements for the short positions.
Solutions for an undercollateralized liquidator:
- Deposit more collateral before attempting liquidation
- Target smaller positions that won't exceed their margin capacity
- Have existing offsetting positions that reduce the combined IM
Post-Liquidation
After acquiring positions, the liquidator can:
| Action | Description |
|---|---|
| Sell via limit orders | Place orders on the orderbook |
| Sell via RFQ | Request quote from Main Market Maker |
| Hold positions | Keep exposure if desired |
| Hedge externally | Offset risk on other venues |
Insurance Fund
The insurance fund provides two types of coverage:
1. Bounty Guarantee
The 5% bounty is always paid to liquidators to ensure incentives remain strong:
- First drawn from user's collateral (after position transfers)
- Insurance fund covers any bounty shortfall
2. Bad Debt Coverage
When the user still has negative equity after all transfers:
The Insurance Fund covers any remaining bad debt.
DiffusalInsuranceFund Contract
The insurance fund is a separate contract (DiffusalInsuranceFund) that:
- Receives all protocol trading fees (set as
feeRecipienton OrderBook and RFQ) - Holds funds in a deposit on the
CollateralVault - Provides
cover()function callable byLiquidationEngineorSettlementEngine
Insurance Fund Sources
| Source | Description |
|---|---|
| Protocol fees | All trading fees routed via feeRecipient |
| Initial seed capital | Bootstrap funding via deposits |
Flow Diagram
At settlement, funds flow from short holders (obligations) to the settlement pool, then to long holders (payouts). If there's a shortfall, the insurance fund provides coverage.
Settlement Waterfall (Order of Operations)
When liquidation completes, cash flows settle in this exact order:
| Step | Action | From | To | Condition |
|---|---|---|---|---|
| 1 | Long position payment | Liquidator | User | Always (for each long) |
| 2 | Short obligation transfer | User | Liquidator | Always (for each short) |
| 3 | Net position settlement | — | — | Aggregate steps 1-2 |
| 4 | Bounty payment | User deposit | Liquidator | Up to available balance |
| 5 | Bounty shortfall | Insurance Fund | Liquidator | If step 4 insufficient |
| 6 | Bad debt coverage | Insurance Fund | Protocol | If user equity negative |
Example (deeply underwater user):
Initial state:
- Debt: $20,000
- Bounty owed: $1,000 (5% of debt)
- User deposit remaining after transfers: $500
Settlement order:
1. Steps 1-3: Position transfers complete (net: user has $500 remaining)
2. Step 4: User pays $500 bounty (all available)
3. Step 5: Insurance covers $500 bounty shortfall
4. Step 6: Insurance covers any remaining bad debt
Result: Liquidator receives full $1,000 bounty (guaranteed)Settlement Readiness Liquidation
There's a subtle risk in options trading: a user can have high portfolio equity from profitable long positions but minimal actual cash (USDC deposits). When their positions expire, they need actual cash to pay settlement obligations, but their "paper profits" from longs aren't liquid.
The Problem (Deferred Settlement Model)
With the fungible options model and deferred settlement, positions can have settlement obligations:
Net Settlement Formula:
Where:
- optionBalance: Signed position size (+ = long, - = short)
- premiumBalance: Signed premium position (+ = receivable, - = payable)
Settlement obligations arise when netSettlement is negative:
- Option Shorts: Pay intrinsic obligation (offset by any Premium Receiver balance they hold)
- Premium Payers: Pay their fixed premium obligation (separate from option position)
Consider this scenario:
| Item | Value |
|---|---|
| Deposited collateral | $2,000 |
| Long-dated calls value | +$50,000 (paper) |
| Short puts expiring tomorrow (Option Short) | -$8,000 (worst-case intrinsic obligation) |
| Premium Payer balance for expiring calls | -$2,000 (fixed premium obligation) |
| Portfolio Equity | $40,000 |
The user looks healthy (equity >> MM), so they can't be liquidated. But at settlement tomorrow:
- Cash needed: $10,000 (short intrinsic + premium payer obligation)
- Cash available: $2,000
- Result: Settlement failure
Solution: Pre-Settlement Liquidation
Settlement Readiness Liquidation is handled by a separate contract (DiffusalSettlementReadinessLiquidator) that liquidates non-expiring LONG option positions to raise cash when positions are approaching settlement and the user lacks sufficient cash. This is a separate liquidation type from margin-based liquidation.
Key difference from regular liquidation:
- Regular liquidation: Restores margin health by transferring both longs AND shorts
- Settlement readiness: Raises cash by selling longs and premium receivables (shorts are obligations, not extractable value)
What can be liquidated:
- Non-expiring LONG option positions (optionBalance > 0) — positive mark value that can be sold for cash
- Premium receivables (positive premiumBalance) — deterministic value, liquidated at a discount
What CANNOT be liquidated:
- Option shorts — they represent obligations, not extractable value
- Premium payables — they are obligations that settle at expiry
Trigger conditions (all must be true):
- User has positions expiring within 1 day with net obligations
- User's deposited collateral (cash) is insufficient to cover worst-case obligations
- User has valuable non-expiring LONG option positions that can be liquidated
- User is not an MMM (Main Market Maker)
How It Works
-
Calculate Cash Shortfall
- Identify expiring positions within
SETTLEMENT_READINESS_WINDOW(1 day) - Calculate worst-case obligations:
- Option shorts: stressed intrinsic × |optionBalance| (if ITM under stress)
- Premium payers: |premiumBalance| (fixed, deterministic)
- Net shortfall = total obligations - deposited cash
- Identify expiring positions within
-
Liquidation Waterfall (in order)
Step 1: Non-Expiring Long Option Positions
- Long option positions (optionBalance > 0) sorted by expiry (longest-dated first)
- Liquidator pays penalized mark price, receives the option position
- Stop when shortfall is covered (or all liquidatable assets exhausted)
Step 2: Premium Receivables (at discount)
- If shortfall remains and user has premium receivables (positive premiumBalance)
- Liquidated at a discount rate (default 5%, max 20%)
- Value realized = premiumReceivable × (1 - discountRate)
- Premium position transfers to liquidator
-
Position Transfer
- User receives cash from liquidator (penalized mark price for options, discounted value for premiums)
- Liquidator acquires the long option position and/or premium receivable
- Premium payables are NOT transferred — they remain with original holder
Worst-Case Obligation Calculation (Net Settlement Model)
The protocol calculates obligations using SPAN stress scenarios with the netSettlement formula:
For Expiring SHORT Positions
Shorts have obligations when stressed intrinsic payout exceeds their premium receivable.
| Option Type | Worst-Case Scenario | Stressed Spot | Why |
|---|---|---|---|
| Short Call | Spot rises +30% | spot × 1.3 | Maximizes intrinsic |
| Short Put | Spot drops -30% | spot × 0.7 | Maximizes intrinsic |
Example (Short 5 puts, premiumBalance = +$600):
Key insight: The premium already received ($600) reduces the obligation from $3,500 to $2,900.
For Positions with Premium Payer Balances
Users with Premium Payer positions (premiumBalance < 0) have obligations equal to the premium they owe. For users who also hold expiring Option Long positions, the intrinsic payout from the long offsets the premium obligation.
Note the opposite stress direction for calculating worst-case - we minimize intrinsic to find the maximum net obligation:
| Option Type | Worst-Case Scenario | Stressed Spot | Why |
|---|---|---|---|
| Long Call | Spot drops -30% | spot × 0.7 | Minimizes intrinsic payout |
| Long Put | Spot rises +30% | spot × 1.3 | Minimizes intrinsic payout |
Example (Long 10 calls + Premium Payer -$1,500):
Key insight: The Premium Payer obligation is bounded and deterministic (fixed at trade time). The Option Long position has no obligation—it only receives intrinsic (or nothing if OTM). The net settlement combines both instruments.
Liquidation Waterfall Diagram
SETTLEMENT READINESS LIQUIDATION WATERFALL
══════════════════════════════════════════
┌─────────────────────────────────────────────────────────┐
│ TRIGGER: Settlement Readiness Check │
├─────────────────────────────────────────────────────────┤
│ 1. Positions expiring within 1 day? │
│ │ │
│ ▼ │
│ 2. User has net settlement obligations? │
│ │ │
│ ▼ │
│ 3. Deposited cash < worst-case obligations? │
│ │ │
│ ▼ │
│ 4. User is NOT an MMM? │
└──────────────────────────┬──────────────────────────────┘
│ All conditions met
▼
┌─────────────────────────────────────────────────────────┐
│ STEP 1: Liquidate Non-Expiring LONG Positions │
├─────────────────────────────────────────────────────────┤
│ • Sort longs by expiry (longest-dated first) │
│ • Liquidator pays: mark × (1 - penalty%) │
│ • User receives cash, loses position │
│ │ │
│ ▼ │
│ Shortfall covered? ───► YES ──────────────────────┐ │
│ │ │ │
│ NO │ │
└───────┴────────────────────────────────────────────┴────┘
│ │
▼ │
┌────────────────────────────────────────────────────┼────┐
│ STEP 2: Liquidate Premium Receivables │ │
├────────────────────────────────────────────────────┼────┤
│ • Find positions with premiumBalance > 0 │ │
│ • Liquidator pays: premium × (1 - discount%) │ │
│ • User receives discounted cash │ │
│ │ │ │
│ ▼ │ │
│ Shortfall covered? ───► YES ──────────────────────┘ │
│ │ │
│ ▼ (or exhausted) │
└───────┴─────────────────────────────────────────────────┘
│ │
└───────────────────┴────────► YES (done)
│
▼
┌─────────────────────────────────────────────────────────┐
│ STEP 3: Pay Bounty │
│ Keeper receives 5% of shortfall (capped) │
└──────────────────────────┬──────────────────────────────┘
▼
┌─────────────────────────────────────────────────────────┐
│ RESULT │
├─────────────────────────────────────────────────────────┤
│ • User now has sufficient cash for settlement │
│ • Expiring positions remain for normal settlement │
└─────────────────────────────────────────────────────────┘Key Constants
| Constant | Value | Description |
|---|---|---|
SETTLEMENT_READINESS_WINDOW | 1 day | Window before expiry to trigger |
SETTLEMENT_READINESS_BUFFER | 5% | Buffer for settlement readiness calculations |
PREMIUM_RECEIVABLE_DISCOUNT_RATE | 5% | Default discount on premium receivables |
MAX_PREMIUM_RECEIVABLE_DISCOUNT_RATE | 20% | Maximum configurable discount rate |
STRESS_SPOT_UP | 1.3 (130%) | Spot up scenario |
STRESS_SPOT_DOWN | 0.7 (70%) | Spot down scenario |
See DiffusalSettlementReadinessLiquidator for the contract API.
Mechanics
| Step | Flow |
|---|---|
| 1. Identify long positions | Sort non-expiring LONG positions by expiry (longest-dated first) |
| 2. Liquidate longs first | Sale price = mark × (1 - penalty%), long option moves to liquidator |
| 3. Check shortfall | If shortfall remains and user has premium receivables, continue |
| 4. Identify premium receivables | Find positions with positive premiumBalance |
| 5. Liquidate premiums | Value = premiumReceivable × (1 - discountRate), premium transfers to liquidator |
| 6. Pay bounty | User → Liquidator (5% of shortfall, capped at proceeds) |
| 7. Stop early | Once shortfall is covered (or all liquidatable assets exhausted) |
Liquidator Incentives
Same as regular liquidation:
1. Penalty Profit
- Liquidator buys at
mark × (1 - penalty%) - Penalty rate uses same volatility adjustment formula
2. Bounty (5% of shortfall)
Worked Example: Sufficient Cash for Settlement
Setup: A user has short positions expiring within 1 day.
Option Position:
| Series | Option Balance | Description |
|---|---|---|
| ETH Put $2,800 | -5 | Short 5 puts (expires tomorrow) |
Premium Position:
| Series | Premium Balance | Description |
|---|---|---|
| ETH Put $2,800 | +$600 | Received $120 each for 5 puts |
Deposited collateral: $4,000 USDC
Calculate Worst-Case Net Settlement:
Under worst-case (spot drops 30%):
Intrinsic value of put at settlement:
Net settlement:
Worst-case obligation:
Key insight: The premium already received ($600) reduces the worst-case obligation from $3,500 to $2,900.
Settlement Readiness Check:
Result: User has sufficient cash for settlement. No liquidation needed.
Worked Example: Settlement Readiness Liquidation
Setup: Same short position as above, but with insufficient cash and an additional long position.
Option Positions:
| Series | Option Balance | Description |
|---|---|---|
| ETH Put $2,800 | -5 | Short 5 puts (expires tomorrow) |
| ETH Call $3,200 | +10 | Long 10 calls (expires in 60 days) |
Premium Positions:
| Series | Premium Balance | Description |
|---|---|---|
| ETH Put $2,800 | +$600 | Received $120 each for 5 puts |
| ETH Call $3,200 | -$1,500 | Paid $150 each for 10 calls |
| Total | -$900 | Net premium payer |
Deposited collateral: $2,000 USDC
Calculate Cash Shortfall:
Worst-case obligation for expiring puts:
Cash shortfall:
Settlement Readiness Liquidation:
The user's portfolio equity is healthy (they have long calls with Option Value of $1,162.50), but deposited cash is insufficient to cover expiring position obligations.
The system liquidates non-expiring LONG positions to raise cash. Only longs can be liquidated because they have positive Option Value:
After liquidation:
- User's long calls: ~2.2 contracts remaining
- User's cash: ~$2,900 (sufficient for settlement)
- Short puts: unchanged (will settle normally with netSettlement formula)
Key insight: Only LONG positions can be liquidated for settlement readiness. Shorts are obligations that cannot be "sold" to raise cash.
Example: Complex Settlement Readiness
Initial State (using netSettlement formula):
Expiring Positions (12 hours to expiry):
- Short 10 puts (Option Short + Premium Receiver): optionBalance=-10, premiumBalance=+$1,000
- Stressed intrinsic: $700, netSettlement = ($700 × -10) + $1,000 = -$6,000
- Net Obligation: $6,000 (intrinsic obligation partially offset by premium receivable)
- Long 15 calls (Option Long + Premium Payer): optionBalance=+15, premiumBalance=-$4,500
- Stressed intrinsic: $100, netSettlement = ($100 × 15) + (-$4,500) = -$3,000
- Net Obligation: $3,000 (premium payer obligation exceeds intrinsic payout)
- Total worst-case obligation: $9,000
- Deposited collateral: $1,000
- Cash shortfall: $9,000 - $1,000 = $8,000
Non-Expiring LONG Position (60 days to expiry):
- Long 200 calls: optionBalance=+200, Option Value = $20,000 (mark × 200)
┌─────────────────────────────────────────────────────────────────────────┐
│ SETTLEMENT READINESS LIQUIDATION │
│ (Non-Expiring Long Example) │
└─────────────────────────────────────────────────────────────────────────┘
Initial State:
User: Cash $1,000 | Obligations $9,000 | Shortfall $8,000
Position: Long 200 calls (60 days to expiry), value $20,000
Step 1: Check Conditions
├─ Expiring positions within 1 day? Yes (12 hours)
└─ Cash < Obligations? $1,000 < $9,000 ✓
Step 2: Liquidate Non-Expiring Longs
Liquidator → Protocol: "Liquidate 200 calls"
Liquidator → Vault: Pay $19,800 (mark × 0.99)
Vault → User: Credit $19,800
User: Cash $20,800 | Shortfall COVERED
Step 3: Pay Bounty
User → Liquidator: $400 (5% of $8,000 shortfall)
Final State:
User: Cash $20,400 | Obligations $9,000 | Ready for settlementLiquidation (1% penalty) — Only the non-expiring LONG is liquidated:
- Liquidator pays: $20,000 × 0.99 = $19,800
- User receives: $19,800 (new cash balance = $20,800)
- Bounty: min($8,000 × 5%, $19,800) = $400
- User's final cash: $20,800 - $400 = $20,400
The user now has $20,400 to cover the $9,000 total obligation at settlement. The expiring positions (both the short puts and long calls) remain with the user for settlement.
Key Differences from Regular Liquidation
| Aspect | Regular Liquidation | Settlement Readiness |
|---|---|---|
| Trigger | Equity < MM | Cash shortfall for expiring obligations |
| What's liquidated | All positions (longs AND shorts) | Non-expiring LONG positions (first) + premium receivables |
| Position handling | Transfer to liquidator | Waterfall: longs at penalty, then premiums at discount |
| Goal | Restore margin health | Raise cash for settlement obligations |
| Expiring positions affected | Yes (transferred) | No (remain for settlement) |
| Can shorts be liquidated? | Yes | No (shorts are obligations, not value) |
| Premium receivables | Transferred with option | Liquidated second at discount rate (5-20%) if shortfall remains |
| Premium payables | Transferred with option | NOT transferred (settle separately) |
Worked Examples
For detailed worked examples of partial and full liquidation with step-by-step calculations, see:
- Margin System: Example B - Partial Liquidation (Succeeds) — Shows how partial liquidation closes just enough positions to restore health
- Margin System: Example C - Full Liquidation (Partial Fails) — Shows escalation from partial to full liquidation when health cannot be restored
- Margin System: Example D - Unliquidatable Long Position — Shows how sufficient collateral guarantees a long-only portfolio cannot be liquidated
The settlement readiness liquidation examples are unique to this page and shown in the Settlement Readiness Liquidation section above.
Key takeaways from the margin system examples:
- Notional-based partial liquidation closes only the target notional needed
- Partial position liquidation is supported — fractional contracts can be liquidated
- Longest-dated first ordering is deterministic and predictable
- If partial fails, the system escalates to full liquidation automatically
- Users retain remaining collateral after positions are transferred
Risk Parameters
| Parameter | Default | Description |
|---|---|---|
LIQUIDATION_PENALTY_BASE | 1% | Base price penalty |
LIQUIDATION_PENALTY_IV_BASELINE | 50% | IV threshold for penalty scaling |
LIQUIDATOR_BOUNTY_RATE | 5% | % of debt paid to liquidator |
Note: Partial liquidation uses proportional position closure (debt/IM fraction) rather than a fixed percentage.
Main Market Maker Exception
The Main Market Maker (MMM) is a privileged, non-liquidatable entity. The liquidation function rejects any attempt to liquidate the MMM address by first checking if the user is an MMM (returning false if so) before checking equity vs maintenance margin.
Why MMM Is Exempt
The MMM's solvency is managed operationally, not by protocol rules:
| Concern | Mitigation |
|---|---|
| MMM goes underwater | MMM operator monitors and rebalances externally |
| MMM accumulates too much risk | MMM offloads shorts via limit orders or OTC |
| MMM runs out of capital | MMM operator injects capital before insolvency |
| MMM becomes malicious | Governance can replace MMM address |
This is a deliberate trust tradeoff: by trusting one well-managed entity, the protocol guarantees that RFQ always functions—so liquidators can always offload acquired positions to the MMM after executing liquidations.
Smart Contract API
The DiffusalLiquidationEngine contract implements the liquidation mechanics. Liquidation is permissioned — only approved liquidators can execute liquidation functions. This ensures trusted entities (e.g., keeper bots, protocol operators) manage liquidations while maintaining protocol solvency.
Liquidation Functions (DiffusalLiquidationEngine)
liquidatePortfolio(user, portfolioId, liquidatorPortfolioId)— Liquidates an undercollateralized user's portfolio. Requires caller to be an approved liquidator. TheliquidatorPortfolioIdspecifies which portfolio receives the acquired positions. Tries partial liquidation first (proportional fraction based ondebt/IM), then escalates to full liquidation if partial doesn't restore health. Returns a LiquidationResult containing: user, liquidator, portfolioId, debt, longsCost, shortsCost, bounty, insuranceUsed, newUserEquity, newLiquidatorEquity, positionsLiquidated, isPartial.isApprovedLiquidator(address)— Returns true if the address is approved to execute liquidations.setApprovedLiquidator(address, bool)— (Owner only) Approves or revokes an address for liquidation execution.
Settlement Readiness Functions (DiffusalSettlementReadinessLiquidator)
Settlement readiness liquidation is handled by a separate contract (DiffusalSettlementReadinessLiquidator), which also requires approved liquidators:
getSettlementReadinessInfo(user)— Returns: isLiquidatable, cashRequired, cashAvailable, cashShortfall, totalPremiumReceivable, premiumReceivableValueAfterDiscount, positionValueAvailable, expiringShortsCount, expiringLongsCount, liquidatablePositionsCountisSettlementReadinessLiquidatable(user)— Returns true if user meets settlement readiness liquidation conditions (expiring positions with obligations and insufficient cash)liquidateForSettlementReadiness(user)— Liquidates using waterfall: non-expiring LONG option positions first, then premium receivables (at discount). Requires caller to be an approved liquidator. Returns: user, liquidator, cashShortfall, cashRaised, premiumLiquidated, premiumProceeds, liquidatorCost, bounty, positionsLiquidated, newCashAvailableisApprovedLiquidator(address)— Returns true if the address is approved to execute settlement readiness liquidations.setApprovedLiquidator(address, bool)— (Owner only) Approves or revokes an address for settlement readiness liquidation execution.getSettlementReadinessBuffer()— Returns the settlement readiness buffer (default 5%, WAD format)getPremiumReceivableDiscountRate()— Returns the discount rate applied to premium receivables (default 5%, WAD format)getLiquidatorBountyRate()— Returns the liquidator bounty rate (default 5%, WAD format)calculatePenaltyRate(pairId)— Returns penalty rate in WAD based on IV
View Functions (DiffusalLiquidationEngine)
getLiquidationInfo(user)— Returns comprehensive info: isLiquidatable, portfolioId, debt (USDC 6 decimals), estimatedLongsCost, estimatedShortsCost, estimatedBounty, positionCountcalculatePortfolioDebt(user, portfolioId)— Returns debt = max(0, Initial Margin - Equity) for the specified portfoliocalculatePenaltyRate(pairId)— Returns penalty rate in WAD (e.g., 0.015e18 = 1.5%). Penalty = Base (1%) + (IV - 50%) / 100getInsuranceFundBalance()— Returns current insurance fund balance
External Insurance Fund
The insurance fund is a separate contract (DiffusalInsuranceFund) with these functions:
getBalance()— Current fund balance (USDC, 6 decimals)collateralVault()— CollateralVault referenceliquidationEngine()— LiquidationEngine referencecover(shortfallAmount)— Draw funds for shortfalls (callable by LiquidationEngine or SettlementEngine)withdraw(amount)— Withdraw excess funds (owner only)
The insurance fund receives all protocol trading fees by being set as feeRecipient on OrderBook and RFQ contracts.
Deployment Integration
The liquidation engine must be registered as an operator on DiffusalOptionsPositionManager (for updatePosition()) and DiffusalCollateralVault (for creditCollateral() and debitCollateral()). Additionally, the insurance fund must be connected to the liquidation engine, and fees should be routed to the insurance fund.
Contract Implementation
| Contract | Role |
|---|---|
| DiffusalLiquidationEngine | Core margin-based liquidation logic |
| DiffusalSettlementReadinessLiquidator | Settlement readiness liquidation |
| DiffusalInsuranceFund | Shortfall coverage |
| DiffusalCollateralVault | Collateral settlement |
Related
Protocol Documentation
- Margin System — How IM and MM are calculated, liquidation triggers
- Margin Calculations — Stress testing formulas, SPAN methodology
- Options Settlement — What happens at expiry (why cash is needed for settlement readiness)
Contract Documentation
- DiffusalLiquidationEngine — Core margin-based liquidation logic, position transfer implementation
- DiffusalSettlementReadinessLiquidator — Settlement readiness liquidation (waterfall: longs → premiums)
- DiffusalInsuranceFund — Shortfall coverage, bounty guarantee mechanism
- DiffusalCollateralVault —
transferCollateral()used for cash flows - DiffusalOptionsPositionManager — Position updates during liquidation
- DiffusalSettlementEngine — Settlement execution (context for settlement readiness)