Lifecycles
Swaps, borrows and deposits finish inside one transaction. Only a few kinds of state wait across transactions, and each follows a fixed lifecycle counted in slots.
Updated Nov 15, 2026
A swap, a borrow, a repayment or an LP change is one atomic step: it validates, moves tokens and settles within its instruction. The program keeps an explicit state machine only for state that has to wait between transactions.
Times are counted in slots at the program's nominal 200 ms, so a day is 432,000 slots. The cluster's real slot time can differ, and the clock does not adjust for it: elapsed time is the slot difference times 200 ms, skipped slots included. A few timers run on Unix time instead: a market's start time, its launch fee and launch rate limit, and the expiry of the delegate program's entry and protection orders.
| Lifecycle | States | Normal-build timing |
|---|---|---|
| Operator proposal | Pending, executable, then executed; or stale, expired or cancelled | Executable after 11 days, for 7 |
| Junior exit | Requested, convertible, then converted; or cancelled, or lapsed | 7 to 10 days' notice, then a 2-day window |
| Junior cohort | Active, then retired | When junior capital is wiped out |
| Protocol auction | Configured continuous curve; settlements update its virtual reserves | Virtual sold inventory streams per elapsed slot; no purchase rounds |
| Curve ramp | Announced, stepping, then done | At least a day, one step per slot at most |
| Hedged vault | Active, frozen, closed, then replaced | On losses |
| Reduce-only | Off or on | No timer |
| Market opening | Created, seeded, then trading | From the start time |
| Delegate orders | Open, then executed or cancelled | Entry and protection orders expire |
Operator proposals
An operator bundles setting changes into one pending proposal. In a normal build it becomes executable 4,752,000 slots after it is announced, the longest junior exit notice plus a day, and stays executable for 3,024,000 slots, seven days. The window's first and last slots both count.
No field stores the state. Each one follows from the market and the proposal account:
| State | Condition |
|---|---|
| Pending | The market's single pending pointer names the proposal |
| Executable | Still current, and the slot is inside the window |
| Executed | The proposal's executed flag is set |
| Stale | No longer current: replaced, its author lost their role, the operator epoch or a family's revision changed, or the program's policy version moved |
| Expired | The slot is past the deadline |
| Resolved | The account is closed and its rent refunded |
announce_operator_change creates the proposal. The authority may announce anything, while a manager may announce parameter updates only and cannot replace a bundle someone else wrote (OperatorChangePending). The call must name the market's next nonce and current operator epoch (OperatorNonceMismatch, OperatorEpochMismatch), carry at most seven parameter updates, at most one per family and in family order (ParameterUpdatesNotCanonical), and keep the operator's interest share at or below 50% (OperatorPolicyExceeded). An empty bundle fails with ParameterUpdateNotMeaningful. A new announcement replaces the pending one and restarts the notice.
Anyone can call execute_operator_change, and a new authority must sign it to accept a handoff. It fails with OperatorProposalStale unless the proposal is current and a fresh hash of its stored fields still equals the digest taken at announcement, with OperatorNoticeNotReady before the window and with OperatorProposalExpired after it.
A bundle that changes parameters, or raises the operator's interest share, also runs two guards. It first closes interest, the averages and risk at the old values and needs both sides' utilization strictly below 80% (UtilizationGuardExceeded). After applying, each side with public debt must be at or above the market health floor (InsufficientMarketHealth). A bundle that only hands over ownership, changes the manager or the revenue recipient, or lowers the interest share runs neither. Execution bumps the revision of every family it touched, and a handoff bumps the operator epoch and clears the manager, so either one makes other bundles stale.
resolve_operator_change closes a proposal and refunds its rent. The authority can cancel any pending bundle and a manager its own; anyone can clear one that is stale, executed or past its deadline. Expiry by itself changes nothing, so an expired bundle stays pending until someone resolves or replaces it. Market operators lists the settings each family covers.
Junior exits
Each holder has one exit account per jrLP mint, and convert_tranche moves it between states:
| From | Action or event | To | Checks |
|---|---|---|---|
| Empty | RequestExit | Requested | No open request; generation not wiped out |
| Requested | The notice ends | Convertible | None |
| Convertible | ConvertExit | Empty, srLP minted | Inside the window; no hLP flash recovery open |
| Requested, convertible or lapsed | CancelExit | Empty, jrLP returned | Same generation |
| Convertible | 864,000 slots pass | Lapsed | None |
A request charges 50 bps of the jrLP to the market's permanent junior seed. In a normal build it starts a notice of 3,024,000 slots. The notice grows by up to 1,296,000 slots as a larger share of all jrLP queues to leave, to at most 4,320,000. Tranche accounting has the formula.
The holder then has 864,000 slots, two days, to convert back to srLP. Conversion is refused while an hLP flash recovery is open, but such a session opens and settles inside one transaction, so neither the window nor the notice ever pauses. Requested jrLP stays junior, loss-bearing and income-earning until it converts, and cancelling returns it without refunding the fee. A lapsed request stays queued, still junior and still lengthening other holders' notice, until its owner cancels it. A request from a retired generation can neither convert nor cancel; burn_retired_junior clears it.
Junior cohorts
A loss that burns every junior share ends that jrLP generation. Its swap-fee and interest indexes freeze, and a new cohort with a new jrLP mint takes the next junior capital once anyone calls initialize_junior. Until then entries and exit requests fail, while cancelling a queued exit still works. Holders of the retired jrLP keep the interest credited before the wipe and harvest it from the frozen index.
Protocol auctions
Each protocol revenue lane sells its inventory through a continuous virtual constant-product curve, one per side, lane and source: the fee and buyback lanes, each fed by swap fees and interest, make eight per market. Revenue goes to the fee lane unless governance splits it. Actual token custody and the lane's fee liability bound what can be delivered; virtual reserves set the price and do not create real inventory.
Each configured curve stores a payment mint, positive virtual sold reserve , positive virtual payment reserve , sold-token rate per nominal day, last update slot and fractional streaming remainder . All amounts here are raw token atoms. At a settlement after slots, with slots per nominal day, the program first streams virtual inventory:
For a buyer receiving sold-token atoms, where , the payment and next virtual reserves are:
Both divisions round up against the bidder. The quote uses the sold tokens the bidder receives after transfer fees; custody and the fee liability decrease by the gross amount sent. The payment must fit max_payment_amount (InsufficientAuctionPayment). The staking vault's share rounds down and the treasury receives the remainder.
The last slot, remainder and virtual reserves update only after a successful settlement. Receiving more fee inventory does not restart the curve, and exhausting actual inventory does not reset it. There is no EMA reference, reference-age check, fixed start/floor price or daily round restart.
The futarchy authority calls configure_protocol_auction to set this market side, lane and source's virtual reserves, stream rate and payment mint. Reconfiguration restarts that curve's clock at the current slot without changing actual inventory. update_protocol_auction_config changes a lane's default payment mint for newly configured curves; existing curves keep their stored mint. update_protocol_auction_recipients changes the treasury/staking recipients and payment split.
For example, start with , and atoms per nominal day. After 432,000 slots with no settlement, and . Receiving 100 atoms costs payment atoms. The next reserves are 1,900 and 52,632. A real purchase also needs at least that much deliverable fee inventory.
Curve ramps
A change to a market's concentration is announced as a ramp that lasts at least a day, and moves each parameter at most tenfold. Swaps then attempt at most one step per slot.
The ramp starts when the operator bundle executes, from the live shape at that slot, and is due to end at that slot plus the bundle's duration. Live geometry changes only when a step succeeds, and each slot gets at most one attempt, successful or not. A step that would leave the reserves less funded, break the market health floor, move the spot price by more than one unit of , or run while utilization is at or above 80% is skipped and tried again later. The ramp finishes at the first successful step at or after its end slot, so it can run past the end while steps keep failing. Withdrawals and repayments never depend on a step succeeding. Concentrated curve has the interpolation.
Hedged vaults
| From | Event or instruction | To |
|---|---|---|
| Active | Value at the live price below zero, found by the next checkpoint or by a swap whose quote then fails | Frozen |
| Active | begin_hlp_flash for a full recovery | Frozen |
| Frozen | settle_hlp_flash for a partial recovery | Active |
| Active or frozen | close_insolvent_hlp, or settle_hlp_flash for a full recovery | Closed |
| Closed | rotate_hlp_cohort | Replaced by a new mint |
A frozen vault refuses deposits and withdrawals (HlpSettlementUnavailable), keeps its shares and debt fixed through swaps and pays no recovery bonus. close_insolvent_hlp needs the vault's funding debt to reach the value of its holdings at the symmetric average, refreshed to the current slot. A closed vault has no srLP, debt or live legs left. Its holders can still burn their receipts through withdraw_single_sided, which pays no principal, and keep any yield already funded.
Anyone can call rotate_hlp_cohort on a closed vault whose old receipts are still outstanding (InvalidHlpMintSupply otherwise), with no flash recovery open (LiquidationSessionActive), naming a new mint with zero supply (NonZeroSupply). It records the final vault on the old cohort, marks the cohort retired and installs a fresh vault on the new mint. Old receipts then burn through burn_retired_hlp_receipt, which credits their final yield. Hedged vaults covers recovery.
Reduce-only
An emergency key fixed in the program can switch one market, or the whole protocol, to reduce-only, with no timer. set_market_reduce_only sets the market's flag and set_global_reduce_only the protocol's; either flag is enough, and any other signer fails with InvalidReduceOnlyAuthority. It blocks new borrows, srLP and hLP deposits, leverage opens and increases, and collateral withdrawals from positions that owe debt. Swaps, repayments and liquidations keep working.
In detail, borrow, add_liquidity and with it open_liquidity_gates, deposit_single_sided, open_leverage and increase_leverage fail with ReduceOnlyMode, and so do entry orders, which open through open_leverage. withdraw_collateral from a position with public debt fails with ReduceOnlyHasDebt. Everything else keeps working, including remove_liquidity, withdraw_single_sided, leverage decreases and closes, convert_tranche and the operator instructions.
Market opening
A market's start time is in Unix seconds. initialize_market moves a requested start that is unset or already past to the creation time, so the launch fee and launch rate limit run their full course from launch. Before the start, swaps, borrowing, leverage and hLP deposits fail with MarketNotStarted, while srLP can already be seeded. remove_liquidity has no start check, so liquidity added before trading opens can also leave before it opens.
While the srLP supply is zero only the creator may deposit (InvalidInitialLiquidityAuthority), and open_liquidity_gates is the deposit that requires the supply to be zero (NonZeroSupply). The first deposit fixes the launch reference price, carves out the junior seed and clears the creator's deposit right; after it, anyone can add liquidity. The launch fee settings cannot change once the market has started (LaunchSettingsImmutable).
Delegate orders
Orders in the leverage-delegate program also wait across transactions:
| Order | Ends by | Timer |
|---|---|---|
| Take-profit and stop-loss | Execution, which closes the order, or the owner's cancel | None; tied to one opening of the position |
| Entry | Execution at or before expiry, or the owner's cancel | Unix expiry; an expired order waits for its owner to cancel and take the refund |
| hLP stop-loss and stop-rate | Execution or cancel, recorded in the order's status, after which settle_hlp_order_yield closes the account | None |
| Protection | Cancel, which returns the LP and leaves the account inactive; each execution draws down its LP budget | Unix expiry |
Positions have no timer either. A leverage position repaid in full keeps its collateral in custody until its owner calls withdraw_repaid_leverage. Isolated leverage covers the triggers and fees.
What is not a lifecycle
Flash liquidations and hLP flash recoveries span two instructions inside one transaction. The begin instruction must be top-level and names the index of its settle instruction, which must come later in the same transaction with the same leading accounts; settle checks that index and the slot (InvalidLiquidationSession). The session account is created at begin and closed at settle, so nothing stays open between transactions. The payment token accounts persist, but only tokens above the balance recorded at begin count as payment. Ledger and invariants shows how each step moves the books.
LP interest has no waiting state either. It is credited to holders through growth indexes as it accrues, and a harvest pays it from reserve cash in the same instruction.