Skip to main content
Liquidation bots keep Vanna Protocol solvent by calling AccountManager.liquidate() on undercollateralized accounts. Anyone can run one — no whitelist, no special permissions.

How Liquidation Works

When a margin account’s health factor drops to or below 1.1×:
  1. Any caller can call AccountManager.liquidate(smart_account)
  2. The protocol repays all debt by drawing from the SmartAccount’s collateral
  3. Remaining collateral is swept to the trader
  4. The liquidator pays gas and receives no explicit bonus in the current version
Vanna V1 does not currently pay a liquidation bonus to the bot. The economic incentive is keeping the protocol healthy. A liquidation premium may be introduced in a future version.

Architecture of a Liquidation Bot


Step 1: Discover All Margin Accounts

Fetch the full list of accounts from AccountManager events (Mercury) or read from Registry:

Via Registry Contract


Step 2: Check Health Factor for Each Account


Step 3: Execute Liquidation


Full Bot Loop


Handling Race Conditions

Multiple bots may attempt to liquidate the same account simultaneously. The liquidate() function will succeed for one and fail for the others (the account is no longer unhealthy after the first liquidation). Handle this gracefully:

Monitoring with Mercury Events

Set up event tracking to know when liquidations happen in real time:

Bot Account Setup

Your bot needs a funded Stellar testnet account with enough XLM to pay transaction fees:
Each liquidate() call costs ~0.001–0.01 XLM in fees. Keep the bot account funded.

Production Considerations