Skip to main content

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

FeatureDescription
PermissionlessAny address can initiate liquidation
Callback SupportOptional callback for complex liquidation strategies
Automatic SettlementHandles position settlement during liquidation

Core Functions

Liquidate

function liquidate(
ILoanToken loanToken,
address borrower,
bytes calldata data
) external nonReentrant

Execution Flow:

  1. Retrieves borrower's account state
  2. Verifies position is unhealthy
  3. Calculates liquidation amounts
  4. Settles the position
  5. Transfers assets between parties
  6. Executes optional callback