Liquidation Solvers
This guide covers building liquidation solvers (also called "path finders") - off-chain infrastructure that monitors at-risk positions, calculates optimal liquidation routes, and executes liquidations
Overview
The Path Finding Challenge
How Solvers Earn
┌─────────────────────────────────────────────────────────┐
│ Solver Workflow │
├─────────────────────────────────────────────────────────┤
│ │
│ 1. Monitor Credit Accounts for LTV >= 100% │
│ │
│ 2. Analyze underwater position: │
│ - Multiple collateral types (BTC, ETH, DOGE, etc.) │
│ - Debt denominated in USDC, USDT, etc. │
│ - User liquidation preferences │
│ │
│ 3. Calculate optimal liquidation path: │
│ - Query RUJI Trade pools for liquidity │
│ - Find best swap routes per collateral │
│ - Respect preference order constraints │
│ - Minimize slippage across all swaps │
│ │
│ 4. Execute liquidation on-chain │
│ - Submit optimized route via ExecuteMsg::Liquidate │
│ - Earn 0.5% of repaid debt as fee │
│ │
└─────────────────────────────────────────────────────────┘Permissionless Participation
Fee Structure
Fee
Rate
Recipient
Contract Addresses
Contract
Address
Querying Liquidatable Positions
Find All Accounts (Paginated)
Check Single Account
Account Response Structure
Path Finding Strategy
Multi-Collateral Accounts
Route Optimization Goals
Querying RUJI Trade Liquidity
Building Multi-Hop Routes
Executing Liquidations
Liquidate Message Structure
LiquidateMsg Types
Example: Multi-Collateral Liquidation
Handling User Preferences
Preference Order
Preference Messages
Validation Rules
1. Position Must Be Underwater
2. No Over-Liquidation
3. Slippage Limit
4. Preference Order Respected
Building a Liquidation Bot
Architecture
Monitor Service
Analyze Service
Execute Service
Main Loop
Profitability Calculation
Error Handling
Common Errors
Error
Cause
Solution
Retry Strategy
Message Reference
Liquidate (Execute)
Configuration Parameters
Parameter
Description
Typical Value
Last updated
