# Insurance Fund

The Insurance Fund module maintains an isolated, market-specific liquidity pool designed to backstop the Exchange module during extreme market volatility. By socializing the risk of bankrupt positions, the fund ensures that winning traders always receive their full payouts, maintaining the overall solvency of the derivative ecosystem.

## Market-Scoped Initialization

Unlike traditional liquidity pools that require an initial deposit to exist, Uniocean's Exchange module automatically initializes a dedicated insurance fund the moment a new derivative market is created. This fund starts with a zero balance and zero issued shares, natively keyed to the specific market ID without requiring manual intervention.

## Permissionless Underwriting and Share Minting

Capitalizing the insurance fund is a permissionless process called underwriting. When an underwriter deposits the market's specific quote asset into the module, they are minted dynamically generated Insurance Share Tokens.

The share issuance is strictly proportional to the current state of the pool. For a standard deposit *(D)*, the minted shares *(ΔS)* are calculated relative to the fund's total existing shares *(S\_total)* and current balance *(B)*:

$$
\Delta S = D \times \frac{S\_{total}}{B}
$$

In the event a pool is being capitalized from a completely zeroed state (zero balance and zero shares), the protocol establishes a baseline by minting a fixed initial supply of 10¹⁸ shares to the first depositor.

## Fund Growth and Utilization Mechanics

The Exchange module dynamically adjusts the insurance fund's balance during the liquidation and settlement lifecycle through direct state accounting.

* **Fund Growth (Positive Equity):** When a position is liquidated with collateral remaining, the insurance fund absorbs a fraction of the liquidated proportional margin. This contribution is not a flat percentage of the surplus, but rather a dynamically configured rate *(r\_insurance)* defined by the network parameters:

  $$
  Contribution = ProportionalMargin \times r\_{insurance}
  $$
* **Fund Utilization (Negative Equity):** If a position gaps past bankruptcy (negative equity), the Exchange module calculates the system shortfall. It then directly reduces the insurance fund's recorded balance by that exact amount to cover the deficit, keeping the overall market solvent.

## Redemption and EndBlocker Processing

To protect the market from sudden liquidity crunches, underwriter redemptions are subject to a global time-lock. When an underwriter requests a withdrawal, their share tokens are immediately escrowed in the module account, and a redemption schedule is created based on a globally defined notice period. The actual clearing of these requests occurs asynchronously during the chain's `EndBlocker` phase.

During `EndBlocker`, the protocol iterates through all pending redemption schedules. For any schedule that has mathematically matured, the protocol executes an atomic settlement:

1. **Value Calculation:** The protocol determines the exact quote asset payout based on the proportion of shares being redeemed *(ΔS)* against the pool's current state:

   $$
   RedeemAmount = \Delta S \times \frac{B}{S\_{total}}
   $$
2. **Execution:** The `RedeemAmount` is physically transferred from the Insurance module account to the user's wallet.
3. **State Cleanup:** The escrowed share tokens are permanently burned, the fund's global balance and total shares are decremented, and the processed schedule is deleted from the state machine.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://uniocean.gitbook.io/uniocean-docs/core-platform-modules/insurance-fund.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
