set_share_account, five for liquidity providers and seven for governance. The other 13 serve a retired path that takes no tickets (its entry instruction fails with Paused) and are left out. Account flags: S signer, W writable. Accounts marked derived are PDAs the generated client fills in for you. Every instruction also takes event_authority and program (Anchor’s self-CPI event accounts); they are omitted from the tables. Amounts are in base units: USDC 6 decimals, shares 9.
Tickets
open_ticket
Opens a ticket. Signed by the app and the funder.
Checks, in order. No remaining accounts; new tickets not paused; new apps not paused if this creates the record; app not paused; share account is a USDC account and matches the record; nonce; payout table shape (
OutcomeCount, ProbabilityRange, ProbabilitySum, MultiplierCeiling); expected return (PayoutTableOverpays); app share bound (AppShareTooHigh); margin floor (MarginFloor); drawdown breaker; price bounds (PriceBounds); per-ticket cap, app ceiling, utilisation, κ and gross solvency against the vault after this ticket. Then it moves the protocol share, the app share and the vault credit from the ticket price, prefunds vrf_payer with twice the VRF’s fee plus a pending request’s rent, moves the crank fee into the ticket, updates the books and snapshots everything into the ticket. Emits IntegratorCreated (first ticket) and TicketOpened.
request_randomness
Binds the ticket to a VRF request (provider and accounts: Randomness). Anyone, from open_slot + 2 until expiry_slot; after it, only a request someone already created at the ticket’s seed and the VRF fulfilled, bound without funding anything.
Checks. Request window (
RequestWindow); finds s*, the first slot in SlotHashes after open_slot (EntropyUnavailable if none); derives seed = SHA256("FADE/ORAO-SEED/v1" ‖ program ‖ ticket ‖ open_slot ‖ s* ‖ h*); requires request to be the VRF’s account for that seed (WrongRandomnessAccount) and the treasury to match (TreasuryMismatch). A request account someone already created at that address is accepted after owner and type checks. Stores s*, h*, the seed and the request; status becomes Requested. Emits RandomnessRequested.
settle_ticket
Draws the outcome and pays it. Anyone, once the VRF has fulfilled; no deadline.
Checks. No remaining accounts; status; the randomness account is the VRF’s, bound to this ticket, fulfilled, with the stored seed and a non-zero value. The outcome is
SHA256("FADE/OUTCOME/v1" ‖ program ‖ ticket ‖ seed ‖ R ‖ i) read as 128-bit words with rejection sampling, mapped onto the stored payout table’s cumulative probabilities. Releases the reservation, pays price × m / 10 000 to the beneficiary (or to the escrow, status PayoutPending), returns the prefund, pays the settler and closes the ticket. Never re-reads live parameters or caps. Emits TicketSettled.
expire_ticket
Forfeits a ticket whose randomness never arrived. Anyone, after expiry_slot; never paused.
Checks.
NotExpired before expiry_slot; AlreadyFulfilled if a request at the ticket’s seed is fulfilled, bound or not (bind it with request_randomness and settle). A ticket never requested must have its seed recorded first (EntropyUnrecorded). The vault keeps the vault credit; the reservation is released; SOL returns to the payer. Emits TicketExpired.
claim_payout
Delivers a payout parked at settlement or at a refund. Anyone.
Fails while the beneficiary still cannot receive; retry later. Emits
PayoutClaimed.
record_ticket_entropy
Records an Open ticket’s seed, s* and h* while SlotHashes still proves them, so that finding its VRF request never depends on the sysvar again. Anyone, unpaid; never paused.
From
open_slot + 2 (EntropyUnavailable before) while SlotHashes proves s*, about 512 slots (EntropyUnrecorded after). A ticket already recorded is left as it is and the call succeeds, so it can be sent alongside, or raced by, request_randomness, which records the same fields. Emits TicketEntropyRecorded.
refund_expired_ticket
Ends an expired ticket that was never requested, whose seed was never recorded and whose s* SlotHashes no longer proves. Anyone, paid the 200 000-lamport settle share; never paused.
Checks.
NotExpired before expiry_slot; EntropyStillProven while SlotHashes still proves s* (record the seed and expire instead). The vault credit goes back to the beneficiary, or to the payout escrow (PayoutPending, delivered by claim_payout) when it cannot receive. The protocol and app shares paid at open are not returned. The refund counts in Vault.ticket_forfeits_withheld. Emits TicketExpired with refunded set.
sweep_ticket_vrf
Moves whatever a closed ticket’s vrf_payer still holds (the VRF’s late refund of a pending request’s rent, or a stray transfer) to the caller. Anyone, unpaid; never paused.
Nothing to sweep succeeds without moving anything. Emits
TicketVrfSwept when it moves lamports.
set_share_account
The only way to move where an app’s share is paid. Signed by integrator_authority.
Emits
ShareAccountChanged.
Liquidity
request_deposit
Checks. Allowlist of top-level instructions (
ForbiddenComposition); deposits not paused; amount ≥ min_deposit, and ≥ min_first_deposit while no share exists. Joins the epoch computed from the queue and the clock (never an argument). Moves the USDC to the deposit queue and the SOL fees into the request and, if below target, the strike fund. Emits DepositRequested.
request_withdraw
Accounts mirror
request_deposit, with owner_shares (W) as the source, owner_usdc derived (the owner’s associated USDC account) and share_escrow instead of the deposit queue. Checks. Allowlist; at least one share or the owner’s whole balance. Never blocked by a pause. Emits WithdrawRequested.
strike_epoch
Prices the live epoch. Anyone.
Checks. A live epoch (
NoLiveEpoch); its close has passed (EpochNotClosed); no ticket opened before the close is still open (StrikeNotClean). Prices on settled assets at the close, mints for deposits, burns for withdrawals (rationed if needed), writes the EpochRecord, promotes the next epoch, pays the striker. Emits EpochStruck.
claim_deposit
Delivers the shares of a struck deposit request. Anyone; the request’s CLAIM_FEE pays the caller.
Emits
DepositClaimed, or ClaimDelivered for a parked request.
claim_withdraw
Delivers the USDC of a struck withdrawal request, possibly served across several epochs. Anyone; same fee.
Emits
WithdrawClaimed, or ClaimDelivered.
Governance
initialize
One-time setup by the program’s upgrade authority: creates Config, Vault, Queue and the vault’s token accounts, sets the council, guardian, treasury and parameters, and seeds the strike fund. Args: council: Pubkey, guardian: Pubkey, params: RiskParams.
set_params
Council only. Arg: params: RiskParams. Applies at once if every change tightens; otherwise queues it until the time the program sets, which ParamsChanged carries as effective_at. Emits ParamsChanged.
apply_params
Anyone, once the pending change is due (ChangeNotDue before). Emits ParamsApplied.
cancel_params
Council only. Drops the pending change. Emits ParamsCancelled.
set_pause_flags
Args: pause_flags: u8, integrator_paused: Option<bool>. Signed by the guardian or the council. The guardian may only set flags; clearing any flag, globally or for one app, requires the council (GuardianCannotUnpause). Optional integrator account to pause one app. Emits PauseFlagsChanged.
No flag affects settlement, expiry, refunds, recording entropy, sweeps, payout claims, the strike, liquidity provider claims or withdrawal requests.
set_guardian
Council only, applied at once. Arg: new_guardian: Pubkey. Replaces the guardian; pause flags and any pending change are left as they are.
set_share_metadata
Council only. Args: name: String, symbol: String, uri: String. Writes the vault share mint’s name, symbol and logo URI, where wallets read them, through Metaplex Token Metadata: creates the metadata on the first call, rewrites it after. Emits ShareMetadataSet.