Liquidation Process

Overview of how liquidations are handled

Blendy implements a Dutch auction liquidation mechanism that ensures fair price discovery while maintaining protocol solvency. The system processes liquidations through a two-phase approach: liquidation triggering and auction execution.

Core Liquidation Mathematics

Position Liquidation Threshold

A CDP position becomes eligible for liquidation when its collateral-to-debt ratio falls below the liquidation threshold:

$\text{LiquidationRatio} = \frac{\text{CollateralValue} \times \text{OraclePrice}}{\text{TotalDebt}} < \frac{\text{LiquidationThreshold}}{100}$

Liquidation Amount Calculation

The protocol calculates liquidation amounts using proportional scaling:

LiquidationDebt={TotalDebt×SingleLiquidationRatio100if TotalDebt>LiquidationBoundarymin(TotalDebt,SingleLiquidationLimit)otherwise\text{LiquidationDebt} = \begin{cases} \text{TotalDebt} \times \frac{\text{SingleLiquidationRatio}}{100} & \text{if TotalDebt} > \text{LiquidationBoundary} \\ \min(\text{TotalDebt}, \text{SingleLiquidationLimit}) & \text{otherwise} \end{cases}
LiquidationCollateral=min(TotalCollateral,TotalCollateral×LiquidationDebtTotalDebt)\text{LiquidationCollateral} = \min(\text{TotalCollateral}, \text{TotalCollateral} \times \frac{\text{LiquidationDebt}}{\text{TotalDebt}})

Dutch Auction Price Mechanics

The auction price follows a linear decay function:

P(t)=Pstart(PstartPend)×tTP(t) = P_{\text{start}} - \frac{(P_{\text{start}} - P_{\text{end}}) \times t}{T}

where:

Pstart=LiquidationPrice×AuctionDiscount100P_{\text{start}} = \text{LiquidationPrice} \times \frac{\text{AuctionDiscount}}{100}
Pend=LiquidationDebt×(1+Penalty100)×ScalingFactorLiquidationCollateralP_{\text{end}} = \frac{\text{LiquidationDebt} \times (1 + \frac{\text{Penalty}}{100}) \times \text{ScalingFactor}}{\text{LiquidationCollateral}}
  • T = Auction duration

  • t = Time elapsed since auction start

Implementation Details

Auction Initialization

The protocol initializes the Dutch auction with strict parameter validation:

Price Updates

The auction price updates in discrete steps to optimize gas efficiency:

auction_step_price = (start_price - end_price) / auction_step
current_price = start_price - (step_count × auction_step_price)

Example Scenario

Consider a position with:

Collateral: 1,000,000 BONK
Borrowed: 100 USDC
Initial BONK price: $0.00015 USDC
Liquidation threshold: 150%
Single liquidation ratio: 50%
Auction discount: 90%
Liquidation penalty: 10%

When BONK price drops to $0.00011, the position's collateral ratio becomes:

\text{CollateralRatio} = \frac{1,000,000 \times $0.00011}{100} = 110%

Since 110% < 150% (liquidation threshold), the position becomes eligible for liquidation.

Liquidation Debt:

Since total_debt (100 USDC) > liquidation_boundary, liquidation debt = 100 × 50% = 50 USDC Liquidation Collateral is also proportional to debt: 1,000,000 × (50/100) = 500,000 BONK

Penalty: 50 USDC × 10% = 5 USDC

Total Debt with Penalty: 50 USDC + 5 USDC = 55 USDC

Dutch Auction Prices

  • Liquidation Price:

  • $0.00011 per BONK

  • Start Price (90% of liquidation price):

  • $0.00011 × 90% = $0.000099 per BONK

3. End Price (minimum price to cover debt + penalty):

55 USDC500,000 BONK=$0.00011perBONK\frac{55 \text{ USDC}}{500,000 \text{ BONK}} = \$0.00011 per BONK

The auction will start at $0.000099 per BONK and decrease linearly to $0.00011 per BONK over the auction duration.

Liquidator Incentive

A liquidator buying at start price would pay:

  • For 500,000 BONK at $0.000099 = 49.5 USDC

  • Potential profit: 55 USDC (debt+penalty) - 49.5 USDC = 5.5 USDC

This creates an arbitrage opportunity while ensuring the protocol recovers the debt plus penalty.

Security Considerations

Numerical Precision

All price and amount calculations use fixed-point arithmetic with appropriate scaling factors to prevent precision loss. Critical calculations include various over/underflow checks.

Oracle Safety

The protocol enforces maximum price age and requires valid price feeds before liquidation. This implementation ensures deterministic execution while maintaining economic security through carefully structured incentives and precise mathematical calculations.

Last updated