Skip to main content
Liquidate a position that has exceeded the protocol’s liquidation threshold. You pay the borrow token (or absorb) and receive collateral. The SDK returns instructions that use address lookup tables; the transaction is built as a versioned (v0) transaction.

Liquidate

1

Import Dependencies

Import web3.js for connection and versioned transactions, the borrow SDK, and BN for the debt amount.
getLiquidateIx returns instructions and address lookup table accounts. Optional params: colPerUnitDebt, absorb, to (recipient of collateral).
2

Load keypair and set parameters

Load the signer and create the connection. Set the vault and the amount of debt to liquidate.
Only positions that are liquidatable (e.g. LTV above threshold) can be liquidated. The liquidator typically receives collateral; ensure you have the borrow token to pay the debt if required by the vault.
3

Build liquidate instructions

Get the liquidate instructions and address lookup table accounts.
You can pass optional to (PublicKey) for the collateral recipient, absorb (boolean), and colPerUnitDebt (BN) for pricing. Omit them to use defaults (e.g. signer as recipient).
4

Build versioned transaction and send

Build the v0 message with instructions and lookup tables, sign, send, and confirm.
Liquidation improves protocol health by closing underwater positions. The liquidator is incentivized with a discount on collateral or similar mechanism per vault design.
When the position’s loan-to-value (LTV) or health factor crosses the vault’s liquidation threshold. The exact rules and incentives are vault-specific.
As liquidator you typically supply the borrow token (or use absorb) and receive collateral. Check the vault’s liquidation docs for exact parameters and rewards.

Full code example