Skip to main content
POST
Closes a liquidation’s record on the router after the market has already settled or written off its own record, when nothing is left to sell or forward. It calls the router’s writeOffLiquidation, which only the router administrator, the holder of DEFAULT_ADMIN_ROLE on the router, may sign. Close is not a settlement. It moves no collateral and no cash, and it books no loss, because the market has already recognized the outcome. It only releases the router’s record, so the router’s count of open records falls and its quiet-state check can pass again. Despite its on-chain name, writeOffLiquidation writes nothing off: the market-side write-off is Handle Liquidation Timeout, and the leg that forwards proceeds is Settle Liquidation.

When It Applies

A router record stays open until something closes it on the router side. When the market’s own record is already closed, the router record collected nothing, it holds no collateral, and none of its collateral went out to the sale recipient, there is nothing left to settle. Two cases are typical: a record whose remainder went back to the borrower, and a record the market wrote off after its 7 day timeout whose router record is still open with nothing on it. Collateral that went out to the sale recipient is not realized until its proceeds are reported. Such a record is settled with the sale proceeds through Settle Liquidation, so the debt is repaid and anything above the debt and the disclosed penalty reaches the borrower. Closing it instead would end the realization with no proceeds and nothing for the borrower, so it is refused with COLLATERAL_OUT_FOR_SALE. The router’s own writeOffLiquidation does not make this distinction; the check is read from the router’s CollateralWithdrawnForSale logs. Each condition below must hold, and each is checked before any calldata is built. The second column names the refusal when it does not.
A record the market wrote off after its 7 day timeout is accepted while its router record is open. Get Pending Liquidations lists it with writtenOff: true. A settled record, or a written-off record whose router record is closed, is refused with ALREADY_SETTLED. When the router record cannot be read, the answer is 503 ROUTER_UNREADABLE. A confirm call with txHash skips this check.

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. A value longer than 100 characters is ignored.
string
Hash of the transaction you broadcast for this operation. 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.

Response Fields

object
Confirming moves every open record under this ID on the market to SETTLED. A reopened record keeps the hash of its earlier settlement in settledTxHash. A written-off record keeps WRITTEN_OFF, though the confirm response reads status: SETTLED.

Error Codes

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