# Mechanism

### How Loss Buffer Vault Works

**When the trader loses (pool wins)**

* The pool receives the loss (collateral from the position).
* A **configurable percentage** of that amount is sent to the **Loss Buffer Vault** instead of going entirely to the main vault liquidity.
* This **builds the buffer** that will later cover trader profits.

⠀**When the trader wins (pool loses)**

* The pool would normally pay the profit from reserved/collateral.
* If the **Loss Buffer Vault has balance**, up to the profit amount (capped by available vault balance and by what’s actually being paid) is **withdrawn from the vault** and used to cover that payout.
* The rest of the payout still comes from the pool (reserved/liquidity) as before.
* So the vault **softens** the hit to LPs when traders are profitable.

⠀

### Where it applies

* **Decrease / close position** — On position decrease/close, if the trader has profit, the vault can cover part of it; if the trader has loss, a percentage of that loss is deposited into the vault.
* **Liquidation** — When a position is liquidated, a **configurable percentage** of the trader’s loss (the part that goes to the pool) can be sent to the Loss Buffer Vault instead of 100% to main liquidity.
* So both “normal” exits and liquidations feed and use the buffer.

⠀

### Parameters

* **Loss percentage** (e.g. on decrease) — Share of **pool profit** (trader loss) that is sent to the vault.
* **Liquidation percentage** — Share of **trader loss** in a liquidation that is sent to the vault.
* **Enabled flag** — The vault can be turned off so all flows go to/from the main vault only.

### Safety and caps

* Withdrawals from the vault are limited to what’s **actually needed** for the current payout and never exceed the vault’s balance.
* Deposits are capped by the amount actually available (e.g. the pool’s share of the loss).
* So the vault never creates new value; it only **redistributes** between “main LP liquidity” and “buffer” to smooth volatility.

### Summary

* **Loss Buffer Vault** = protection layer for LPs that **decreases volatility**.
* **Trader loses** → a percentage is **deposited** into the vault (builds the buffer).
* **Trader wins** → the vault **covers** part of the payout when it has balance.
* Used on **position decrease/close** and **liquidations**, with separate configurable percentages.
* **Governance** can enable/disable and set percentages per collateral vault.
