Contract-based executors
Most liquidation bots execute through an executor or liquidator contract. That contract may receive the seized collateral, approve a swap router, perform the swap, and then send the output to the bot, treasury, or another recipient. The example below shows allowance settlement for executors that cannot provide a valid Permit2 signature. In this flow, the quote can be executed after the contract approves the spender returned by Rialto. For allowance flow, the quote should have:settlement: "allowance"takerset to the account or contract that holds and pays the sell tokentx.toset to the active Rialto routertx.dataexecutable by the executor contracttx.valueset for native-token sells, or0for ERC20 sellsissues.allowance.spenderset when an ERC20 approval is needed
Integration flow
- Detect a liquidatable position.
- Estimate the collateral amount to sell and the token you want to receive.
- Call
GET /quotewith the executor contract as the taker. - If
issues.balanceis present, do not execute the liquidation. - If
issues.allowanceis present, approve the returned spender from the executor contract for at leastsell_amount, preferably within the same transaction. - Execute
tx.to,tx.data, andtx.valuefrom the executor contract. - Reset the token allowance to zero after execution, preferably within the same transaction.
Quote request
taker when the executor will hold the sell token
and submit the swap call.
Response fields to use
issues.allowance.spender as the approval target.
Use tx.to, tx.data, and tx.value as the swap call.
Do not recompute the route, fee logic, slippage math, or calldata. The returned
transaction is the integration boundary.
Executor sketch
Q&A
What should the approval lifecycle be?
For allowance settlement, use scoped approvals. Approve only the amount needed for the input token, execute the swap, then reset the allowance to zero, preferably within the same transaction. This reduces exposure from unused or stale allowances, in addition to the controls Rialto applies on its side.What should I do if the quote returns issues?
If issues.balance is present, do not execute the swap. If issues.allowance
is present for allowance settlement, approve the returned spender before
execution.
Safety checks
Before executing a quote, liquidators should still check:- expected profit after gas
min_buy_amount- route freshness
- slippage tolerance
- token balances after liquidation
- allowance reset after execution, for allowance settlement
- whether the returned transaction still simulates successfully
