> For the complete documentation index, see [llms.txt](https://docs.tapir.money/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tapir.money/protocol-mechanics/tapir-mechanics/depeg-risks-splitting.md).

# Depeg Risk Splitting

Depeg risk splitting is the core mechanism of Tapir Protocol. It allows you to decompose exposure to a yield-bearing asset into two complementary positions — **protection** and **yield** — by splitting a base asset into DP and YB tokens. Here "depeg" covers any loss in the asset's oracle-measured value below its high watermark, whatever the cause.

{% hint style="info" %}
Named assets used in the worked examples below are illustrative only. They show the math and payoff shape, not a statement that a specific asset is currently live in production.
{% endhint %}

***

### The split mechanism

When you deposit a base asset (for example, 1 unit of an example yield-bearing token) into an active Tapir pool, the protocol mints two derivative tokens:

```
1 Base Asset  =  0.5 DP  +  0.5 YB
```

* **DP (Depeg Protected):** Gains value if the asset depegs.
* **YB (Yield Boosted):** Earns yield if the peg holds.

The split is deterministic and always follows the 1 : 0.5 : 0.5 ratio. There is no AMM slippage or price impact on the split itself. In the contract's smallest token units, each leg is `floor(deposit / 2)`, so an odd deposit can leave one unit of rounding dust in the pool.

You can also **unsplit** during the Active stage while the pool is unpaused — burn equal amounts of DP and YB to reclaim the base asset (minus applicable fees).

***

### Conservation of value

Tapir enforces a fundamental invariant:

<figure><img src="https://290230942-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ffs2icldWo64X9laOubjf%2Fuploads%2Fgit-blob-34e7c712b2ac5b2ca1c67e72cafc8b922047f0b3%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

In text: `dpValue + ybValue = 20,000 basis points`. The combined gross redemption value of one DP token and one YB token equals two base tokens (the original deposit). No value is created or destroyed — it is only redistributed between the two sides based on whether a depeg occurred.

This limits aggregate contractual claims to the deposited base-token amount. It does not guarantee that the base asset retains its external value or remove token, contract, or administrative risks.

#### Two ways to read payout numbers

Docs and UI express depeg outcomes in two frames — keep them apart when comparing numbers:

* **Per-token redemption (token frame):** how many base tokens one DP or YB redeems for. On a depeg, DP's per-token redemption *rises* (up to 200%) and YB's falls (down to 0%). The tables on this page and the DP/YB pages use this frame.
* **Value vs. original deposit (value frame):** what your position is worth relative to what you deposited, after the base asset's own price drop. Ignoring fees and rounding, DP's rising redemption amount offsets the oracle-measured drop through the 50% coverage range, while YB loses up to 2× that drop in value terms. This comparison uses the HWM reference and excludes entry premiums; it does not guarantee the value of your original purchase.

Both descriptions are the same math: for a depeg of size `d`, DP redeems `1/(1−d)` tokens' worth (capped at 2×), each now worth `(1−d)` of the pre-depeg price.

***

### Pool lifecycle

Each pool progresses through four stages in sequence:

#### 1. Active

During the Active stage, you can:

* **Split** base assets into DP + YB tokens.
* **Unsplit** (burn DP + YB) to reclaim base assets.
* **Trade** DP and YB on the AMM.
* **Provide liquidity** to the DP/YB trading pool.

The pool's oracle tracks the asset price throughout this stage.

#### 2. Cooldown

When the Active stage ends, the pool enters Cooldown:

* Pool splitting, unsplitting, and redemption are unavailable. Transfers and direct swaps on external AMMs are not automatically stopped by this state change.
* An authorized oracle operator submits final price data through the configured oracle: a **High Watermark (HWM)** price and a **Closing Price**.
* Cooldown and minimum price age provide delays before final settlement; they reduce timing risk but do not guarantee correct data.

#### 3. Resolution

After cooldown elapses and submitted price data reaches `minPriceAge`, anyone can trigger resolution:

* The smart contract compares the HWM and Closing Price to determine if a depeg occurred.
* DP and YB redemption values are calculated and locked on-chain.

#### 4. Redemptions

Once resolved, you can redeem your DP and YB tokens for the base asset at the fixed rates while the pool is unpaused. Maturity alone does not open redemption. Both cooldown duration and minimum price age are configurable between four hours and 30 days. See [Redeem](https://docs.tapir.money/system-workflow/redeem.md) for timing and collateral-rescue controls.

```
Active  ──▶  Cooldown  ──▶  Resolution  ──▶  Redemptions
 Split       Oracle          Depeg calc       Redeem DP/YB
 Trade       submits         dpValue set      for base
 LP          prices          ybValue set      asset
```

***

### Depeg detection

The oracle determines whether a depeg occurred by comparing two reference prices:

* **High Watermark (HWM):** The maximum of the persisted lifetime HWM and `max(min(triplet))` over daily representative prices in the current buffer. A triplet needs three observed UTC days; it does not prove continuous price stability for 72 hours.
* **Closing Price:** The median of daily representatives derived from recent raw checkpoints selected by the configured lookback. The selection requests at least five raw checkpoints, using fewer if unavailable; it is not necessarily five days or limited to pre-maturity observations. See [Oracle Resolution](https://docs.tapir.money/protocol-mechanics/tapir-mechanics/oracle-resolution.md).

A depeg is detected when the Closing Price is below the HWM by at least `floor(HWM × 10 / 10,000)` — nominally **0.1%**, rounded down at the configured price scale:

<figure><img src="https://290230942-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ffs2icldWo64X9laOubjf%2Fuploads%2Fgit-blob-5a880fb4005f5b4f904fb370c6d7b525e1dd4777%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

The threshold filters small differences, subject to integer rounding. The examples below assume one checkpoint per day, selection of the latest five checkpoints for closing, and no higher persisted HWM.

#### Worked example: no depeg

For a yield-bearing asset with monotonically increasing price:

| Day | Price |
| --- | ----- |
| 1   | 1.00  |
| 2   | 1.01  |
| 3   | 1.02  |
| ... | ...   |
| 10  | 1.09  |

* **HWM** = `max(min(triplet))` = 1.07 (from triplet 1.07, 1.08, 1.09)
* **Closing Price** = median of last 5 = 1.07

Since Closing Price >= HWM, **no depeg** is detected.

#### Worked example: end-of-pool crash absorbed by median smoothing

| Day | Price |
| --- | ----- |
| -10 | 4.00  |
| -9  | 4.00  |
| -8  | 5.00  |
| -7  | 5.00  |
| -6  | 6.00  |
| -5  | 6.00  |
| -4  | 6.00  |
| -3  | 7.00  |
| -2  | 10.00 |
| -1  | 1.00  |

* **HWM** = `max(min(triplet))` across all triplets. The triplet (5, 6, 6) yields min = 5; (6, 6, 6) yields min = 6; (6, 6, 7) yields min = 6; (6, 7, 10) yields min = 6 — so **HWM = 6**.
* **Closing Price** = median of last 5 prices \[6, 6, 7, 10, 1] = sorted \[1, 6, 6, 7, 10] = **6**.

In this case Closing Price = HWM, so **no depeg** is triggered despite the day -1 crash — the median smoothing absorbs the short-term spike.

***

### Depeg outcome scenarios

Once a depeg is detected, the protocol calculates the **depeg size** as the percentage drop from HWM to Closing Price. This determines how value is redistributed between DP and YB.

#### Scenario 1: No depeg

**Condition:** Price drop is below the rounded minimum threshold (or Closing Price >= HWM).

| Token | Value            | Redemption    |
| ----- | ---------------- | ------------- |
| DP    | 100% (10,000 bp) | 1 DP = 1 base |
| YB    | 100% (10,000 bp) | 1 YB = 1 base |

Both tokens redeem at par before fees. If you split 1 unit of the base asset into 0.5 DP + 0.5 YB, you get back exactly 1 unit of the base asset (minus fees).

#### Scenario 2: Small depeg (5%)

**Condition:** Closing Price = 95% of HWM.

<figure><img src="https://290230942-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ffs2icldWo64X9laOubjf%2Fuploads%2Fgit-blob-7426c7d599bc5b730b875398487405f092085586%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

| Token | Value   | Per 100 tokens |
| ----- | ------- | -------------- |
| DP    | 105.26% | 105.26 base    |
| YB    | 94.74%  | 94.74 base     |

The DP redemption amount rises by about 5.26% in base-token units; YB's falls by the same amount. These are not returns on an AMM purchase or returns in dollars.

#### Scenario 3: Medium depeg (20%)

**Condition:** Closing Price = 80% of HWM.

<figure><img src="https://290230942-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ffs2icldWo64X9laOubjf%2Fuploads%2Fgit-blob-c5cb139fa0f6e5517ef8ef579bc17798b9f691eb%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

| Token | Value | Per 100 tokens |
| ----- | ----- | -------------- |
| DP    | 125%  | 125 base       |
| YB    | 75%   | 75 base        |

#### Scenario 4: Severe depeg (50%+)

**Condition:** Closing Price <= 50% of HWM.

<figure><img src="https://290230942-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ffs2icldWo64X9laOubjf%2Fuploads%2Fgit-blob-34a1cf60f2d916a54474580ee37be9262b0b7dc0%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

| Token | Value          | Per 100 tokens |
| ----- | -------------- | -------------- |
| DP    | 200% (capped)  | 200 base       |
| YB    | 0% (worthless) | 0 base         |

DP reaches its maximum redemption amount of two base tokens per DP. YB redeems for zero. The cap limits aggregate claims to the deposited base-token amount; it does not ensure the remaining collateral's dollar value or availability.

***

### Fee structure

There is **no fee on splitting**. Tapir pools apply a single pool-level fee:

#### Redemption fee

* Applied on every unsplit or redeem transaction.
* Rate: 0–255 basis points, i.e. up to 2.55%. A pool admin or operator can change it, including after maturity; check the current rate before exiting.
* Formula: `redemptionFee = (amount × redemptionFeeBp) / 10,000`

All fees accumulate in the pool contract and are swept to the protocol treasury. (Swap fees on the AMM are separate and accrue to liquidity providers.)

***

### What's next?

* [DP (Depeg Protected)](https://docs.tapir.money/protocol-mechanics/tapir-mechanics/depeg-risks-splitting/dp.md) — The protection token and its redemption mechanics.
* [YB (Yield Boosted)](https://docs.tapir.money/protocol-mechanics/tapir-mechanics/depeg-risks-splitting/yb.md) — The yield token and its risk profile.
