Skip to main content
The API and the contracts call it the insurance fund. It is a default reserve bound to one market: not a guarantee, and not insurance. It absorbs a shortfall ahead of the liquidity providers, but only up to what it holds. A draw larger than the balance pays the balance, and the pool books the rest.

Read the fund

stats.currentBalance is what the fund can pay today. marketAuthorized says whether the fund covers this market at all: an unauthorized market gets no coverage, and its protocol-fee sweep reverts. It also reads false when the read failed, so a false is not proof of a withdrawn authorization. Read marketBadDebt beside the fund, because a fund that covered nothing and a market that never took a loss otherwise look the same. borneByProviders is the loss the liquidity providers carried. earmarkedProtocolFees is protocol fee the market booked for the fund and has not swept yet, so an empty fund can still have money waiting. The fees page sweeps it. disclosure holds plain-language statements written to be shown to liquidity providers as they are. The market draws on the reserve on every first settlement that retains less than the record’s claim. It also draws on it on the write-off after the 7-day window, and for the residual of an instant whole-position realization. generation.settlementDrawsReserve reads true, or null when it could not be read. A fund whose owner withdrew this market’s authorization pays nothing and blocks nothing, so the whole loss lands on the pool.

Top up the fund

A top-up is a one-way transfer. The wallet that sends it receives no shares, holds no claim on the fund, and nothing is owed back to it. Money leaves the fund only as coverage paid to a market it authorizes, or through a withdrawal by the fund owner.
Any wallet may top up, whether the operator funding its own reserve or a third party standing behind the pool. The plan approves the fund to pull the settlement token (stablecoin), then calls the fund’s topUp. The SDK fills fromAddress from the signer, signs both steps in order, and records the top-up with the topUp step’s hash.
amount is a decimal string in the borrow asset. The API checks that the wallet holds enough before offering anything, and refuses a short balance with INSUFFICIENT_BALANCE. To sign in your own environment, prepare with fromAddress, which the SDK requires when there is no signer. Both steps must come from that wallet, because the fund pulls from the sender of topUp and records it as the source. Confirm with the topUp step’s hash and the same amount and fromAddress.
Recording reads the receipt, not the calldata, so a top-up signed outside this API can be recorded too. duplicate: true means the hash was already recorded for the same amount, so the call is safe to repeat. A booked top-up nobody records is still picked up when the fund status is read, if it falls within the last 50,000 blocks.

Withdraw from the fund

Every unit withdrawn is a unit the reserve can no longer pay toward this market’s losses, and whatever the reserve cannot cover lands on the liquidity providers. The API checks the amount against the balance when it builds the transaction. A draw that lands before the withdrawal mines can make it revert.
Only the fund owner signs: the admin the lender of record named when it took the role. Before a lender of record takes the market, the market itself or the deploying factory owns the fund, and no wallet can withdraw.
With a signer, the SDK checks that the signer is the prepared fundOwner before it signs. When the owner could not be read, it refuses with FUND_OWNER_UNREADABLE and a status of 503, and nothing is signed. A fund on the role-model generation, withdrawalNotice.supported on the status, pays out only after a seven-day notice. The owner announces the amount and recipient with action: 'propose', executes the same amount to the same recipient with action: 'execute' once withdrawalNotice.ready is true, within seven days, and can withdraw the announcement with action: 'cancel', which takes no amount.
On such a fund each signed step is confirmed with the API, which reads the receipt and answers action, amount, recipient and, for an announcement, activatesAt. To confirm a step you broadcast yourself, pass { txHash } with the same action. A fund without the notice withdraws at once with the default execute, has no confirm leg and records nothing: with a signer the result is { transactions } only, and once the withdrawal mines stats.totalWithdrawn and stats.currentBalance reflect it. Without options the method returns the unsigned transaction under calldata, with fundOwner, fundAddress, currentBalance and notice beside it.

Methods and endpoints