Liquidation Bot Integration
Connect liquidation inventory discovery and execution to deployed CDP markets.
Liquidation automation is an integration between offchain inventory discovery, market risk state, and the deployed liquidation controller. A bot should be boring in production: discover, verify, simulate, submit, and record.
Bot Loop
Quote Server Endpoints
POST /quote/liquidationreturns a liquidation quote for a specific request.POST /quote/liquidationsreturns liquidation inventory.
Integration Rules
- Read the current manifest before each deployment target change.
- Keep a per-market retry ledger so a failing position does not block all other candidates.
- Simulate before submission, even when inventory is freshly returned.
- Treat oracle, risk, and pause changes as loop-invalidating events.
Hook-route fallback
For a CDP market, ordinary swaps can fill the hook's per-token block budget and
make a hook-route liquidation revert with BlockCapExceeded. The hook's
maxAmountSpecified and minOraclePriceE18 guards can also reject that route.
In these cases, obtain a fresh liquidation preview and simulate
LiquidationController.liquidate as a separate direct route. It bypasses hook
limits but still requires an eligible position, a usable oracle, controller
and manager wiring, stablecoin funding and approval, and acceptable collateral
output. Inventory responses do not switch routes automatically.
Deployment Dependency
Native stablecoin markets may need liquidation support backfilled with:
make deploy-liquidation-controller MANIFEST=deployments/manifests/11155111-native-stablecoin-registry-v3.jsonSource Files
quote-server/src/liquidations.tsquote-server/src/http.tssdk/src/liquidation.tssdk/src/liquidationHookData.tsscript/production/DeployLiquidationController.s.sol