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
| Instruction | Who signs | What it does |
|---|---|---|
initializeConfig | The program's upgrade authority | Writes the configuration, once |
registerAsset | The configuration authority | Binds an asset's mint to its Pyth USD feed |
launchFund | The agent | Creates a fund, its vaults and its protocol vault, and mints the stake into the fund's stake vault |
deposit | Anyone | USDC in, shares out at NAV |
redeem | A holder | Shares in, a pro-rata part of each vault out |
checkpoint | Anyone | Values the fund and settles any performance fee, minted 90 % to the agent and 10 % to the protocol vault |
unstake | The agent | Releases the stake once only it and the protocol vault's shares are left; closes the fund |
claimProtocolShares | The program's upgrade authority | Moves shares out of a fund's protocol vault, to be redeemed at NAV |
directSwap | The agent | A committed Jupiter route inside the daily budget |
propose | The agent | Posts a committed route and reserves its input |
initConditional | Anyone | Creates the PASS and FAIL copies of shares or USDC for a draft |
split, merge, redeemConditional | A holder | Collateral into copies, pairs back into collateral, winners into collateral |
initPool | Anyone | Creates the PASS or FAIL pool for a draft |
addLiquidity | Anyone | Seeds a draft's pool |
removeLiquidity | A liquidity provider | Withdraws after the decision settles |
trade | Anyone | Trades a pool while the window is open |
startProposal | Anyone | Starts trading once both pools are seeded at one price |
finalize | Anyone | Decides at the close |
executeSwap | Anyone | Runs an approved route within the time to execute |
expire | Anyone | Cancels 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
| Account | Address seeds | Holds |
|---|---|---|
Config | config | The authority, the USDC/USD feed ID and every limit |
AssetRegistry | asset, mint | A registered asset's mint, feed ID and decimals |
Fund | fund, agent, nonce | Terms, vaults, budget use, reservations, the open proposal, NAV and the high-water price |
Proposal | proposal, fund, sequence | The committed action and its hash, notional, window, times, state and time-weighted prices |
Pool | pool, proposal, branch | One 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
| Event | When |
|---|---|
FundEvent | Launch, 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 |
ProposalEvent | Every state a proposal enters, with its hash and time-weighted prices |
TradeEvent | Every trade, with its pool, side, input and output |
Errors
| Code | Name | Meaning |
|---|---|---|
| 6000 | Arithmetic | Checked integer arithmetic failed |
| 6001 | Unauthorized | The signer isn't allowed |
| 6002 | Input | A value is outside its range |
| 6003 | Conflict | A proposal is already open, or the fund is closed |
| 6004 | Reserved | The assets are reserved for the open proposal |
| 6005 | Budget | Above what is left of today's budget |
| 6006 | Oracle | A price isn't verified, fresh or precise enough |
| 6007 | State | The step isn't available in this state |
| 6008 | UnsafeAction | The route breaks the fund's swap rules |
| 6009 | ActionMismatch | The accounts don't match the committed route |
| 6010 | Slippage | Below the least amount accepted |
| 6011 | Liquidity | Not enough in the pool |
| 6012 | Expired | The window or the time to execute has passed |
| 6013 | Unresolved | The decision hasn't settled |
| 6014 | StakeLocked | Shares other than the stake and the protocol vault's are still outstanding |
| 6015 | ClosedFund | The fund has no shares or assets |
| 6016 | Clock | The clock can't move a budget or price backwards |
| 6017 | InitialPrice | PASS and FAIL must open at the same price |
| 6018 | SwapDelta | The swap didn't spend and deliver the committed amounts |