Liquidation
When an Operator's health factor drops below 1, liquidators can purchase the Operator's delegated collateral by repaying their outstanding debt.
Mechanics
The liquidation process is as follows:
The liquidation process kicks off with a liquidator calling the initiateLiquidation function
After the liquidation has been initiated, the Operator has a grace period of 12 hours to improve the health of the loan
If the current Loan-to-Value is less than the emergency liquidation threshold, the grace period is overridden, opening the liquidation window immediately.
At the end of the grace period, liquidators can call the liquidate function until the expiry of the liquidation period. Liquidations will expire in 3 days after the end of the grace period.
A successful liquidation will execute a repayment of the borrowed asset, reducing the debt by the liquidation amount
The liquidated amount and the liquidation bonus is slashed from the Shared Security Network, transferring the collateral to the liquidator
The liquidation window will close once the Operator's health is recovered, i.e. over 1
Liquidation Threshold
By default, the liquidation threshold is set to 80% LTV. If the current LTV exceeds the liquidation threshold, then a liquidation may be opened. An emergency liquidation mechanism is used to override the grace period if the health threshold drops significantly. The emergency liquidation threshold is set to 90% LTV.
Liquidation Expiry
All liquidations have an expiry window. The window ensures that once the position becomes healthy again, the Operator will no longer be liquidatable. Hence, if the Operator were to be liquidatable again, the Operator will be ensured another grace period. If the Operator's health factor is below 1 after the expiry, any liquidator can initiate the liquidation process again.
Target Health and Maximum Liquidatable Amount
Target health is a health ratio threshold that defines the desired health level that liquidations should restore an Operator's position to, currently set at 1.25. It acts as a "safety buffer" that liquidations aim to achieve.
The target health defines the the maximum liquidatable amount. The maximum liquidatable amount is calculated as:
((Target Health * Total Debt) - (Total Delegation * Liquidation Threshold)) / ((Target Health - Liquidation Threshold) * Asset Price)
In other words, the goal is for the health factor, i.e.
Total Delegation * Liquidation Threshold / (TotalDebt - Liquidated Amount)
to be equal to the target health ratio.
Liquidation Bonus
The protocol implements a dynamic liquidation bonus system that provides incentives for liquidators. The liquidation bonus rises linearly with time from the grace period until the maximum amount reaches the bonus cap. At expiry, liquidators earn the maximum bonus which is set to 10%. If an emergency liquidation is triggered, liquidators bypass the grace period, immediately earning the maximum bonus.
Note that the bonus is only available when the total delegation exceeds total debt. The protocol prevents over-liquidating beyond available collateral
Architecture
Liquidation Logic
The LiquidationLogic library is the core component responsible for managing liquidation operations
Key Functions
openLiquidation: Opens a liquidation window for an unhealthy operator
Process Flow:
Health Check:
Validation:
Window Opening:
Validation Rules:
Agent health must be below 1e27 (100%)
Previous liquidation window must have expired
Cannot open multiple concurrent windows
closeLiquidation: Closes a liquidation window when an Operator becomes healthy
Process Flow:
Health Verification:
Validation:
Window Closure:
Validation Rules:
Agent health must be above 1e27 (100%)
Only healthy agents can have windows closed
liquidate: Executes liquidation of unhealthy positions with bonus incentives
Process Flow:
An Operator must be eligible to be liquidated: health factor below 1, and have outstanding debt to be liquidated.
Checks for emergency liquidations, and whether liquidate timestamp is within the liquidation window.
Asset Pricing and Bonus Calculation
Calculate Max Liquidatable Amount
Repay Debt:
Liquidation Value Calculation
Execute Slashing
Close Window
Admin Functions
setGrace: Set grace period for liquidations
setExpiry: Set expiry period for liquidations
Set Bonus Cap for liquidations
View Functions
grace: View grace period in seconds
expiry: Returns the expiry period after which liquidation rights expire
maxLiquidatable: Max liquidatable amount for an agent borrowing a particular asset
bonus: Calculates the maximum bonus percentage for liquidating an agent
bonusCap: Returns the maximum bonus percentage for liquidations
emergencyLiquidationThreshold: Returns the health threshold below which grace periods are ignored
liquidationStart: Returns the timestamp when liquidation was initiated for an agent
Last updated