Program reference
Instruction encoding, error codes and events for integrators.
Instruction encoding#
Pool Factory, Staking, Buyback and Agent Vault use a one byte instruction tag followed by little-endian arguments. The Fee Router uses Anchor-compatible 8 byte discriminators (sha256("global:name")[0..8]).
| Program | Tags |
|---|---|
| Pool Factory | 0 create_pool(fee u16, a u64, b u64) · 1 deposit(lp u64, max_a u64, max_b u64) · 2 withdraw(lp u64, min_a u64, min_b u64) · 3 swap(in u64, min_out u64) · 4 collect |
| Staking | 0 init_pool · 1 add_reward · 2 stake(id u64, amount u64, lock_secs u64) · 3 unstake · 4 claim(index u8) · 5 sync · 6 close · 7 expire · 8 extend(lock_secs u64) |
| VYLO Lock | 0 create_stream · 1 withdraw · 2 cancel · 3 transfer_recipient · 4 close_stream · 5 create_drop · 6 add_recipients · 7 claim · 8 clawback · 9 close_claim · 10 sweep_tokens · 11 sweep_sol |
| Buyback | 0 init(executor, router) · 1 set_executor · 2 set_vylo_mint · 3 set_router · 4 buyback(in u64, min_out u64, route data) · 5 set_burn(u8) · 6 burn(u64) |
| Agent Vault | 0 create(id u64, policy) · 1 update_policy · 2 set_agent · 3 set_paused · 4 deposit(u64) · 5 withdraw(u64) · 6 add_liquidity · 7 remove_liquidity · 8 swap |
Error codes#
| Code | Name | Meaning |
|---|---|---|
| 7000 | Unauthorized | Signer is not allowed to do this |
| 7001 | InvalidAccount | An account does not match what the program expects |
| 7002 | InvalidMint | Wrong mint or wrong mint order |
| 7003 | InvalidTokenProgram | Token program does not match the mint |
| 7004 | MathOverflow | Arithmetic overflow or invariant check failed |
| 7005 | Slippage | Price moved past your limit |
| 7006 | ZeroAmount | Amount must be above zero |
| 7007 | Paused | Paused by the owner or the Fee Router |
| 7008 | PolicyViolation | Outside the agent mandate or a failed post-check |
| 7009 | Expired | Agent mandate has expired |
| 7010 | InsufficientLiquidity | Pool cannot fill this trade |
| 7011 | UnsupportedMintExtension | Token-2022 extension not supported |
| 7012 | NotInitialized | Required setup has not been done yet |
| 7013 | LimitExceeded | Per-transaction, daily or capacity limit reached |
Fee Router errors: 6000 Paused, 6001 ZeroAmount, 6002 InsufficientSource, 6003 Overflow, 6004 NothingPending, 6005 TimelockActive, 6006 Unauthorized, 6007 InvalidAccount, 6008 InvalidTokenProgram, 6009 WrongDestination.
Events#
Events are written with sol_log_data and start with an 8 byte tag: evswap__, evliq___, evcollct (Pool Factory), evstake_, evclaim_ (Staking), evbuybck (Buyback), evagent_ (Agent Vault). Fields are fixed-width little-endian; see the program sources for exact layouts.