Skip to content
Docs

Reference

Program

Instructions, accounts and errors of the Nod program.

The Nod program is a single Anchor program at 4gethwf951t3MdwAqus2FqvyFrjjF8Gs2C88tjn8NjUt. Its interface is checked in as idl/nod.json.

Instructions

InstructionWho signsWhat it does
initializeConfigThe program's upgrade authorityWrites the configuration, once
registerAssetThe configuration authorityBinds an asset's mint to its Pyth USD feed
launchFundThe agentCreates a fund, its vaults and its protocol vault, and mints the stake into the fund's stake vault
depositAnyoneUSDC in, shares out at NAV
redeemA holderShares in, a pro-rata part of each vault out
checkpointAnyoneValues the fund and settles any performance fee, minted 90 % to the agent and 10 % to the protocol vault
unstakeThe agentReleases the stake once only it and the protocol vault's shares are left; closes the fund
claimProtocolSharesThe program's upgrade authorityMoves shares out of a fund's protocol vault, to be redeemed at NAV
directSwapThe agentA committed Jupiter route inside the daily budget
proposeThe agentPosts a committed route and reserves its input
initConditionalAnyoneCreates the PASS and FAIL copies of shares or USDC for a draft
split, merge, redeemConditionalA holderCollateral into copies, pairs back into collateral, winners into collateral
initPoolAnyoneCreates the PASS or FAIL pool for a draft
addLiquidityAnyoneSeeds a draft's pool
removeLiquidityA liquidity providerWithdraws after the decision settles
tradeAnyoneTrades a pool while the window is open
startProposalAnyoneStarts trading once both pools are seeded at one price
finalizeAnyoneDecides at the close
executeSwapAnyoneRuns an approved route within the time to execute
expireAnyoneCancels a draft after 10 minutes, or expires an approval past its time

Every new transaction also carries one SPL Memo, nod:v1: and a 32-character nonce, signed by the payer, directly after its last Nod instruction.

Accounts

AccountAddress seedsHolds
ConfigconfigThe authority, the USDC/USD feed ID and every limit
AssetRegistryasset, mintA registered asset's mint, feed ID and decimals
Fundfund, agent, nonceTerms, vaults, budget use, reservations, the open proposal, NAV and the high-water price
Proposalproposal, fund, sequenceThe committed action and its hash, notional, window, times, state and time-weighted prices
Poolpool, proposal, branchOne branch's mints, vaults, reserves, fee and time-weighted sum

A fund's share mint is at shares, fund; its vaults at quote, holding, stake and protocol, fund. A proposal's copy mints are at branch, proposal, branch, kind, and its collateral at collateral, proposal, kind. Branch 0 is PASS and 1 is FAIL; kind 0 is fund shares and 1 is USDC.

Events

EventWhen
FundEventLaunch, deposit, redemption, the agent's performance fee, swap inside the budget, the protocol's performance fee and a claim from the protocol vault (kinds 0 to 6), with the amounts and NAV
ProposalEventEvery state a proposal enters, with its hash and time-weighted prices
TradeEventEvery trade, with its pool, side, input and output

Errors

CodeNameMeaning
6000ArithmeticChecked integer arithmetic failed
6001UnauthorizedThe signer isn't allowed
6002InputA value is outside its range
6003ConflictA proposal is already open, or the fund is closed
6004ReservedThe assets are reserved for the open proposal
6005BudgetAbove what is left of today's budget
6006OracleA price isn't verified, fresh or precise enough
6007StateThe step isn't available in this state
6008UnsafeActionThe route breaks the fund's swap rules
6009ActionMismatchThe accounts don't match the committed route
6010SlippageBelow the least amount accepted
6011LiquidityNot enough in the pool
6012ExpiredThe window or the time to execute has passed
6013UnresolvedThe decision hasn't settled
6014StakeLockedShares other than the stake and the protocol vault's are still outstanding
6015ClosedFundThe fund has no shares or assets
6016ClockThe clock can't move a budget or price backwards
6017InitialPricePASS and FAIL must open at the same price
6018SwapDeltaThe swap didn't spend and deliver the committed amounts