Liquidators
Liquidations act as position transfers between accounts. Liquidator accounts thus need to be collateralised in order to satisfy the transfer's initial margin requirements.
There are four instructions pertaining to liquidations:
liquidate_perp
Liquidator takes over user perpetual positions at a discount.
liquidate_borrow
Liquidator takes over borrow at a discount to the deposit value.
liquidate_borrow_for_perp_pnl
Liquidator takes over borrow for discount P&L.
liquidate_perp_pnl_for_deposit
Liquidator takes over negative P&L for discounted deposit.
Bankruptcy (see Insurance Fund) is possible if you still have outstanding liabilities and no further assets after liquidation.
Liquidators are open-sourced and can be triggered by anybody running a liquidator bot. Liquidators, also known as Keepers, will have their collateral reward credited to their Drift account.
Liquidations will be triggered and positions will be liquidated based on oracle price, not the mark price of the exchange.
The user's trade price at liquidation for a perpetual position will be based on the oracle price + the penalty / fee that is set per market.
🚫 In the case of an extreme oracle error: the market will pause most fills, liquidations, and funding rate updates.
If you would like to run a liquidator bot, see Tutorial: Liquidation Bot

