Bidding on Liquidations
This guide covers how to integrate liquidation bidding into your application, allowing users to acquire collateral at discounted prices when CDP positions are liquidated.
Overview
When Credit Account positions become undercollateralized, their collateral is sold through RUJI Trade orderbooks. Users can place tracking orders at a discount to the current oracle price (defined by THORChain enshrined oracle). When liquidations route through these orders, users acquire collateral at their specified discount.
How It Works
1. User places order: "Buy BTC at 5% below oracle price"
└─> Order sits in RUJI Trade orderbook
2. Borrower's position becomes liquidatable
└─> Liquidation solver executes liquidation
3. Solver swaps collateral (BTC) for debt token (USDC) via a market order on RUJI Trade
└─> If the market order creates a large enough wick, the order gets filled at 5% discount
4. User withdraws filled order
└─> Receives BTC acquired at discounted priceKey Benefits
No active monitoring - Set orders and wait
Guaranteed discount - Only fills at your specified discount to market price, typically at the local low as this is when liquidations tend to happen
Pro-rata fills - Fair distribution when multiple bidders at same price
Flexibility - Withdraw unfilled orders anytime
RUJI Trade Tracking Orders
Tracking orders track the oracle price with a basis point adjustment:
{ "oracle": 0 }= Exactly at oracle price{ "oracle": -100 }= Oracle price minus 1% (100 bps){ "oracle": -500 }= Oracle price minus 5% (500 bps){ "oracle": 100 }= Oracle price plus 1%
Placing Liquidation Bids
Order Message Structure
Parameters
side
"base" or "quote"
Which token you're offering
price
"oracle": integer
Price expressed as a deviation from Oracle in bps
amount
Uint128 or null
Target amount (null = withdraw all)
Side Explanation
For a BTC/USDC pair:
Base = BTC (first token)
Quote = USDC (second token)
To buy BTC at a discount (typical liquidation bid on the long side):
Side:
"quote"(you're offering USDC)Price:
{ "oracle": -500 }(5% below oracle)You receive BTC when filled
To sell BTC at a premium (to liquidate a position on the short side):
Side:
"base"(you're offering BTC)Price:
{ "oracle": 500 }(5% above oracle)
Code Examples
Place a Bid (TypeScript)
Query Your Orders
Response:
Withdraw Filled Orders
Modify Order Amount
Multiple Orders at Different Discounts
Place a ladder of bids at various discount levels:
How Orders Get Filled
Fill Priority
When liquidations swap collateral, orders are filled by price priority:
Orders closest to oracle price fill first
At same price level, orders fill pro-rata (proportional to size)
Tracking orders adjust automatically as oracle price moves
Pro-Rata Example
Bid Pool Mechanics
Orders at the same price level share a bid pool. The contract tracks:
offer: Your original USDC amountfilled: Amount converted to BTCproduct_snapshot: Used for pro-rata calculation
Fees
Maker Fee
0.075%
On withdrawal of filled orders
No fee
-
Cancelling unfilled orders
Fee rates are configurable per trading pair. Query the pair config for current values.
Risks and Considerations
Market Risk
Collateral value may drop further after you acquire it
Oracle price may differ from actual market price
Liquidity Risk
Orders may not fill if liquidations don't occur at your desired discount
Capital is locked while order is active
Timing Risk
During high volatility, liquidations happen rapidly
Orders at shallow discounts fill first
Recommendations
Diversify discount levels - Place orders at multiple price points
Monitor positions - Check filled amounts regularly
Set realistic discounts - Too deep = rarely fills, too shallow = less profit
Understand the asset - Only bid on collateral you want to hold
Supported Trading Pairs
Liquidation flow routes through RUJI Trade pairs. Common pairs:
BTC/USDC
thor1dwsnlqw3lfhamc5dz3r57hlsppx3a2n2d7kppccxfdhfazjh06rs5077sz
ETH/USDC
thor1tnd06uswj8033d0kzd5d7zre73u3uc44r2vvez26z5m4kr68vtusf2snva
BCH/USDC
thor1s4jpxtz0jsh6elyqcdujd303ptefz53gknmcp437rm9ykxnfhysqrm5hze
DOGE/USDC
thor1w8agselh7k2e4ty369v39lngkckljxfafm35d06f7wj3ar90h2esv75t7p
LTC/USDC
thor1ks9qq0nwv7qxtnznesys6ylflwruqlf85er6zls4erwgzkvw0m0qs3rghz
XRP/USDC
thor14v89h32ztmfg9d230cjly7ac26fvdkhgq7nkntsw4uy2f3yh2v7qrz6hsw
Note: For the full list of RUJI Trade pairs, check https://rujira.network/developer/deployment and look for
rujira-fin.
Message Reference
ExecuteMsg::Order
QueryMsg::Orders
QueryMsg::Config
Returns pair configuration including denoms, fees, and oracles.
Last updated