👻
Aave Book
  • Introduction
  • TradFi vs DeFi: Lending
  • Market forces x Interest Rate Models
  • On Indexes
    • Why use indexes?
  • Scaling and ATokens
  • Deposit & Borrow Interest
  • Stable borrowing
    • 🚧Under construction
  • Liquidation
    • 🚧TODO: Full example
    • 🚧Under construction: oracles
  • Primer
    • Bitmap & Masks
      • 🚧padding and bytes
    • WadRayLibrary
      • Math Operations
      • 🚧WIP: Scaling different decimal representations
      • 🚧WIP: 2's complement
      • 🚧casting: to uint128
    • PercentageMath
    • Embedded vs Linked Libraries
  • Functions
    • General Execution flow
    • Architecture & Design choices
      • 🚧Upgradability and Proxies
    • Common Functions
      • getReserveFactor, getDecimals
      • .cache
      • .updateState
      • .updateInterestRates
      • SupplyCap, BorrowCap
      • getFlags
        • 🚧more on flags
      • calculateUserAccountData
    • supply
      • validateSupply
      • transfer & mint
      • isFirstSupply
        • isUsingAsCollateralOne, isUsingAsCollateralAny
      • On check-effects-interactions pattern
    • withdraw
      • get user balance & withdraw amount
      • validateWithdraw
      • collateral check
      • burn ATokens
      • Ensure existing loans are collateralized
    • borrow
      • getIsolationModeState
      • .validateBorrow
      • Mint debt token
      • setBorrowing
      • update IsolationMode debt
      • transfer underlying to user
    • repay
      • get current debt
      • validateRepay, paybackAmount
      • burn debt tokens
      • Cleanup + Collect repay
    • liquidate
      • _calculateDebt
      • validateLiquidationCall
      • getConfigurationData
      • calculateAvailableCollateralToLiquidate
      • 🚧_burnDebtTokens
      • liquidate/burn collateral
      • liquidation Fee
      • Wrap-up
    • 🚧swapBorrowRateMode
    • 🚧setUserUseReserveAsCollateral
  • Contracts
    • AToken
      • Simple example: mint & balanceOf
    • StableDebtToken
      • Implementation explained
    • VariableDebtToken
    • DefaultReserveInterestRateStrategy
    • L2
      • 🚧PriceOracleSentinel
  • Audit findings
    • 🚧Under construction
  • Appendix
    • Simple, Compound, APR, APY
  • Aave Features
    • Risk Management
      • Supply & Borrow Caps
      • Isolation Mode
      • Siloed Borrowing
    • Other features
      • Repay with ATokens
      • eMode: High efficiency Mode
      • 🚧Aave Vault
      • 🚧Portal
Powered by GitBook
On this page
  • Overview
  • Execution flow
  • validateLiquidationCall

Was this helpful?

Edit on GitHub
  1. Functions
  2. liquidate

validateLiquidationCall

Previous_calculateDebtNextgetConfigurationData

Last updated 1 year ago

Was this helpful?

Overview

Execution flow

validateLiquidationCall

A valid liquidationCall must fulfil the following criteria:

  • Status flags for both collateral and borrow asset must be ACTIVE and NOT PAUSED

  • L2 check

  • Ensure user's health factor < 1

  • Collateral check

    • check that liquidation threshold is non-zero

    • confirm that user is using the collateral: isUsingAsCollateral

Since the liquidator can claim a single collateral of choice - we need to check the collateral address passed to ensure that it is indeed a valid selection. Else we might liquidate an asset that was not marked as collateral.

Liquidation threshold

  • is the percentage at which a loan is defined as under-collateralized.

  • usually no more than 10-15% above LTV.

For example, a liquidation threshold of 80% means that if the loan value rises above 80% of the collateral, the loan could be liquidated.

If the loan reaches the liquidation threshold, Aave prevents a user from borrowing and the user must either partially close their position or provide more collateral.

Drawing