Liquidation
Liquidation is a critical mechanism in the Flux protocol that protects liquidity providers' capital by ensuring managers maintain healthy collateral positions. Flux uses a simplified liquidation system with configurable profit margins.
Overview
Liquidation in Flux serves two purposes:
Protect LPs: Ensure borrowed capital is adequately collateralized
Maintain Solvency: Prevent vault insolvency through timely position closure
Flux offers a single, unified liquidation approach with configurable profit margins instead of complex bonding curves or Dutch auctions.
Understanding Position Health
Health Ratio
The Health Ratio is the key metric determining if a position can be liquidated:
Health Ratio = Total Position Value / True DebtWhere:
Total Position Value = Bond + Working Capital + All Wrapper Positions (USD)
True Debt = Principal Debt + Accrued Interest
Liquidation Threshold
Positions become liquidatable when:
The liquidation threshold is derived from strategy parameters:
Example Calculation
Manager Position:
Bond: 20K USDC
Working Capital: 5K USDC
WETH Position: 25K USDC (via oracle)
Total Position Value: 50K USDC
Principal Debt: 90K USDC
Accrued Interest: 10K USDC
True Debt: 100K USDC
Health Calculation:
When Is a Position Liquidatable?
A position becomes liquidatable when the strategy's evaluateLiquidation() function returns canLiquidate = true.
The strategy can use any logic to make this determination. Common triggers include:
Health ratio drops below threshold (standard implementation)
Liquidity depth insufficient for safe unwinding
High market volatility requiring higher collateralization
Off-chain risk indicators signaling position risk
Time-based conditions (e.g., circuit breakers during market stress)
With the standard ImmutableFixedRateStrategy, positions become liquidatable when the health ratio drops below the threshold due to:
Collateral value decreasing (price drops)
Debt increasing (interest accrual)
Manager withdrew too much collateral
Manager took on more debt
Liquidation Bonus Model
Unlike complex liquidation systems with Dutch auctions or bonding curves, Flux uses a simplified profit margin model.
Healthy Liquidations (Collateral ≥ Debt)
When position is liquidatable but still has enough collateral:
Example:
Total Collateral: 105K USDC
True Debt: 100K USDC
Health Ratio: 1.05 (105%) → Liquidatable (below 110% threshold)
Liquidation:
Liquidator pays: 100K USDC (full debt)
Liquidator receives: 105K USDC (all collateral)
Liquidator profit: 5K USDC (5%)
Manager receives: 0 (position fully closed)
Underwater Liquidations (Collateral < Debt)
When position has insufficient collateral to cover debt:
Example (1% profit margin):
Total Collateral: 45K USDC
True Debt: 50K USDC
Health Ratio: 0.9 (90%) → Liquidatable
Liquidation Profit Margin: 0.01e18 (1%)
Liquidation:
Liquidator pays:
45K × (1 - 0.01) = 44.55K USDCLiquidator receives: 45K USDC (all collateral)
Liquidator profit:
45K - 44.55K = 450 USDC(1%)Vault bad debt:
50K - 44.55K = 5.45K USDC
Configurable Profit Margins
Strategies can set liquidationProfitMargin from 0% to 20%:
0% (altruistic)
100% of collateral
Public goods vaults, break-even liquidations
1% (default)
99% of collateral
Standard vaults, 1% incentive
5%
95% of collateral
Higher incentive for fast liquidations
10%
90% of collateral
Aggressive incentives
20% (maximum)
80% of collateral
Maximum incentive, higher bad debt risk
Why Configurable?
Public goods vaults: Can set 0% for altruistic liquidators
Competitive markets: Higher margins incentivize faster liquidations
Risk management: Lower margins minimize LP losses from bad debt
How Liquidations Work
Liquidation Flow
Code Example
Capital-Free Liquidations
Flux's unique locked_borrow() function enables capital-free liquidations:
Traditional Liquidation (Capital Required)
Problem: Requires upfront capital or flash loan.
Flux Capital-Free Liquidation
Benefit: No upfront capital or external flash loan needed!
Example Implementation
Step-by-Step Liquidation Example
Initial Position
Manager borrowed: 100K USDC
Manager bond: 20K USDC (20%)
WETH position: 30K USDC value
Total Position Value: 50K USDC
True Debt (with interest): 100K USDC
Health Ratio: 50K / 100K = 0.5 (50%) ✗ Liquidatable!
Liquidation Process
Step 1: Liquidator Identifies Position
Calculation:
Collateral Value: 50K USDC
Liquidation Profit Margin: 1%
Min Payment:
50K × (1 - 0.01) = 49.5K USDC
Step 2: Liquidator Calls liquidate()
Step 3: Inside Callback
Step 4: After Liquidation
Manager:
Position completely closed
Lost 50K USDC in collateral
Debt cleared (was 100K USDC)
Net loss: 50K USDC
Liquidator:
Borrowed 49.5K USDC
Seized 50K USDC collateral
Swapped to ~49.8K USDC
Repaid 49.5K USDC
Profit: ~300 USDC (after gas fees)
Vault/LPs:
Received 49.5K USDC from liquidator
Manager debt was 100K USDC
Bad debt: 100K - 49.5K = 50.5K USDC
Bad debt socialized across all LPs
Liquidator Tools & Strategies
1. Monitor Unhealthy Positions
2. Profit Calculation
Before liquidating, calculate expected profit:
3. Gas Optimization
4. Flash Loan Alternative
Instead of locked_borrow(), use external flash loans:
Bad Debt Handling
What Is Bad Debt?
Bad debt occurs when liquidation payment < manager's true debt:
Example:
True Debt: 100K USDC
Collateral Value: 45K USDC
Liquidation Payment: 44.55K USDC (1% margin)
Bad Debt: 100K - 44.55K = 55.45K USDC
Bad Debt Socialization
Bad debt is socialized across all LPs:
Impact on LPs:
Share value decreases proportionally
All LPs bear the loss equally
No individual LP loses everything
Example:
Vault has 1M USDC in assets, 1M shares (1:1 ratio)
Bad debt: 50K USDC
New share price: (1M - 50K) / 1M = 0.95 USDC per share
Each LP lost 5% of value
Minimizing Bad Debt
Strategy Parameters:
Higher liquidation buffer: More cushion before liquidation
Lower profit margin: Less LP loss per liquidation
Conservative bond ratio: More collateral per borrowed amount
Oracle Quality:
Use reliable oracles (Chainlink > Uniswap TWAP)
Monitor for manipulation
Fast liquidation response times
Liquidator Incentives:
Higher profit margins attract more liquidators
Faster liquidations → less bad debt
Auto-Deleveraging (ADL)
In addition to standard liquidation, Flux supports Auto-Deleveraging for high-utilization scenarios.
When ADL Triggers
ADL can occur when:
Example Parameters:
ADL Utilization Threshold: 95%
ADL Threshold: 120% (higher than liquidation threshold)
ADL vs Liquidation
Trigger
Health < 110%
Health < 120% AND utilization > 95%
Purpose
Prevent insolvency
Free up vault liquidity
Urgency
High
Medium
Manager Impact
Position closed
Position partially closed
ADL Example
Vault State:
Total Assets: 1M USDC
Total Debt: 960K USDC
Utilization: 96% (above 95% threshold)
Manager Position:
Total Value: 55K USDC
True Debt: 50K USDC
Health Ratio: 1.1 (110%)
Normal liquidation: ✓ Healthy
ADL: ✗ Can be ADL'd (below 120% threshold)
ADL Process:
ADL'er calls
adl(manager)Vault forces partial position closure
Vault utilization reduces
Manager health improves (lower debt)
Liquidation Best Practices
For Liquidators
Monitor continuously: Run bots to detect liquidatable positions
Calculate profit: Ensure profit exceeds gas costs
Use capital-free: Leverage
locked_borrow()for efficiencyOptimize gas: Batch liquidations when possible
Handle failures: Gracefully handle reverts
Account for slippage: Estimate swap outputs conservatively
For Managers
Maintain buffer: Keep health ratio well above liquidation threshold
Monitor positions: Track health ratio constantly
Add collateral proactively: Don't wait until near liquidation
Understand oracles: Know how your positions are priced
Have alerts: Set up notifications for health ratio drops
Plan exits: Know how to quickly close positions if needed
For LPs
Understand risk: Bad debt can reduce share value
Vet strategies: Choose vaults with conservative parameters
Monitor utilization: High utilization = higher risk
Diversify: Don't put all capital in one vault
Emergency exit: Use emergency withdrawal if needed
For Vault Creators
Conservative thresholds: Higher liquidation buffers reduce bad debt
Quality oracles: Use reliable price feeds
Balanced margins: Balance liquidator incentives vs LP losses
Test thoroughly: Simulate liquidations before launch
Monitor health: Track overall vault health and liquidation rates
Comparison with Other Protocols
Bonus Model
Configurable margin (0-20%)
Fixed LIF based on LLTV
Fixed bonus (varies by asset)
Capital Required
✗ None (locked_borrow)
✓ Yes or flash loan
✓ Yes or flash loan
Partial Liquidation
✓ Yes
✓ Yes
✓ Yes (50% max)
Bad Debt
Socialized across LPs
Per-market isolation
Pool-wide socialization
Threshold
Derived from strategy
Per-market LLTV
Per-asset LTV
Altruistic Option
✓ Yes (0% margin)
✗ No
✗ No
Advanced Topics
Custom Liquidation Strategies
Liquidators can implement complex strategies:
Liquidation Monitoring
Build monitoring systems:
Last updated