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

# Return Curves

> How Tranching maps utilization to Senior and Junior return allocation

***

Tranching markets do not use a fixed yield split. The market calculates utilization, then applies a return curve to determine how much Senior-side residual yield is paid to Junior for providing first-loss protection.

$$
\text{juniorReturnShare} = f(U)
$$

The Senior share is the remainder:

$$
\text{seniorReturnShare} = 1 - \text{juniorReturnShare}
$$

All examples below use NAV units and ignore protocol fees for clarity.

## Point Curve

The point curve is stored onchain as a `PiecewiseLinearCurve`. It defines explicit utilization points and Junior return shares. Between initialized points, the program linearly interpolates.

If utilization `U` is between two initialized points `(U_0, J_0)` and `(U_1, J_1)`, then:

$$
J(U) = J_0 + (J_1 - J_0) \times \frac{U - U_0}{U_1 - U_0}
$$

Where:

| Term         | Description                                                  |
| ------------ | ------------------------------------------------------------ |
| `U`          | Current utilization, clamped to `1.0` for return calculation |
| `J(U)`       | Junior return share at utilization `U`                       |
| `U_0`, `U_1` | Lower and upper initialized utilization points               |
| `J_0`, `J_1` | Junior shares at those points                                |

Example point set:

| Utilization | Junior return share |
| ----------- | ------------------- |
| 50%         | 20%                 |
| 90%         | 45%                 |
| 100%        | 70%                 |

At 70% utilization:

$$
J(70\%) = 20\% + (45\% - 20\%) \times \frac{70\% - 50\%}{90\% - 50\%} = 32.5\%
$$

If residual Senior-side gain is `100`, Junior receives `32.5` and Senior receives `67.5`.

## Utilization-Guided Curve

The utilization-guided curve starts from a target Junior share at 90% utilization and lets that target shift over time while the market is in the Normal State.

The target utilization is fixed at:

$$
U^* = 90\%
$$

The curve first measures signed distance from target:

$$
\begin{aligned}
d(U) &= \frac{U - U^*}{U^*}, && U \le U^* \\
d(U) &= \frac{U - U^*}{1 - U^*}, && U > U^*
\end{aligned}
$$

`d(U)` is negative below target and positive above target.

While the market is in the Normal State, the target Junior share shifts with time:

$$
S = s \times d(U)
$$

$$
T_{\text{next}} = \text{clamp}(T_{\text{current}} \times e^{S \times \Delta t}, T_{\text{min}}, 1)
$$

The contract also computes the midpoint target:

$$
T_{\text{mid}} = \text{clamp}(T_{\text{current}} \times e^{S \times \Delta t / 2}, T_{\text{min}}, 1)
$$

Then it uses Simpson averaging for the target used in the current return calculation:

$$
T_{\text{avg}} = \frac{T_{\text{current}} + 4 \times T_{\text{mid}} + T_{\text{next}}}{6}
$$

Where:

| Term        | Description                                |
| ----------- | ------------------------------------------ |
| `T_current` | Current Junior share at target utilization |
| `s`         | `maxTargetShiftSpeed`                      |
| `d(U)`      | Signed distance from target utilization    |
| `Δt`        | Seconds since the previous target shift    |
| `T_min`     | Minimum allowed target Junior share        |

The final Junior share applies either the low-utilization discount or full-utilization premium:

$$
J(U) = \text{clamp}(T_{\text{avg}} + d(U) \times A, 0, 1)
$$

Where `A` is `zeroUtilizationJuniorShareDiscount` when `d(U) < 0`, and `fullUtilizationJuniorSharePremium` when `d(U) >= 0`.

If the market is in the Recovery Period, the target does not shift. In that case, `T_avg` and `T_next` both equal `T_current`.

<Note>
  Onchain sync mutates `junior_share_at_target_utilization` and `last_target_shift_ts`. SDK read previews use the loaded target value without advancing this time-shift state.
</Note>

## Waterfall Examples

### Loss transfer

Assume Senior has `800` raw NAV and Junior has `200` effective NAV protecting Senior.

| NAV loss | Junior result                                  | Senior result                     |
| -------- | ---------------------------------------------- | --------------------------------- |
| `120`    | Junior absorbs `120`; Junior NAV falls to `80` | Senior remains whole              |
| `260`    | Junior absorbs `200`; Junior NAV falls to `0`  | Senior absorbs the remaining `60` |

As long as the loss fits inside available Junior protection, Senior remains whole. After Junior protection is exhausted, residual loss reduces Senior effective NAV.

### Gain distribution

Assume Senior has `20` of unrecovered impermanent loss, Junior has `30` of unrecovered impermanent loss, Senior-side gain is `100`, and the curve returns a 40% Junior share.

| Step                | Amount | Result                                     |
| ------------------- | ------ | ------------------------------------------ |
| Recover Senior loss | `20`   | Senior impermanent loss becomes `0`        |
| Recover Junior loss | `30`   | Junior impermanent loss becomes `0`        |
| Split residual gain | `50`   | Junior receives `20`; Senior receives `30` |

Gains repair outstanding loss balances before they become distributable yield. Only the residual amount is split by the return curve.
