Skip to content

Liquidator Bot

Alula's lending pools rely on timely liquidations to stay solvent. We maintain an open-source keeper bot that anyone can run to liquidate undercollateralized positions and earn the collateral purchase discount. If you're interested in running one yourself or contributing to the codebase, the full source is on GitHub:

pointgroup-labs/alula-liquidator

What it does

The bot monitors Alula markets for obligations whose liquidation health factor has dropped below 1, estimates whether a liquidation would be profitable after gas and swap costs, and executes it if so. The liquidator earns the collateral purchase discount on each successful liquidation.

Beyond liquidation itself, the bot runs three housekeeping strategies that keep the keeper's balance sheet in order:

  • Bad debt handler initiates bad-debt coverage through the insurance fund when a liquidation leaves the borrower with residual debt and no viable collateral.
  • Rebalancer converts non-target assets in the keeper's wallet into preferred assets via on-chain AMM swaps, capping trade size to limit price impact.
  • Withdrawer pulls idle deposits out of pools once it can do so without pushing utilization past a safety margin.

How liquidation works

When the bot identifies a profitable opportunity, it picks the most profitable (borrow pool, collateral pool) pair and chooses one of two execution modes based on the keeper's on-hand liquidity:

  • Direct: the keeper already holds enough of the repayment asset to call liquidate immediately.
  • PreSwap: the keeper swaps a held asset into the repayment asset first, then liquidates. Both operations are composed into a single atomic transaction via submit_requests_batch.
  • FlashBorrow: the keeper flash-borrows the repayment asset, liquidates, swaps the seized collateral back to cover the flash loan, and keeps the profit — all composed into a single atomic submit_requests_batch with no upfront capital required.

Collateral received from liquidations that isn't in the keeper's target asset list is later converted by the rebalancer. More detail on liquidation mechanics, including the collateral purchase discount, close factor, and solvency modes, is in the Liquidations reference.

Why more liquidators help

Faster liquidation response means less time for undercollateralized positions to accumulate bad debt. The bot handles the complexity (oracle price tracking across markets, profit estimation, multi-operation transaction composition, and portfolio rebalancing) so operators can focus on funding and monitoring.

Getting started

The repo README has two quickstart paths (Docker Compose and from source) and links to full configuration and operations documentation:

Quickstart and setup