Liquidator
Atomic liquidations on Base. The seized collateral pays the debt inside one transaction, and the worst case is gas.
- lending protocols, Morpho Blue and Aave V3
- 2
- lending protocols, Morpho Blue and Aave V3
- transaction per liquidation
- 1
- transaction per liquidation
- independent profit guards
- 3
- independent profit guards
- decision records
- 25
- decision records
On a lending market, a loan is liquidatable once what is borrowed is worth more than the collateral allows. Anyone may then repay part of the debt and take collateral at a bonus. That usually takes capital or a flash loan. On Morpho, this one needs neither.
How it works
Morpho Blue hands the liquidator the seized collateral in a callback before it asks for repayment. The executor contract swaps that collateral on Aerodrome, inside the same callback, and repays the debt out of it. The difference is the bonus, less the swap and the gas. It happens in one transaction or not at all. Aave V3 came second, on the same spine, using Aave’s own flash loan and the same ladder of guards.
The watcher
A TypeScript daemon in two lanes: a slow sweep that discovers borrowers and a fast poll over a watchlist of the ones close to the line. Reads are batched through Multicall3, and the load is tuned to run 24/7 on free RPC tiers rather than a paid one. Every hit is simulated, sized and preflighted. Alerts go to Discord.
Where it stands
Both executors are deployed on Base and fork-tested against real Base state. The daemon ran around the clock in dry run on its own small server, building and preflighting every hit and signing none. It was never switched to live.
How it is built
A gate-
Watcher finds a target
Morpho's API for the universe, the chain for the truth, exact BigInt health math.
-
Simulate Gate
Size the seize, quote the swap on Aerodrome, net out gas. No profit, no send.
-
Preflight Gate
The exact call simulated against the chain. A revert is read, never paid for.
-
Liquidate
Morpho hands the executor the seized collateral before repayment is due.
-
Swap and repay
Collateral swapped on Aerodrome inside the callback, the debt repaid from it.
-
Keep the spread Gate
The contract checks its minimum profit after it all, or the whole transaction reverts.
Decisions
03- 01
Downside is gas, never principal.
An off-chain estimate can be wrong; a price goes stale, a swap slips. So there are three guards that do not depend on each other. A simulation before sending, a swap floor inside the callback that must cover the repayment, and a minimum-profit check in the contract after the liquidation completes. Any single mistake ends in a reverted transaction. A fork test with an impossible profit target proves the revert.
- 02
Decide profit in the loan token, not in dollars.
Pricing everything in dollars puts a live price feed in the hot path, and a stale feed can block or mislead an execution. Profit in the loan token is still profit. Gross and gas are both compared in that token, and dollars are only for the log.
- 03
Dry run is the default. Live is a decision.
The first code that can send a transaction defaults to sending nothing. It runs every path through a preflight simulation and shows the revert reason instead of paying for it. Going live takes a deliberate change. Manual first, then the loop in dry run, then live.