Skip to main content
POST
Closes a liquidation by forwarding the router’s cumulative proceeds to the market, which runs its capped settlement waterfall over them. The waterfall repays the pool, draws on the insurance fund for a shortfall, pays any surplus to the borrower, and the record moves to SETTLED. It is signed by a holder of the router’s OPERATOR_ROLE.
A settlement closes the router’s record for good. Collateral still on the router afterwards can no longer be withdrawn. Only the router administrator’s Reopen Liquidation brings it back, and only while the record collected nothing. This endpoint therefore refuses to settle while any collateral is on the router, with COLLATERAL_UNSOLD.
This is the final step of the manual settlement workflow. Until it is called, the liquidated debt remains outstanding on the market and counts against pendingLiquidationDebt.

Path Parameters

string
required
Liquidation ID on the market’s router.

Body Parameters

string
Names the market whose liquidation you mean. Every market runs its own liquidation router and IDs restart at 1 on each of them, so the same liquidationId can exist on several markets in one instance. Supply this when it does, otherwise the call is refused with AMBIGUOUS_LIQUIDATION_ID and the response lists the candidates. Also accepted as a query parameter.
string
required
Final proceeds to deposit before settling, in the market’s borrow asset, at most as many decimals as that asset has. Must be zero or greater. The confirm call must carry it too, though its value is not used there.Send the full sale proceeds when settling in one step. Send "0" when the proceeds were already deposited through Report Partial Sale, and the router forwards what it already holds.
string
Hash of the settleLiquidation transaction you broadcast, not of the approval. Send it to confirm the transaction and record the result. Omit it to receive the calldata. A value that is not 0x followed by 64 hex characters is refused with 400 VALIDATION_ERROR and nothing is built or recorded. null or an empty string counts as omitted.
The wallet that signs must hold OPERATOR_ROLE on the router. This endpoint checks the role against your instance’s primary verified wallet, since it takes no signer address. If that wallet lacks the role, the calldata is not returned: the response carries ROUTER_OPERATOR_ROLE_MISSING along with the calldata that grants it. When usdcProceeds is greater than zero the signing wallet must also hold the proceeds, since settlement pulls them from it.

Settle at Zero

A zero final payment is accepted in two cases. The router already holds proceeds from reported partial sales, or the market holds cash the auction venue forwarded for this record before its auction expired. Every other zero is refused before anything is built:
  • All collateral left the router and no sale was reported: SALE_NOT_REPORTED. The router itself refuses a zero settlement in this state. Report the sale first, or let the record reach the write-off.
  • Nothing was collected and the market holds no auction cash for the record: NO_PROCEEDS_COLLECTED.
  • The market holds auction cash, but the router runs an implementation that would close its record without releasing that cash: ROUTER_UPGRADE_REQUIRED.

Response Fields

object

Proceeds Distribution

The market keeps at most what the position owed when it was seized, plus a penalty. The penalty is liquidationPenalty on a health liquidation and the loan’s term penalty on a term realization. Within that cap, cash first makes the pool whole on the record’s claim. It then repays anything the insurance fund advanced for this record. What remains of the seized slice’s penalty is pool income, and cash above the slice’s own cap pays down debt the loan still carries. Anything above the cap is surplus and belongs to the borrower. Surplus is pushed directly to the borrower’s wallet. If the settlement token (stablecoin) refuses that transfer, for example on compliance grounds, the market escrows the amount against the borrower’s address. The settlement does not revert. The borrower claims it later with Claim Surplus. Settlement therefore always completes, whether or not the borrower can currently receive funds. When the proceeds fall short of the record’s claim, the shortfall is recorded as slippage on the router’s settlement event. The market then asks its insurance fund for the gap in the same transaction and books what the fund pays against the record. A fund that is empty or refuses the market covers nothing, and the settlement still completes. Only principal that neither the sale nor the fund covers is the pool’s loss, reported as settlement.shortfall. A record that is never settled draws on the fund the same way when Handle Liquidation Timeout writes it off after 7 days. Cash that reaches a record the market already settled or wrote off, for example after a reopen, counts as late proceeds. It makes the pool whole on the claim first and then repays what the insurance fund advanced.

Error Codes

Confirming with txHash can also return any transaction verification error. A settlement that reverted on-chain is refused there with TX_REVERTED.