Tranche accounting

Junior capital is a count of reserve shares with its own exchange rate; losses burn those shares, exits wait a notice that grows with the queue, and interest is credited to each holder through growth indexes as it accrues.

Updated Nov 15, 2026

The exchange rate

The program records how many of the market's reserve shares belong to Junior LP, SJS_J, and how many jrLP exist, NJN_J, counting the permanent seed and jrLP waiting to exit. One jrLP is worth

x=SJNJx = \frac{S_J}{N_J}

reserve shares, which is the jrLP exchange rate. Junior swap fees that compound raise it and losses lower it. srLP stays one-for-one with every other reserve share, including the srLP inside the two hLP vaults, so with SS reserve shares in all, senior holds S−SJS - S_J.

Converting srLP into jrLP burns the srLP and mints jrLP at the current rate, checked against the holder's minimum; no asset moves. Both directions round down, so the remainder stays with the jrLP that remain:

j=⌊s NJSJ⌋jrLP for s srLPs=⌊j SJNJ⌋srLP for j jrLP\begin{aligned} j &= \left\lfloor \frac{s\,N_J}{S_J} \right\rfloor \quad \text{jrLP for } s \text{ srLP} \\ s &= \left\lfloor \frac{j\,S_J}{N_J} \right\rfloor \quad \text{srLP for } j \text{ jrLP} \end{aligned}

The first entry into an empty generation is one for one. An entry must be positive, at most the holder's balance and at most the senior shares S−SJS - S_J (AmountZero, InsufficientBalance), and must mint at least one jrLP and meet minimum_junior (InsufficientOutputAmount). Exit fees and jrLP burned outside the program move receipts to the seed without changing SJS_J or NJN_J, so the rate stays where it was.

Every convert_tranche call first accrues interest, folds any direct burns into the seed and brings the seed's and the holder's income up to date. It has no start-time check and works in reduce-only. The program also requires SJ≤SS_J \le S, a seed and a queue that fit inside NJN_J, and receipts wherever there is junior capital, failing with BrokenInvariant otherwise.

The junior tranche's value is J=⌊F SJ/S⌋J = \lfloor F\,S_J/S \rfloor, with FF the market's funded reserve value. The rate controller and the loss allocation below both read it.

The seed

At the first deposit, a thousandth of the creator's shares, after the permanently locked minimum liquidity and rounded up, becomes the junior seed. With GG the supply less the 1,000 locked shares, the seed takes ⌈G/1,000⌉\lceil G/1{,}000 \rceil shares as permanent receipts, entered one for one, and the creator is minted the rest of GG as srLP. The seed also collects every exit fee and any jrLP burned outside the program; the next convert_tranche or compound_junior_seed adds those burns to it.

Anyone can move the seed's credited interest into custody with fund_junior_seed and reinvest its balance with compound_junior_seed. Funding moves as much of the seed's interest as reserve cash covers into the reserve's fee custody as a seed balance; no tokens move, and it is not principal yet. Compounding adds liquidity from the seed's balances in both tokens, enters the new reserve shares at the current rate as permanent receipts and leaves any unmatched remainder in custody. It needs a positive srLP supply and a generation that is not wiped out (InsufficientLiquidity, InvalidArgument).

Reinvestment takes no slippage limit from the caller, so it only runs while the spot price PP is within 0.01% of the curve's centre average, the sticky centre's moving average mm:

⌈109 max⁡(P, m)min⁡(P, m)⌉−109≤105\left\lceil 10^9\,\frac{\max(P,\ m)}{\min(P,\ m)} \right\rceil - 10^9 \le 10^5

A larger gap fails with SlippageExceeded, and the check is skipped until the curve has been initialised. It stops a trade earlier in the same slot from pushing the price and having the seed add liquidity at the skewed ratio.

The exit notice

In a normal build, with QQ the jrLP waiting to exit, this request included, the notice is

T=7 days+3 days×QNJT = 7\ \text{days} + 3\ \text{days} \times \frac{Q}{N_J}

so a rush to the exit waits longer than a single holder leaving. A pending request cannot be increased or renewed in place, and its capital stays junior until conversion. In slots,

T=3,024,000+⌈1,296,000⋅QNJ⌉T = 3{,}024{,}000 + \left\lceil 1{,}296{,}000\cdot\frac{Q}{N_J} \right\rceil

QQ counts every open request, this one net of its fee, including requests whose window has passed and that nobody cancelled. The extra slots round up, against the requester, and since Q≤NJQ \le N_J the notice never passes 4,320,000 slots. The request becomes convertible TT slots after it was made and stays convertible for 864,000 slots.

A request burns the whole amount from the wallet, pays 50 bps of it, rounded down, to the seed and queues the rest, so a request under 200 atoms pays nothing. It fails if the holder already has an open request or the generation is wiped out (InvalidArgument), if the amount or the net is zero (AmountZero), or if the wallet or the unqueued supply is short (InsufficientBalance). Queued jrLP keeps earning: the holder's exit account counts toward their balance for income. It also keeps bearing losses, so a request is no escape from a loss already in view.

Converting pays ⌊j SJ/NJ⌋\lfloor j\,S_J/N_J \rfloor srLP at the rate of that moment, against minimum_senior (InsufficientOutputAmount), and only inside the window (InvalidArgument). Cancelling returns the queued jrLP at any time without refunding the fee. A request whose window passes stays queued, junior and loss-bearing until its owner cancels it, and keeps lengthening other holders' notice. Leaving then takes a new request, a new fee and a full notice.

Interest indexes

Swap fees and interest are split the same way. After the protocol's share, and on interest the operator's share, the LP part aa goes to the two tranches by the junior income share ϕ\phi:

junior=⌊a ϕbps+c10,000⌋senior=a−junior\begin{aligned} \text{junior} &= \left\lfloor \frac{a\,\phi_{\text{bps}} + c}{10{,}000} \right\rfloor \\ \text{senior} &= a - \text{junior} \end{aligned}

Each source keeps its own sub-basis-point carry cc, so the cumulative split is exact. ϕ\phi is 50% by default; the operator or manager can set it from 10% to 90% through the tranche family (InvalidParameterUpdate outside that), and a change waits the full 4,752,000-slot notice. Funding interest the hLP vaults pay is split the same way, except that the vaults' own srLP takes no part.

For swap fees, the protocol takes its share of the base fee, 20% by default under the futarchy authority's swap_bps. Of the LP part, the market's compounding share becomes principal and the rest is claimable; that share is 0 by default and the operator's fee family can raise it to 100%. Both parts are split by ϕ\phi. Compounded junior fees raise SJS_J and so the jrLP exchange rate, and the claimable part accrues to jrLP holders' yield accounts across all of NJN_J, the seed and the queue included.

Borrowers pay the base rate plus the protocol's markup μ\mu, the futarchy authority's interest_bps, 20% by default, and each slice of interest is split as it accrues. The protocol takes μ/(1+μ)\mu/(1 + \mu) of it, the operator its share of the rest, at most 50%, and the LP part is what remains. The split is fixed at accrual, so a later rate change cannot reprice old interest. A referral partner's cut comes out of the protocol's part and leaves the LP part whole.

The protocol's share is paid only. Each interest payment moves the protocol's pro-rata share of outstanding interest out of reserve cash, and a default drops its unpaid part. The operator's share is credited as it accrues, like LP interest, and claimed in cash.

Interest accrues every slot and is credited to holders as it accrues, through a Q64 growth index per lane: ordinary srLP, Junior LP and the holders of each hLP vault. The junior part raises the junior index across all of NJN_J, the seed and the queue included. Of public interest, the senior part goes to each vault in proportion to its srLP over the senior shares, and ordinary srLP takes the rest. Funding interest the hLP vaults pay credits ordinary srLP and Junior LP only, and the vaults' srLP leaves the denominator. An ordinary part aoa_o raises the srLP index over the ordinary senior shares SoS_o by

ΔI=⌊264 ao+cSo⌋\Delta I = \left\lfloor \frac{2^{64}\,a_o + c}{S_o} \right\rfloor

with the remainder cc carried to the next credit. A holder's claim is its balance bb times the index change since its last checkpoint:

claimable=accrued+⌊b (I−Ih)264⌋\text{claimable} = \text{accrued} + \left\lfloor \frac{b\,(I - I_h)}{2^{64}} \right\rfloor

Each checkpoint stores whole atoms and carries the fraction. Transfers, deposits, withdrawals, conversions and harvests checkpoint first, so interest belongs to whoever held while it accrued.

Accrual moves no cash and no price. The credited interest offsets the borrower's new debt, so the curve reserve stays where it was. Cash arrives when borrowers repay and stays in the reserve vault, less the protocol's share. A harvest pays credited interest from the reserve cash present, and if cash is short it pays what there is and the rest stays claimable. Claims, withdrawals and borrows draw on the same cash, so a claimable balance can exceed what a harvest pays at that moment.

The solvent liquidation charge is fixed at 300 bps of the net repayment, capped by what a full fill recovers above the debt. The protocol takes 20% of it, rounded down, and the junior tranche the rest. The junior part is booked after the loss settles, so it cannot cover the liquidation that paid it, and while there is no junior capital it goes to the seed.

Losses

When a liquidation or an hLP closeout leaves a loss, the unrecovered principal plus the credited interest it writes off, the program burns junior reserve shares worth the loss, up to all of them, from both SJS_J and the total supply:

burn=min⁡ ⁣(SJ, ⌈ℓ SF+ℓ⌉)\text{burn} = \min\!\left(S_J,\ \left\lceil \frac{\ell\,S}{F + \ell} \right\rceil\right)

FF is the funded reserve value after the settlement has removed the loss, and ℓ\ell the loss, valued at the centre's moving average for a base-token loss and one for one for a quote-token loss. Rounding up favours senior. The jrLP exchange rate falls and srLP keeps its value per share while the loss is within junior capital; a larger loss burns every junior share and lowers srLP's value by the rest. Base-token and quote-token losses draw on the same junior capital. Burns come from liquidations of loans and leverage positions and from both kinds of hLP closeout.

Liquidations recover principal first and write off the interest they cannot pay. The LP and operator part of that interest was already credited, so it is a pool loss like a principal shortfall and reaches junior capital first; the protocol's unpaid part is dropped. Credited interest itself never absorbs a loss, and holders keep claiming it.

A loss larger than all LP capital in a token leaves the remainder recorded as that token's interest deficit, which never decreases. Claims are still paid from the cash that remains, first come. While either token has a deficit, InterestDeficit refuses new capital, credit and curve-priced exits: add_liquidity and deposit_single_sided, since new capital would fund old claims, new borrows, collateral withdrawals by positions with debt, and withdraw_single_sided. Any hLP vault can then be wound down through the terminal close, solvent or not, and its holders burn their retired receipts for what remains. Swaps against a side whose LP capital is gone refuse with InsufficientLiquidity.

Worked example

A market has 1,000,000 reserve shares and 2,000,000 USDC of funded value, 2 USDC a share, with SJS_J = 120,000, NJN_J = 100,000 and 15,000 jrLP already queued to exit:

StepSJS_JNJN_JxxResult
Start120,000100,0001.2
Enter 6,000 srLP126,000105,0001.25,000 jrLP minted
Request exit of 10,000 jrLP126,000105,0001.250 to the seed, 9,950 queued; notice 3,331,955 slots, about 7.71 days
Loss of 42,000 USDC105,000105,0001.021,000 junior shares burned; srLP still 2 USDC a share
Convert after the notice95,05095,0501.09,950 srLP

The queued jrLP was worth 23,880 USDC when the holder asked to leave and converted into 19,900 USDC of srLP. With QQ = 24,950, the notice's extra ⌈1,296,000×24,950/105,000⌉\lceil 1{,}296{,}000 \times 24{,}950/105{,}000 \rceil is 307,955 slots on top of the 3,024,000.

Generations

A loss that burns every junior reserve share while jrLP is outstanding wipes out the current generation: its exchange rate is zero, its interest index stops, and entries, exit requests and seed reinvestment stop (InvalidArgument). Cancelling a queued exit and funding the seed still work. The junior income share keeps accruing to the seed, and with no junior capital the coverage signal reads zero on any side with debt, so the borrow rate climbs.

Anyone can then call initialize_junior. It requires SJ=0S_J = 0 and the current, unretired cohort. It freezes that cohort's final swap-fee and interest indexes, marks it retired, resets the tranche capital to an empty next generation and opens a new jrLP mint with no holders. The seed's balances and its rounding carry pass to the new generation, while the old generation's receipts, seed and queue included, keep no claim on new capital. The new mint is a Token-2022 mint with the base token's decimals and Dusk as its transfer hook, at an address derived from the market and the generation number, and its first entry or seed compound is one for one.

Holders of the retired jrLP record their claim and burn the tokens with burn_retired_junior, including any left in an exit request. The burn checkpoints the holder against the cohort's frozen indexes and clears the exit request; interest credited before the wipe stays claimable through harvest. It rejects the live mint (InvalidLpMintKey).

Instructions

InstructionWhat it doesWho calls
convert_trancheEnter, RequestExit, ConvertExit or CancelExitThe holder
initialize_juniorOpens the first jrLP generation at launch, or the next one after a wipeoutAnyone; the launch flow opens the first
fund_junior_seed, compound_junior_seedMove the seed's credited interest that cash covers into custody and reinvest itAnyone
burn_retired_juniorBurns retired jrLP after checkpointing its credited interestThe holder

The accounts, seeds and events are in the hLP and yield reference.

Parameters

ParameterValueSet by
Junior income share50% by default, 10% to 90%Operator or manager, after the full notice
Exit request fee50 bps, rounded downProgram
Exit notice3,024,000 to 4,320,000 slotsProgram
Exercise window864,000 slotsProgram
Seed⌈G/1,000⌉\lceil G/1{,}000 \rceil reserve shares at the first depositProgram
Seed compounding band0.01% from the centre's moving averageProgram
Liquidation charge300 bps of the net repayment, 20% of it to the protocolProgram

The program sets exit timing when a market is created; the tranche family changes only the income share. In normal builds an operator change waits the longest exit notice plus a day, so a junior holder who requests an exit when a change is announced can convert before it applies. This devnet release instead creates test markets with a fixed 2,500-slot junior notice and uses a 3,750-slot operator notice. The exercise window remains 864,000 slots. Lifecycles distinguishes these test timers from the normal-build values above.