Liquidate
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).Load keypair and set parameters
Load the signer and create the connection. Set the vault and the amount of debt to liquidate.
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).When can a position be liquidated?
When can a position be liquidated?
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: read
liquidationThreshold and liquidationPenalty from the vault config. The same Read SDK lists every position of a vault with its risk ratio (getAllPositionsWithRiskRatio). Prices come from the Oracle program.Liquidator flow
Liquidator flow
As liquidator you typically supply the borrow token (or use absorb) and receive collateral. A flashloan can source the borrow token within the same transaction. Check the vault’s liquidation docs for exact parameters and rewards.
