Understanding the foundational principles and requirements that govern the liquidation process in DeFi lending protocols, ensuring system solvency and user risk management.
The Mechanics of Liquidation in Over-Collateralized Systems
Core Concepts and Prerequisites
Collateralization Ratio
The Collateralization Ratio is the key metric determining a loan's safety, calculated as (Collateral Value / Debt Value) * 100%. It measures how over-collateralized a position is.
- A 150% ratio means $150 of crypto collateral backs $100 of debt.
- Protocols set a Minimum Collateralization Ratio (e.g., 110% for MakerDAO's ETH-A vault) as a liquidation threshold.
- Users must monitor this ratio; if the collateral's value falls, they risk liquidation unless they add more collateral or repay debt.
Liquidation Threshold & Health Factor
The Liquidation Threshold is the specific collateral value percentage at which a position becomes eligible for liquidation. Closely related is the Health Factor, a numerical representation of a position's safety.
- A Health Factor below 1.0 triggers liquidation (e.g., Aave, Compound).
- It is calculated as (Collateral Value * Liquidation Threshold) / Total Borrowed.
- This mechanism automatically protects the protocol from under-collateralized debt, ensuring lenders are always repaid.
Liquidation Process & Incentives
The Liquidation Process is the automated sale of a user's collateral to repay their debt when their position becomes under-collateralized. Liquidation Incentives (bonuses) are critical for motivating liquidators.
- A liquidator repays part of the debt and receives collateral at a discounted price (e.g., 5-10% bonus).
- This creates a competitive market for liquidations, ensuring swift resolution.
- The process happens via smart contracts, often within a single transaction, minimizing systemic risk.
Price Oracles
Price Oracles are trusted, decentralized data feeds that provide real-time asset prices to smart contracts. They are a critical prerequisite for determining accurate collateral values.
- Protocols like Chainlink aggregate data from multiple exchanges to prevent manipulation.
- An oracle reporting an inaccurate, lower price can trigger unnecessary liquidations.
- The reliability and security of the oracle are paramount for the entire system's stability and fairness.
Debt Positions & Vaults
A Collateralized Debt Position (CDP) or Vault is the user-created smart contract that locks collateral and mints debt (like DAI). It is the atomic unit managed in these systems.
- Users deposit assets (e.g., ETH) into a vault to borrow stablecoins against it.
- Each position has its own unique collateralization ratio and health factor.
- This structure allows for non-custodial, permissionless borrowing while isolating risk to individual positions.
Stablecoins & Debt Assets
Stablecoins (e.g., DAI, USDC) are the primary debt assets issued in over-collateralized systems. Their stability is essential for the lending/borrowing mechanism.
- Borrowers typically mint or borrow stablecoins to gain liquidity without selling their appreciating collateral.
- The protocol's stability depends on the debt asset maintaining its peg (e.g., $1 for DAI).
- This allows for predictable debt valuation, which is crucial for calculating accurate health factors.
The Liquidation Lifecycle: From Trigger to Resolution
A detailed walkthrough of the automated process for liquidating under-collateralized positions in DeFi protocols like MakerDAO or Aave.
Step 1: Health Factor Breach & Liquidation Trigger
The system detects a position has fallen below the safe collateralization threshold.
Detailed Instructions
A position becomes eligible for liquidation when its Health Factor (HF) drops below 1.0. This factor is calculated as (Collateral Value * Liquidation Threshold) / Borrowed Value. For example, if ETH is collateral with an 80% threshold and the user borrows DAI, the formula is monitored constantly by keeper bots.
- Sub-step 1: Monitor On-Chain State: Keepers track the real-time price of collateral assets via oracles like Chainlink (e.g., price feed at
0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419for ETH/USD). - Sub-step 2: Calculate Health Factor: The keeper runs a calculation. If a user has 10 ETH collateral ($20,000 at $2,000/ETH) and a 75% liquidation threshold, the adjusted collateral is $15,000. If their debt is $16,000 DAI, HF = 15000/16000 = 0.9375 (<1.0).
- Sub-step 3: Trigger Liquidation Call: The keeper calls the protocol's liquidation function, such as
Aave V3's liquidationCall().
Tip: Keepers compete to be the first to call the function, as they earn a liquidation bonus. The exact HF trigger can be protocol-specific (e.g., some set a buffer at 1.05).
Step 2: Seizing Collateral & Repaying Debt
The liquidator repays part of the user's debt in exchange for discounted collateral.
Detailed Instructions
Upon a successful liquidation call, the protocol executes an atomic swap: the liquidator repays the borrower's outstanding debt, and in return, receives a liquidation bonus on the seized collateral. The exact amount is governed by parameters like the liquidation close factor (what portion of debt can be liquidated) and liquidation penalty (the bonus).
- Sub-step 1: Determine Liquidatable Amount: Using a close factor of 50%, if the debt is 10,000 DAI, a maximum of 5,000 DAI can be repaid in one transaction.
- Sub-step 2: Calculate Collateral Seizure: With a 10% liquidation penalty, to repay 5,000 DAI of debt, the liquidator receives collateral worth 5,000 * (1 + 0.10) = 5,500 DAI. If ETH is $2,000, that's 2.75 ETH.
- Sub-step 3: Execute the Swap: The transaction is bundled. For example, on Compound, a call might look like:
codecompoundLiquidator.liquidateBorrow(borrowerAddress, repayAmount, cTokenCollateralAddress);
Tip: Liquidators often use flash loans to fund the debt repayment, allowing them to execute without upfront capital. The seized collateral is immediately transferred to their address.
Step 3: Auction or Direct Sale (If Applicable)
In some systems, seized collateral is sold via an auction mechanism to ensure fair market pricing.
Detailed Instructions
Protocols like MakerDAO use a collateral auction (Flip, Clip, or Flash auctions) to sell the seized collateral (e.g., ETH) for the stablecoin debt (DAI). This process helps avoid market manipulation and ensures the protocol is made whole. The auction has a minimum bid (lot size) and a duration.
- Sub-step 1: Initiate Auction: The protocol's smart contract, such as the
Clipcontract for ETH-A vaults (0xC9332fdCB1C491Dcc683bAe86Fe3cb70360738BC), creates an auction with an initial lot of 10 ETH and a starting bid of, say, 18,000 DAI. - Sub-step 2: Bidding Phase: Participants bid increasing amounts of DAI for the decreasing lot of ETH over a set period (e.g., 6 hours). The auction uses a Dutch auction model where the price decreases until a bid is placed.
- Sub-step 3: Settle Auction: The highest bidder wins, sending DAI to the protocol's surplus buffer and receiving the ETH. Remaining collateral, if any, is returned to the original borrower.
Tip: Keepers use sophisticated bots to bid optimally. Failed auctions may be restarted with adjusted parameters to ensure the debt is covered.
Step 4: Surplus Distribution & Position Resolution
Final accounting where excess proceeds are handled and the borrower's position is updated.
Detailed Instructions
After the debt is repaid and collateral is sold, the protocol performs final settlements. If the auction or sale generates more than the owed debt (including fees), the surplus is managed. Conversely, if there's a shortfall, it may be covered by a system surplus buffer or trigger debt auctions.
- Sub-step 1: Calculate Net Result: Assume 2.75 ETH was sold for 5,600 DAI, repaying 5,000 DAI debt plus a 0.5% protocol fee (25 DAI). The surplus is 575 DAI.
- Sub-step 2: Distribute Surplus: The surplus DAI is often sent to a protocol treasury or a buffer (e.g., Maker's
Vowcontract at0xA950524441892A31ebddF91d3cEEFa04Bf454466). In some cases, a portion may be returned to the borrower. - Sub-step 3: Update Borrower's Position: The borrower's debt is reduced by the repaid amount (5,000 DAI), and their collateral is reduced by the seized amount (2.75 ETH). Their Health Factor is recalculated. If HF is still below 1.0, the position remains eligible for further liquidation.
Tip: Borrowers should monitor their positions post-liquidation, as partial liquidations can improve the HF but also reduce their collateral buffer, making them vulnerable to further price drops.
Liquidation Engine Comparison: MakerDAO vs. Aave vs. Compound
Comparison of the mechanics of liquidation in over-collateralized lending protocols.
| Feature | MakerDAO | Aave | Compound |
|---|---|---|---|
Liquidation Threshold (ETH) | 150% | 80% | 82% |
Liquidation Penalty | 13% | 5-10% (varies by asset) | 8% |
Liquidation Close Factor | 50% | 50% | 50% |
Primary Liquidation Method | Auctions (Dutch & English) | Fixed Discount (Liquidation Bonus) | Fixed Discount (Close Factor) |
Liquidator Role | Keeper Bots | Any User or Keeper | Any User or Keeper |
Maximum Single Liquidation | Entire position (via flip/kiss) | Up to 50% of debt | Up to 50% of debt |
Health Factor Calculation | Collateral Ratio (>=150%) | HF = Σ(Collateral * LT) / Σ(Borrowed) | Collateral Factor (<= collateral value) |
Stakeholder Perspectives and Strategies
Risk Management for Users
Liquidation is the forced sale of your collateral to repay your loan when its value falls below a required threshold, known as the liquidation threshold. This is a critical risk in over-collateralized systems like Aave or MakerDAO.
Key Strategies
- Maintain a Healthy Health Factor: This is a numerical representation of your loan's safety. A factor below 1.0 triggers liquidation. Always deposit more collateral or repay debt to keep this number high.
- Understand Your Collateral's Volatility: If you deposit a volatile asset like ETH, its price swings can quickly endanger your position. Using stablecoins as collateral can reduce this risk.
- Use Price Alert Tools: Proactively monitor your positions with on-chain tools or bots. Platforms like DeFi Saver offer automation to add collateral if your health factor drops.
Real-World Consequence
On Aave, if ETH price drops sharply and your Loan-to-Value (LTV) ratio exceeds the maximum, a portion of your ETH collateral will be sold at a discount to a liquidator. You also pay a liquidation penalty, losing more collateral than the debt repaid.
Key Risk Factors and Failure Modes
An overview of the critical vulnerabilities and potential breakdowns within over-collateralized liquidation mechanisms, detailing how cascading failures can occur despite built-in safety buffers.
Liquidation Cascade
A liquidation cascade occurs when multiple positions are liquidated in rapid succession, driving down collateral asset prices.
- Triggered by a sharp market drop, causing initial liquidations.
- Subsequent liquidations further depress prices, creating a feedback loop.
- Example: The 2020 'Black Thursday' on MakerDAO where ETH price crashes overwhelmed the system.
- This matters as it can rapidly erase user equity and threaten protocol solvency.
Oracle Failure / Manipulation
This risk stems from reliance on external price oracles for valuation. Incorrect or manipulated price feeds can trigger faulty liquidations.
- Oracle lag or downtime can use stale prices.
- Flash loan attacks can manipulate spot prices on a DEX that an oracle reads.
- Example: The bZx protocol exploit used flash loans to manipulate oracle prices.
- This matters because users can be unfairly liquidated, or the system can become undercollateralized without warning.
Liquidity Crunch
A liquidity crunch happens when insufficient market depth exists to absorb liquidation sales without significant price impact.
- Common with exotic or low-liquidity collateral assets.
- Liquidators may avoid unprofitable auctions if slippage is too high.
- Example: Liquidating a large WBTC position in a thin market could crash its price.
- This matters as it can cause bad debt to accumulate when liquidations fail to cover the loan.
Liquidation Incentive Misalignment
This involves flaws in the liquidation incentive structure, such as discounts (penalties) and keeper rewards.
- If the discount is too small, liquidators lack motivation to participate promptly.
- If too large, it excessively punishes the liquidated user and can increase volatility.
- Example: A protocol may need to dynamically adjust discounts based on network congestion and asset volatility.
- This matters because improper incentives can lead to delayed liquidations or predatory behavior.
Smart Contract Risk
The foundational risk of bugs or exploits within the liquidation smart contracts themselves.
- Logic errors could allow liquidation without proper triggers.
- Integration risks with new collateral types or oracle systems.
- Example: The Harvest Finance exploit where a flawed strategy contract was drained.
- This matters as it represents a single point of catastrophic failure, potentially leading to total loss of locked funds.
Gas Price Volatility & Network Congestion
High and volatile gas prices can prevent timely liquidations during market stress, as transactions become prohibitively expensive.
- Liquidators' profit margins are eroded by high gas costs.
- Users cannot top up collateral or repay debt if transactions fail.
- Example: During the 2021 bull run, Ethereum congestion made many liquidation transactions economically non-viable.
- This matters because it cripples the core risk mitigation mechanism precisely when it is needed most.
Advanced Technical Questions
Further Reading and Resources
Ready to Start Building?
Let's bring your Web3 vision to life.
From concept to deployment, ChainScore helps you architect, build, and scale secure blockchain solutions.