Liquidation
High level explanation of liquidation process
The liquidation process in the Fathom protocol involves several key components and steps outlined in detail in the LiquidationEngine
and FixedSpreadLiquidationStrategy
contracts. The liquidation mechanism maintains the system's stability by handling under-collateralized positions. Here is an overview of the process:
Components Involved:
Liquidation Engine (
LiquidationEngine
): Manages the overall liquidation process.Fixed Spread Liquidation Strategy (
FixedSpreadLiquidationStrategy
): Implements a specific strategy for liquidation.Collateral Pool Config (
CollateralPoolConfig
): Provides configuration for collateral pools, including parameters like liquidation ratio, close factor, and liquidator incentives.BookKeeper (
BookKeeper
): Records positions, stablecoin balances and collateral.System Debt Engine (
SystemDebtEngine
): Manages the system's overall debt and surpluses, including systemBadDebt and systemSurpluses.Price Oracle (
PriceOracle
): Provides price feeds for collateral assets.
Liquidation Process:
Triggering Liquidation:
A position becomes eligible for liquidation when its collateral value falls below a predefined threshold (defined by the liquidation ratio in
CollateralPoolConfig
). The liquidation Ratio is the same as ( 1 / Loan to Value Ratio).The
PriceOracle
plays a crucial role in determining the health of positions by providing the latest available prices for collateral assets.
Liquidation Execution:
The liquidation process is initiated by a liquidator (which, at the moment, is a role only available to whitelisted addresses) who identifies an under-collateralized position and calls the liquidate function in
LiquidationEngine
.The liquidate function checks various conditions, such as the liquidator's whitelist status, the system's operational status (live), and the health of the price feed.
If the conditions are met,
LiquidationEngine
interacts with theFixedSpreadLiquidationStrategy
to execute the liquidation.
Fixed Spread Liquidation Strategy:
This strategy determines the specifics of the liquidation, such as the amount of debt to be repaid and the amount of collateral to be seized.
It calculates the required parameters based on current prices, debt accumulated rates, and other factors defined in
CollateralPoolConfig
.
Financial Adjustments:
Upon successful liquidation, the
BookKeeper
updates the financial state of the system, including adjusting the debt and collateral amounts for the liquidated position.The
SystemDebtEngine
may also handle any resultant bad debt from the liquidation process.
Distribution of Assets:
The liquidator typically receives a portion of the seized collateral as an incentive, with the rest used to repay the debt.
Parameters like liquidator incentives and treasury fees govern the distribution of assets.
Edge Cases and Safeguards:
The system includes various safeguards and checks to prevent unauthorized access and ensure the integrity of the liquidation process.
For instance, roles and permissions are enforced using access control mechanisms.
The following subsection guides you through the liquidation process in detail.
Last updated