Losses and recovery

Download Markdown

This page explains what the vault program does with a loss: who absorbs it, when the vault changes state, what you can still do, and how money that comes back is shared. For worked scenarios on real protocols, see When a protocol fails.

Terms used on this page

  • Loss waterfall. The order in which tranches absorb a loss: Junior first, then Senior.
  • Impairment. A loss that has reached a tranche and is being tracked so it can be repaid if value comes back. Senior has its own impairment, and Junior has a separate one for incident losses.
  • Mark. A ceiling the guardian or admin puts on a leg's value with mark_leg_impaired, when the protocol's own report can no longer be trusted.
  • Recovery. A vault state for handling an incident. New money stops; exits may continue.
  • Frozen. A condition inside Recovery in which no withdrawal can be funded.
  • Settlement. The final wind-down, in which all cash is paid out, Senior first.

The loss waterfall

What. A recognised loss L is split between the tranches like this, where J is Junior's value:

Junior loss = min(L, J)
Senior loss = L − Junior loss

Why. Junior holders accept the first loss in exchange for a share of Senior's yield, called the premium (see Yield allocation). That trade is what makes Senior safer.

How. A loss is recognised when a refreshed leg reports a lower value, or when a leg is marked down. The next update of the vault's books (sync_vault, or the same step inside a deposit, a withdrawal funding or an allocation) books it. Any profit still locked by profit smoothing absorbs the loss first (see profit smoothing).

Example. Suppose a vault holds 80,000 USDC of Senior and 20,000 of Junior, with no locked profit. Each row is a separate case.

Recognised loss (USDC)Senior remainingJunior remainingSenior impairment
5,00080,00015,0000
20,00080,00000
25,00080,000 − (25,000 − 20,000) = 75,00005,000

Table: Junior absorbs every loss up to its full value; only the excess reaches Senior and is recorded as Senior impairment.

When a loss opens an incident

A loss moves an Active vault into Recovery if any of these is true:

  1. Part of the loss reaches Senior.
  2. The loss booked in one update is larger than the vault's incident threshold, a share of the booked tranche value. A basis point is 0.01%. The program's default is 25 basis points, which is 0.25%, and the curator can set it up to 10,000 basis points, which is 100%.
  3. The guardian or admin marks a leg with mark_leg_impaired.

When it happens, the program emits IncidentEntered. From then on, Junior's share of each loss is added to Junior's impairment, so it can be repaid if the value comes back.

Example. With 80,000 Senior and 20,000 Junior and the default threshold, the threshold is 0.25% of 80,000 + 20,000 = 100,000, which is 100,000 × 0.0025 = 250 USDC. A 200 USDC loss is an ordinary bad day and the vault stays Active. A 300 USDC loss opens an incident.

An impairment mark records a lower value; it does not mean the vault received cash. For example, a leg valued at 10,000 USDC might be marked at 4,000 while the recoverable amount is investigated.

The vault's states

stateDiagram-v2
    [*] --> Draft: create_vault
    Draft --> Active: activate_vault
    Active --> Recovery: incident (see above)
    Recovery --> Active: resume
    Active --> Settlement: begin_settlement
    Recovery --> Settlement: begin_settlement
    state Recovery {
        [*] --> Open
        Open --> Frozen: Senior impaired, or Senior short at the low band
        Frozen --> Open: Senior repaid and the low band covers Senior
    }

Figure: the vault's life cycle, with the frozen condition shown inside Recovery.

StateDepositsNew allocationsWithdrawal requestsWithdrawal funding
DraftNoNoNoNo
ActiveYesYesYesYes
Recovery, openNo (VaultNotActive)NoYesYes, if coverage allows
Recovery, frozenNoNoYesNo (VaultFrozen)
SettlementNoNoNoNo; use settle_shares

Table: what each vault state allows.

Restrictions in Recovery

What. Recovery stops deposits and new allocations. Exits from legs (deallocate) still work, so the executor can raise cash.

Why. New money should not enter a vault whose value is uncertain, and nobody should profit from buying in during an incident.

How. Withdrawals in Recovery are priced at the cautious low band, where every impaired leg counts as 0. Two extra rules apply:

  • Frozen. The program refuses funding (VaultFrozen) when Senior's impairment is above 0, or when Senior's value at the low band is below its booked value. In that case even Senior cannot be paid, because paying one Senior holder in full would leave the others with less.
  • Junior coverage. A Junior withdrawal must still leave Junior at least the vault's minimum coverage (CoverageViolation). After a large loss there is usually no room.

Example. Suppose a vault holds 4,000 USDC of Senior and 1,000 of Junior, and its minimum coverage (Junior's minimum share of the total) is 20%. A 600 USDC loss leaves Junior at 1,000 − 600 = 400. Senior holders can still leave at full value, because Senior is not impaired. Junior holders cannot, because coverage is 400 ÷ (400 + 4,000) = 400 ÷ 4,400, about 9%, below the 20% minimum.

USDC already funded is different from an unfunded request. Funded USDC sits in the payout account and is always claimable, whatever the state.

How returned value is shared

What. When value comes back, it repays the incident's losses before anything counts as profit.

How. When the vault books a gain, it applies it in this order:

  1. It restores Senior's impairment, until Senior is whole.
  2. It restores Junior's impairment, if the gain counts as recovery.
  3. Anything left is ordinary profit, split on the premium curve.

What counts as recovery depends on the state:

  • During Recovery, every gain counts as recovery until both impairments are repaid, whichever leg it comes from. A healthy leg's interest, a dip that comes back, and cash from a marked leg all repay Senior first, then Junior.
  • Outside Recovery, only value returned by an impaired leg (above its mark) counts as recovery.

Example. Suppose Senior has 5,000 USDC of impairment and Junior has 20,000 of incident losses, and the vault is in Recovery. 8,000 USDC of value comes back, from any source:

First 5,000Next 3,000
Goes toSenior impairment, now 5,000 − 5,000 = 0Junior impairment, now 20,000 − 3,000 = 17,000

Table: during Recovery, returned value repays Senior first and then Junior before any profit is split.

A higher mark and cash received are different events. A mark can only be raised through the timelock (a queued RaiseMark change), and the raise is booked as recovery. See A hack the protocol has not reported.

Leg modes during an incident

stateDiagram-v2
    [*] --> Active: add_leg
    Active --> CloseOnly: set_leg_close_only
    CloseOnly --> Active: UpdateLeg (timelocked)
    Active --> Suspended: suspend_leg
    CloseOnly --> Suspended: suspend_leg
    Suspended --> Active: unsuspend_leg (if it was Active)
    Suspended --> CloseOnly: unsuspend_leg (if it was CloseOnly)
    Active --> Impaired: mark_leg_impaired
    CloseOnly --> Impaired: mark_leg_impaired
    Suspended --> Impaired: mark_leg_impaired
    Impaired --> CloseOnly: RaiseMark to the position (timelocked)
    Impaired --> Retired: retire_leg (value 0)
    Active --> Retired: retire_leg (value 0)
    CloseOnly --> Retired: retire_leg (value 0)
    Retired --> [*]

Figure: the modes a leg can be in, and the instructions that move it between them.

ModeTakes new moneyCan be emptiedMust be freshValued at
ActiveYesYesYesIts report
CloseOnlyNo (LegCloseOnly)YesYesIts report
SuspendedNo (LegSuspended)Yes, if the protocol answersNoIts last report
ImpairedNoYesNoThe lower of its report and its mark, with a low value of 0
RetiredNoNothing leftNo0

Table: what each leg mode allows.

Returning to Active

The admin calls resume once both of these hold (RecoveryNotFinished otherwise):

  1. No leg is impaired. Each impaired leg was either retired with retire_leg, which needs it to be empty with no action in flight, or had its impairment lifted by a RaiseMark up to its position.
  2. Senior's impairment is 0.

Suspended legs do not hold Recovery up.

resume resets Junior's impairment to 0. Any Junior incident loss not repaid by then becomes permanent. Resuming does not promise that Junior has been made whole.

Example. Junior lost 600 USDC in an incident and 300 has come back. When the admin resumes, the remaining 600 − 300 = 300 is written off, and from then on gains are split normally.

Settlement

What. The admin can put an Active or Recovery vault into Settlement with begin_settlement, to wind it down. It cannot be undone.

How.

  1. Ordinary deposits, new withdrawal requests and withdrawal funding stop.
  2. The program fixes each tranche's entitlement: Senior's is its value plus its impairment, and Junior's is its value plus its impairment. It also fixes both share supplies.
  3. The executor unwinds the legs into cash, and anyone calls distribute_settlement_cash.
  4. Cash is counted cumulatively. Senior is paid up to its entitlement first, then Junior up to its own. Anything above both is split on the premium curve.

Example. Suppose the entitlements are 80,000 USDC for Senior and 20,000 for Junior. A first distribution of 50,000 pays Senior 50,000 and Junior 0. A later distribution of 40,000 brings the total to 50,000 + 40,000 = 90,000: Senior gets its remaining 80,000 − 50,000 = 30,000, and Junior gets the other 90,000 − 80,000 = 10,000.

In the app, Collect calls settle_shares. It converts your share tokens into a SettlementClaim and pays what is currently due to it. The claim stays open, so you can collect again after later distributions, by calling settle_shares with 0 shares. Share tokens remain transferable until you convert them.

For an existing withdrawal request, cancel its unfunded part to get the shares back for settlement. USDC already funded remains a separate, claimable amount.

Review liquidity and permissions alongside these rules.

Advanced details

  • If one tranche has no shares at all when cash is distributed, all cash goes to the other tranche.
  • A vault in Settlement no longer books gains or losses, because entitlements are fixed.
  • A mark is refused in Settlement (VaultNotActive), and only role changes and RepinAdapter can be executed then.

On this page