Liquidation
The liquidation mechanism module provides liquidation functionality. When a borrower's health factor falls below the liquidation threshold, liquidators can repay the borrower's debt in exchange for their collateral.
Core Concepts
Liquidation Principle
The liquidation mechanism is an important security mechanism in lending protocols:
- Trigger Condition: When a borrower's health factor falls below the liquidation threshold
- Liquidator: Anyone can become a liquidator
- Liquidation Process: Liquidators repay debt and receive collateral
- Liquidation Reward: Liquidators receive liquidation rewards as incentives
Liquidation Process
- Monitoring: Monitor the borrower's health factor
- Trigger: Trigger liquidation when health factor falls below threshold
- Execution: Liquidators execute liquidation transactions
- Settlement: Liquidators receive collateral and rewards
API Reference
liquidatePTB
This function liquidates a position by paying debt and receiving collateral. See documentation for details.
Usage Example
import { liquidatePTB } from '@naviprotocol/lending'
import { Transaction } from '@mysten/sui/transactions'
const tx = new Transaction()
const [collateralBalance, remainDebtBalance] = await liquidatePTB(
tx,
payAsset, // Asset identifier for the debt being repaid
payCoinObject, // Coin object containing the debt repayment amount
collateralAsset, // Asset identifier for the collateral being liquidated
liquidateAddress, // Address of the borrower being liquidated
options // Optional environment configuration
)