Skip to main content

Core and agents

The core program only accounts. It knows what each margin account holds and owes, and asks two agent programs for the rest. The admin registers the agents. The core calls them read-only, with no writable accounts and no signers, and accepts their answer only as return data from the program it called. The interface lives in programs/vanna_credit_layer/src/interface.rs. Every asset names its oracle (AssetConfig.oracle). Every whitelisted program names its validator (Integration.validator).

On-chain accounts

Remaining accounts

Any instruction that values the account or reviews a call takes, in remaining_accounts:
  1. For margin_execute and public_liquidate: the external call’s accounts first.
  2. One [asset_config, margin_vault] group per allowed token, in the allowed list’s order. The instruction’s own token is left out. A vault that does not exist yet counts as zero.
  3. One [asset_config, margin] group per venue the margin holds.
  4. One [asset_config, reserve, debt_position] group per active debt. The instruction’s own debt is left out.
  5. The agent segments: [vanna_oracle, price_book, …price accounts], and for calls that need it the validator’s segment (for Phoenix: [vanna_validator, market_book, exchange]).
Agents find accounts by key. An account that is needed but missing fails the instruction. The app builds these lists in lib/solana/margin.ts (buildHealthRemainingAccounts). The scripts build them in scripts/src/devnet-positions.ts.
Do not trim the groups to save space. A missing debt or token fails closed, and the margin’s health can’t be computed from a partial set.

Application

The Solana app (apps/solana in the Vanna_Finance_Backend monorepo, which also holds the Stellar app; it grew out of vanna-credit-backend) is a Next.js app with React Query hooks, Zustand stores, an Anchor client, Wallet Standard wallets (Backpack) and Dynamic embedded wallets for email and social login. The browser uses NEXT_PUBLIC_SOLANA_RPC_URL (hosted: https://rpc-devnet.solana.vanna.finance). Server routes may use a loopback FORK_RPC_URL when the app and Surfpool share a machine. Despite the devnet hostname, this is a Surfpool mainnet fork, not the public Solana Devnet cluster.

Boundaries

  • Earn vTokens are not margin collateral.
  • Perps run on Phoenix through margin_execute. There is no perps engine inside Vanna.
  • Fork cheatcodes (faucet, price keeper, pool healing) are demo infrastructure, not mainnet behaviour.
  • Source support is not the same as a verified public-mainnet deployment.