> ## Documentation Index
> Fetch the complete documentation index at: https://docs.derive.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Liquidations 

Liquidations are local to a risk universe: the auction and the Security Module backstopping it all belong to the universe the liquidated subaccount sits in.

## Auction Parameters

These are **global** and shared by all four universes.

| Parameter                   | Contract Variable                             | Value                | Description                                                                                                                                    |
| --------------------------- | --------------------------------------------- | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| BUFFER\_SCALE               | `auction_params.buffer_margin_pct`            | 1.2                  | `Buffer Margin = MtM + BUFFER_SCALE x (Maintenance Margin - MtM)`. The buffer sits a fifth of the margin requirement below maintenance margin. |
| INITIAL\_DISCOUNT\_FACTOR   | `auction_params.starting_mtm_pct`             | 0.98                 | The price factor the solvent auction starts at: bidders pay 98% of mark-to-market, a 2% discount.                                              |
| THRESHOLD\_DISCOUNT\_FACTOR | `auction_params.fast_auction_cutoff_pct`      | 0.80                 | The price factor at the end of the fast phase, a 20% discount.                                                                                 |
| SHORT\_DURATION             | `auction_params.fast_auction_length_sec`      | 1,200 s (20 minutes) | Duration of the fast phase, over which the price factor falls linearly from 0.98 to 0.80.                                                      |
| LONG\_DURATION              | `auction_params.slow_auction_length_sec`      | 43,200 s (12 hours)  | Duration of the slow phase, over which the price factor falls linearly from 0.80 to 0.                                                         |
| INSOLVENT\_DURATION         | `auction_params.insolvent_auction_length_sec` | 3,600 s (1 hour)     | Duration over which the insolvent auction offer moves from `min(0, MtM)` to the current maintenance margin.                                    |
| LIQ\_FEE\_PERCENT           | `auction_params.liquidator_fee_rate`          | 0.05 (5%)            | The liquidation fee, charged on the fraction of the account liquidatable at zero discount.                                                     |
| MTM\_CUTOFF                 | `auction_params.mtm_cutoff`                   | 0                    | Mark-to-market level below which the auction is treated as insolvent.                                                                          |

The solvent auction price factor is

```python Formula theme={null}
d(t) = 0.98 - (0.98 - 0.80) * t / SHORT_DURATION                    for t <= SHORT_DURATION
d(t) = 0.80 - 0.80 * (t - SHORT_DURATION) / LONG_DURATION           thereafter
```

and the fee is

```python Formula theme={null}
Liquidation Fee = LIQ_FEE_PERCENT * f_max(1.0) * MtM Value
f_max(1.0)      = Buffer Margin / (Buffer Margin - MtM Value)
```

`f_max` is rounded up to the nearest 1% before the fee is computed.

## Termination

A bid does not clear, and the auction terminates, if either holds at the time of the bid:

| Condition                     | Meaning                                                            |
| ----------------------------- | ------------------------------------------------------------------ |
| `Buffer Margin >= 0`          | The account is back above water. `Max Percentage` is clamped to 0. |
| `Reserved Funds >= MtM Value` | The bid price `(MtM - Reserved) x d` is no longer positive.        |

## Security Module and Socialization

Every universe has its **own** Security Module: a dedicated subaccount holding that universe's cash asset. An insolvency in one universe cannot draw on another universe's backstop.

| Parameter                                | Value                         | Description                                                                                                                              |
| ---------------------------------------- | ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| SM subaccount (Prime / Hype / Alt / RWA) | 68176 / 68177 / 68178 / 68179 | The Security Module subaccount per universe on the current deployment.                                                                   |
| SM\_FEE                                  | 20%                           | Share of interest paid to positive cash holders that is diverted to the universe's Security Module. Rises to 100% if the SM is depleted. |
| DT\_WRITE\_DOWN\_SECONDS                 | 900 s (15 minutes)            | The window over which the maintenance margin impact of a socialization debit phases in.                                                  |

When the Security Module cannot cover an insolvent bid in full, the shortfall `H` is socialized across the universe:

```python Formula theme={null}
share_i     = H * mtm_i / total_spot_value
write_down  = clamp((now - issued_at) / DT_WRITE_DOWN_SECONDS, 0, 1)
MM credit_i = abs(debit_i) * (1 - write_down)
```

Cash is debited immediately and in full, so mark-to-market and initial margin feel it at once; maintenance margin is credited back and that credit decays to zero over 15 minutes. Accounts already under auction receive no credit. While the sweep is pending, every balance operation in that universe is rejected.


## Related topics

- [Liquidations](/liquidations.md)
- [public/get_liquidation_history](/api-reference/liquidations/publicget_liquidation_history.md)
- [Trading Fees on Derive: Maker, Taker, RFQ, and Liquidation](/integrators/trading/trading-fees.md)
