Overview
Liquidation bots:- Monitor all user accounts
- Identify accounts below maintenance margin
- Execute liquidations to earn fees
- Help maintain protocol solvency
Basic Liquidation Bot
liquidation-bot.ts
Key Concepts
Liquidation conditions
Liquidation conditions
Accounts are liquidatable when:
- Total collateral < Maintenance margin requirement
- Account health < 0
Liquidation fees
Liquidation fees
Liquidators earn a percentage of the liquidated position as a fee.
Partial liquidations
Partial liquidations
The protocol uses partial liquidations to minimize impact.
Insurance fund
Insurance fund
When liquidations result in bad debt, the insurance fund covers losses.
Production Considerations
Efficient Account Monitoring
Priority Fees
Liquidations are competitive. Use priority fees to win:Risk Management
- Collateral: Maintain sufficient collateral for liquidations
- Gas costs: Monitor profitability vs gas costs
- Competition: Be prepared for failed transactions
Next Steps
Keeper Bots Repo
Production keeper implementations
Liquidation Concepts
Understanding liquidations