Hashtag Web3 Logo

Liquidation

The automatic sale of collateral when a borrower's position falls below required thresholds in DeFi lending protocols, protecting lenders from default risk.

Liquidation

Liquidation refers to the automatic process by which DeFi lending protocols sell a borrower's collateral to repay outstanding debt when the collateral's value drops below a required threshold, typically expressed as a loan-to-value ratio. This mechanism serves as the primary safeguard protecting lenders from default risk and maintaining protocol solvency during periods of extreme market volatility. Aave implements a liquidation system where third-party liquidators can repay a portion of a borrower's debt in exchange for receiving the equivalent collateral value plus a liquidation bonus, incentivizing rapid position clearing. Understanding liquidation mechanics is essential for risk management roles, smart contract auditors, and protocol developers, making it a frequently tested competency in Web3 technical interviews.

How Liquidation Works

DeFi lending protocols like Aave, Compound, and MakerDAO allow users to deposit assets as collateral and borrow against them. Liquidation kicks in when specific conditions are met:

  • Loan-to-Value (LTV) Ratio: Protocols specify a maximum LTV. For example, if you deposit $10,000 in ETH, you might borrow up to $7,000 (70% LTV). This buffer protects against price volatility.

  • Liquidation Threshold: A higher percentage than the maximum LTV where liquidation begins. Using the example above, liquidation might trigger at 80% LTV, meaning if your $10,000 collateral drops to $8,750 while you owe $7,000, liquidation starts.

  • Health Factor: Many protocols calculate a "health factor" that represents your position's safety. A health factor below 1.0 typically triggers liquidation. The formula generally looks like: (Collateral Value × Liquidation Threshold) / Borrowed Amount.

  • Liquidation Penalty: When liquidated, borrowers pay a penalty as an incentive for liquidators to perform this service quickly. This penalty comes from your collateral.

The Liquidation Process

When a position becomes undercollateralized, liquidation happens through these steps:

  • 1. Price Updates: Oracles continuously feed price data to smart contracts. When collateral value drops or debt value rises enough to breach thresholds, liquidation becomes possible.

  • 2. Liquidator Identification: Liquidation is typically permissionless. Anyone can act as a liquidator. Specialized bots monitor protocols 24/7 looking for liquidation opportunities.

  • 3. Debt Repayment: The liquidator repays some or all of the borrower's debt to the protocol.

  • 4. Collateral Transfer: In exchange, the liquidator receives the borrower's collateral plus a liquidation bonus, creating profit incentive.

  • 5. Position Closure: If debt is fully repaid, the position closes. If only partially liquidated, what remains must still maintain adequate collateralization.

This entire process executes automatically via smart contracts, typically completing in a single transaction within seconds of becoming eligible.

Why Liquidation Exists

Liquidation serves critical functions in DeFi:

  • Lender Protection: Without liquidation, lenders would face unbounded risk. If borrowers defaulted and collateral became worthless, lenders would lose their deposits. Liquidation ensures lenders can recover funds.

  • Protocol Solvency: Protocols must maintain sufficient collateral to back all outstanding debt. Liquidation prevents insolvency by forcing position closure before collateral becomes insufficient.

  • Market Efficiency: By creating profit opportunities for liquidators, protocols incentivize fast price discovery and position management without relying on centralized administrators.

  • Risk-Based Pricing: Liquidation thresholds help protocols price risk. Volatile assets have lower LTV ratios, reflecting their higher liquidation probability.

Risks for Borrowers

Liquidation carries significant costs and risks:

  • Financial Loss: Liquidation penalties plus gas fees mean borrowers lose substantial value. On a $10,000 position, a 10% penalty costs $1,000.

  • Cascading Effects: During market crashes, liquidations can trigger more liquidations. Forced selling depresses prices further, causing more positions to become undercollateralized.

  • Gas Competition: During high volatility, liquidators compete to be first, driving gas prices to extreme levels. Borrowers trying to add collateral or repay debt may find transactions too expensive or unable to confirm in time.

  • Flash Crashes: Temporary price movements can trigger liquidation even if prices quickly recover, permanently locking in losses.

  • Oracle Manipulation: If oracles report incorrect prices, legitimate positions might be liquidated unfairly.

Liquidation Strategies

Sophisticated participants employ various strategies:

  • For Borrowers:

    • Conservative LTVs: Borrowing well below maximum LTV provides a buffer against volatility.
    • Health Monitoring: Using services that alert when health factors approach danger zones.
    • Collateral Management: Adding collateral or repaying debt before liquidation triggers.
    • Stable Assets: Using stablecoins or less volatile assets as collateral reduces liquidation risk.
  • For Liquidators:

    • Bot Development: Creating automated systems that monitor thousands of positions across protocols.
    • Flash Loan Integration: Borrowing capital via flash loans to liquidate positions without upfront capital.
    • Gas Optimization: Writing efficient contracts that minimize transaction costs and maximize profit.
    • Multi-Protocol Monitoring: Tracking liquidation opportunities across Aave, Compound, MakerDAO, and others simultaneously.

Historical Liquidation Events

Major liquidation events have shaped DeFi:

  • March 2020 "Black Thursday": Bitcoin dropped significantly in days, triggering massive liquidations across DeFi. MakerDAO saw millions in under-collateralized loans as liquidators couldn't process positions fast enough due to network congestion. This led to protocol improvements including zero-bid protections.

  • May 2021 Crash: Significant liquidations occurred across DeFi and centralized platforms as crypto markets crashed. Aave processed over $1 billion in liquidations.

  • Luna/UST Collapse (2022): As UST de-pegged and Luna crashed, billions in collateral evaporated, causing liquidation cascades. Some users lost substantial amounts as protocols struggled to process liquidations during rare volatility.

These events highlighted both the importance and limitations of liquidation mechanisms.

Protocol-Specific Approaches

Different protocols handle liquidation differently:

  • Aave: Uses a health factor system. Partial liquidations are possible; liquidators can repay a portion of debt. Includes a liquidation call feature allowing users to delegate liquidation permissions.

  • Compound: Liquidates a portion of debt when positions become undercollateralized. Uses a discount mechanism where liquidators purchase collateral at below-market rates.

  • MakerDAO: Uses a Keeper system with collateral auctions. When positions (Vaults) become unsafe, auctions sell collateral in tranches, with sophisticated mechanisms to maximize recovery value.

  • Liquity: Fixed 110% collateralization ratio with redistribution mechanism. Liquidated collateral is redistributed to other borrowers rather than sold to liquidators, eliminating liquidation penalties but creating different risk dynamics.

Work through DeFi Lending

Understanding liquidation is important for anyone using DeFi lending, whether borrowing, lending, or building protocols. If you're interested in DeFi risk management, quantitative analysis, or protocol design, explore DeFi career opportunities at leading protocols. These positions place you at the intersection of finance, theory, and smart contract engineering.