SkillAgentSearch skills...

Solana Vault Standard

Solana tokenized vault standard built on Anchor. Programs, SDK, CLI + native extensions to help you across the whole lifecycle of many different types of onchain vaults.

Install / Use

npx skills add solanabr/solana-vault-standard

Installs into whichever agent you are using.

README

Solana Vault Standard (SVS)

solana-vault is a collection of tokenized vault programs and TypeScript SDK/CLI for building and maintaining yield-bearing vaults on Solana. The SDK provides deposit/withdraw operations, share accounting, preview functions, and modular extensions for fees, caps, access control, timelocks, and multi-asset portfolios.

The interface started off following the ERC-4626 specification adapted for Solana's account model. With time, more ERC's and features were also covered such as Centrifuge's ERC-7540, alongside novel onchain enforcements and implementations such as Tranched RWA vaults, streaming vault yield, vaults-of-vaults, and more.

SVS Variants

| Version | Name | Balance Model | Privacy | Sync | Status | |---------|------|---------------|---------|------|--------| | SVS-1 | Public Vault (Live) | Live balance | None | No sync needed | ✅ Devnet | | SVS-2 | Public Vault (Stored) | Stored balance | None | Requires sync() | ✅ Devnet | | SVS-3 | Private Vault (Live) | Live balance | Encrypted | No sync needed | ✅ Devnet | | SVS-4 | Private Vault (Stored) | Stored balance | Encrypted | Requires sync() | ✅ Devnet | | SVS-5 | Streaming Yield Vault | Interpolated balance | None | distribute_yield() + checkpoint() | ✅ Devnet | | SVS-6 | Streaming Private Vault | Interpolated balance | Encrypted | distribute_yield() + checkpoint() | ✅ Devnet | | SVS-7 | SOL Vault | Live balance | None | Native SOL wrapping | ✅ Devnet | | SVS-8 | Multi-Asset Basket | Oracle-weighted | None | Weight rebalancing | ✅ Devnet | | SVS-9 | Allocator Vault | Stored balance | None | CPI to child vaults | ✅ Devnet | | SVS-10 | Async Vault (ERC-7540) | Stored balance | None | Request→Fulfill→Claim | ✅ Devnet | | SVS-11 | Credit Markets Vault | Oracle NAV | KYC + Freeze | Async (request→approve→claim) | ✅ Devnet | | SVS-12 | Tranched Vault | Stored balance | None | Manager-driven | ✅ Devnet |

Balance Model Comparison

Live Balance (SVS-1, SVS-3):

  • Uses asset_vault.amount directly for all calculations
  • External donations/yield immediately reflected in share price
  • No sync timing attack vulnerability
  • No sync() function needed

Stored Balance (SVS-2, SVS-4):

  • Uses vault.total_assets stored in account
  • Requires sync() call to recognize external donations
  • Authority controls when yield is recognized
  • May be preferred for yield strategies that require controlled distribution

Streaming Balance (SVS-5):

  • Uses base_assets + accrued_stream_yield computed at current timestamp
  • Yield distributed linearly over configurable duration via distribute_yield(amount, duration)
  • checkpoint() materializes accrued yield into base_assets (permissionless)
  • Eliminates MEV from front-running discrete sync/yield operations
  • Suited for payroll vaults, vesting schedules, DCA strategies

Async (SVS-10):

  • Request→Fulfill→Claim lifecycle for deposits and redemptions
  • Operator fulfills requests using vault price or oracle NAV
  • Supports illiquid assets, RWA, and cross-chain strategies
  • ERC-7540 equivalent with synchronous cancellation (ERC-7887)

Privacy Model

Public (SVS-1, SVS-2):

  • Token-2022 shares mint (no extensions)
  • All balances visible on-chain
  • Simple, auditable, production-ready

Private (SVS-3, SVS-4):

  • Token-2022 with Confidential Transfers extension
  • Share balances encrypted with ElGamal
  • Only owner can decrypt their balance
  • Requires Rust proof backend for ZK proof generation

Program IDs

| Program | Devnet | Localnet | |---------|--------|----------| | SVS-1 | CzZyssz2PdLccWpbVi6a3wFKMmMqdf28U2RapNNRJSPX | Same as devnet | | SVS-2 | 7vnZM4aCsRapH9ft7Bo5ibTXNH2dvoxkj96c7JonLhoe | Same as devnet | | SVS-3 | CC4xQGxmwKusLW3ToqUzRAFjh7cL2iKsgfkz6qJSasYs | Same as devnet | | SVS-4 | EqRNvMTwczQjUhQL8wwrxJGALgz5VWsYne3d67e6ruCv | Same as devnet | | SVS-5 | HCp23XHzV4HJHXwLWwQj8aSTU1yjyzj8FCNLe6NybwXt | Same as devnet | | SVS-6 | oaT6wgNiwCqd7EGvB6Wb5ZFYUJXckk6LEhB7MWqXbyC | Same as devnet | | SVS-7 | CR2ccVacmbQ2DaXvR66W7gnmH7KuDCqbVW5VwnTczQUC | Same as devnet | | SVS-8 | HnZ9N8Y1v6jMhwDqo4Y76GfqjRArdinadgK67yLVFZbe | Same as devnet | | SVS-9 | AaADS3DCGkjhDEDbGkygbG9bNaziR9TPK2X7SMBYedws | Same as devnet | | SVS-10 | 4G5d6KutMpUaDPTVcv7FJBpPTGZej8rx3GyGnfiRdD6M | Same as devnet | | SVS-11 | CMeQ5Lx7AvjuW3DrzNvEkPZSdqKZjjhaTrAmgqBvPKHD | Same as devnet | | SVS-12 | EPwH58e5V1UXYkkD8JZ4bq7Wr2iRiC9fLj1S6BRRz2R | Same as devnet | | Mock Oracle | Heezh11y1FJPvrUjKetGsDJTFFNdHqXPz9bFsUiEJxdh | Same as devnet | | Mock SAS | GTTMWDHTZibyEpqNRr33RnBhgms262U6qHaGrjoHqEXg | Same as devnet |

Installation

# Core SDK (SVS-1/SVS-2)
npm install @stbr/solana-vault

# Privacy SDK (SVS-3/SVS-4)
npm install @stbr/svs-privacy-sdk

# Backend (for private vault proof generation)
cd proofs-backend && cargo run

Quick Start

import { SolanaVault, ManagedVault, StreamingVault, AsyncVault } from "@stbr/solana-vault";
import { BN } from "@coral-xyz/anchor";

// SVS-1: Load live-balance vault
const vault = await SolanaVault.load(program, assetMint, 1);

// SVS-2: Load stored-balance vault (adds sync())
const managed = await ManagedVault.load(program, assetMint, 1);

// Preview deposit
const expectedShares = await vault.previewDeposit(new BN(1_000_000));

// Deposit with slippage protection
await vault.deposit(user, {
  assets: new BN(1_000_000),
  minSharesOut: expectedShares.mul(new BN(95)).div(new BN(100)),
});

// Redeem shares
const expectedAssets = await vault.previewRedeem(shares);
await vault.redeem(user, {
  shares,
  minAssetsOut: expectedAssets.mul(new BN(95)).div(new BN(100)),
});

// SVS-2 only: sync stored balance
await managed.sync(authority);

// SVS-5: Load streaming yield vault
const streaming = await StreamingVault.load(program, assetMint, 1);

// Distribute yield over 1 hour
await streaming.distributeYield(authority, new BN(1_000_000), new BN(3600));

// Permissionless checkpoint
await streaming.checkpoint();

// SVS-10: Async vault (request→fulfill→claim)
const asyncVault = await AsyncVault.load(program, assetMint, 1);
await asyncVault.requestDeposit(user, { assets: new BN(1_000_000) });
await asyncVault.fulfillDeposit(operator, { owner: user.publicKey });
await asyncVault.claimDeposit(user, { owner: user.publicKey });

Features

| Feature | Description | |---------|-------------| | Inflation Attack Protection | Virtual offset mechanism prevents donation attacks | | Vault-Favoring Rounding | All operations round to protect vault solvency | | Slippage Protection | Min/max parameters prevent sandwich attacks | | Multi-Vault Support | Multiple vaults per asset via vault_id | | Emergency Controls | Pause/unpause and authority transfer | | CPI-Composable Views | Preview functions callable from other programs |

On-Chain Modules (SVS-1)

SVS-1 includes optional on-chain modules for enforcing vault policies at the program level. Build with --features modules to enable.

| Module | Description | |--------|-------------| | svs-fees | Entry/exit fees (max 10%), collected later via admin instruction | | svs-caps | Global and per-user deposit caps with bypass prevention | | svs-locks | Time-locked shares before redemption (max 1 year) | | svs-access | Whitelist/blacklist with merkle proof verification |

Module PDAs are passed via remaining_accounts. If not passed, checks are skipped (backward compatible).

# Build SVS-1 with modules
anchor build -p svs-1 -- --features modules

SDK Extensions

The TypeScript SDK includes modular extensions for common vault patterns:

| Module | Description | |--------|-------------| | fees | Management, performance, and entry/exit fee calculation | | cap | Global and per-user deposit caps | | emergency | Emergency withdrawal with configurable penalty | | access-control | Whitelist/blacklist with merkle proof verification | | multi-asset | Portfolio allocation across multiple vaults | | timelock | Governance proposal lifecycle management | | strategy | CPI templates for deploying assets to external protocols |

CLI

The SDK includes a CLI for vault management:

# Install globally
npm install -g @stbr/solana-vault

# Initialize config
solana-vault config init

# Add vault alias
solana-vault config add-vault my-vault <ADDRESS> --variant svs-1 --asset-mint <MINT>

# Common operations
solana-vault info my-vault                    # View vault state
solana-vault balance my-vault                 # Check your balance
solana-vault deposit my-vault -a 1000000      # Deposit assets
solana-vault withdraw my-vault -a 500000      # Withdraw assets
solana-vault dashboard my-vault               # Live monitoring

# Admin (authority only)
solana-vault pause my-vault                   # Emergency pause
solana-vault sync my-vault                    # Sync balance (SVS-2/4)

# Async vault (SVS-10)
solana-vault async request-deposit my-vault -a 1000000
solana-vault async fulfill-deposit my-vault --owner <PUBKEY>
solana-vault async claim-deposit my-vault --owner <PUBKEY>
solana-vault async request-redeem my-vault -s 500000
solana-vault async set-operator my-vault --operator <PUBKEY>

Global flags: --dry-run, --yes, --output json, --keypair <path>, --url <rpc>

Core Operations

| Operation | User Action | Rounding | Favors | |-----------|-------------|----------|--------| | deposit | Pay exact assets → receive shares | Floor | Vault | | mint | Receive exact shares → pay assets | Ceiling | Vault | | withdraw | Receive exact assets → burn shares | Ceiling | Vault | | redeem | Burn exact shares → receive assets | Floor | Vault |

Architecture

+--------------------------------------------------------------------+
|                    Solana Vault Standard                           |
+------------------

Related Skills

View on GitHub
GitHub Stars24
CategoryDevelopment
Updated18d ago
Forks35

Languages

TypeScript

Security Score

95/100

Audited on Jul 21, 2026

No findings