Liquidation
Overview
The liquidation mechanism enables the protocol to maintain solvency by allowing liquidators to repay unhealthy account's debts in exchange for purchasing collateral at a discount. Liquidations are permissionless and can be executed by any external actor when a borrower's position becomes unhealthy.
Key Features
Feature | Description |
---|---|
Permissionless | Any address can initiate liquidation |
Callback Support | Optional callback for complex liquidation strategies |
Automatic Settlement | Handles position settlement during liquidation |
Core Functions
Liquidate
function liquidate(
ILoanToken loanToken,
address borrower,
bytes calldata data
) external nonReentrant
Execution Flow:
- Retrieves borrower's account state
- Verifies position is unhealthy
- Calculates liquidation amounts
- Settles the position
- Transfers assets between parties
- Executes optional callback