ZeroLend Docs
WebsiteApp
  • Welcome to ZeroLend
  • Overview
    • Lending and Borrowing
      • Parameters
      • zLP Token Distribution
    • Assets Listings
      • Supported Assets
  • Features
    • LRT Lending Market
    • RWA Lending
      • RWA Stablecoin Market
    • Capital Efficiency
      • High Efficiency Mode (E-Mode)
      • Isolation Mode
      • Supply/Borrow Caps
    • Liquidations
      • Liquidation Guide for Developers
    • Credit Card
  • Airdrop Incentives
    • Zero Gravity
      • Voyage 1: Zero to Zillion
        • Chapter 1: Ignition 🔥
        • Chapter 2: LiftOff 🚀
        • Chapter 3: Boost âš¡
  • Governance
    • Zeronomics
      • Token Utility
      • Token Distribution
      • Staking
        • Single Token Staking
        • zLP Staking
        • Stake on StakeDAO (sdZERO)
      • Emissions
        • Emission Strategy
          • Protocol Power/Weight
          • Deconstructing the Weighted Percentage (T_p) Calculation
          • Construction of zLP & $ZERO Power
      • Buybacks and Burn
    • Discussion Forum
  • Security
    • Audits
    • Oracles
      • PYTH Oracles
      • Redstone
      • API3 Oracles
      • Chainlink
      • eOracle
    • Deployed Addresses
    • Timelocked Multisig Admin
    • Insurance Fund
  • Tutorials
    • Basic Tutorials
      • Supply Assets
      • Borrow Collateral
      • Claim ZERO
      • Stake ZERO
    • Yield Strategies
      • Passive LRT Strategies
      • Leverage Exposure
    • Guidebook: Farm on Linea Market
    • Stake ZERO (zLP) Tokens
  • Important Links
    • Twitter
    • Discord
    • Github
Powered by GitBook
On this page
  • Profitability Considerations
  • Prerequisites for Liquidation
  • Obtaining Liquidation Targets
  • Executing a Liquidation Call
  • Calculating Profitability vs. Gas Cost

Was this helpful?

Edit on GitHub
  1. Features
  2. Liquidations

Liquidation Guide for Developers

This guide discusses how developers can participate in the liquidation process on ZeroLend.

Developers and traders can participate in liquidations through:

  1. Direct Calls: Execute the liquidationCall() directly on the Pool or L2Pool contracts.

  2. Automation: Use or develop automated systems or bots to identify and execute profitable liquidation opportunities.

Profitability Considerations

While finding profitable liquidation actions, consider the gas costs to calculate the economic feasibility accurately. The liquidation may not be economically feasible if the gas price is too high.

Liquidation Details in Zerolend v3

ZeroLend allows for up to 100% of the debt to be liquidated in a single liquidationCall() if the HF is below a certain threshold (CLOSE_FACTOR_HF_THRESHOLD).

Prerequisites for Liquidation

Before making a liquidationCall(), ensure you:

  • Identify the user account with an HF below 1.

  • Know the valid debt amount and the asset to cover (debtToCover & debtAsset).

  • Understand the applicable liquidation close factor based on the HF.

Obtaining Liquidation Targets

User accounts in ZeroLend are individual addresses that have interacted with the protocol. These can be either externally owned accounts or contracts. Accounts eligible for liquidation have an HF < 1.

You can identify these accounts:

  • On-Chain: Monitor protocol events and maintain an up-to-date index of user data. Use getUserAccountData() to check an account's current HF.

  • GraphQL: Utilize GraphQL to gather user account data and compute health factors using Zerolend utilities or SDKs, as real-time data like HF may not be directly available.

Executing a Liquidation Call

To liquidate an account, calculate the collateral that can be liquidated:

  1. Retrieve user reserve data using getUserReserveData().

  2. Determine the maximum debt clearance allowed by the liquidation close factor.

  3. Optionally, set debtToCover to uint(-1) to liquidate the maximum amount permitted.

  4. Calculate the maximum collateral that can be liquidated based on the liquidation bonus and current asset prices.

Calculating Profitability vs. Gas Cost

To assess the profitability of a liquidation, consider:

  1. Collateral details (address, decimals, liquidation bonus).

  2. User's collateral balance.

  3. Asset prices from ZeroLend's oracle using getAssetPrice().

  4. Maximum collateral bonus and the cost of your transaction, including gas prices and usage.

  5. Your potential profit is calculated as the value of the collateral bonus minus the transaction cost.

By closely following these steps and calculations, developers can effectively contribute to the protocol's health while potentially securing a profit through successful liquidations.

PreviousLiquidationsNextCredit Card

Last updated 1 year ago

Was this helpful?