Skip to main content

Build a Bear Vault

Build a Bear Vault is a USDC-denominated multi-strategy vault for Solana. The project combines:
  • an on-chain Anchor program that enforces vault state, policies, shares, withdrawals, and rebalance proofs
  • an off-chain deterministic solver that computes target allocations
  • a Ranger execution layer that builds and sends protocol transactions
  • protocol adapters for Drift, Kamino, MarginFi, and Perena

What this repo already includes

  • Anchor program for vault state, policy controls, share minting, and rebalance proof storage
  • Deterministic solver and backtester in TypeScript
  • Real SDK-backed execution bundle builders for Drift and Kamino
  • Manifest-based path for MarginFi and Perena
  • Vault bootstrap, admin, user, and status CLIs
  • Offline test suite for solver, adapters, vault serialization, and operator CLIs

Core design

The vault follows three strong rules:
  1. Policy before optimization
  2. Deterministic before adaptive
  3. Proofs on-chain, heavy compute off-chain
That means the solver does the expensive decision-making off-chain, while the on-chain program stores and enforces the result.

Main components

On-chain

  • Vault accounts and policies
  • Share mint and vault treasury
  • Strategy registry and allocation state
  • Withdrawal queue
  • Rebalance plan proof and execution proof

Off-chain

  • Strategy adapters
  • Allocation solver
  • Ranger transaction dispatcher
  • COBO MPC simulation layer
  • Historical backtest runner

Supported strategies in the MVP

StrategyRoleCurrent implementation status
drift-reserveLiquid reserve and low-complexity carryReal SDK bundle builder
kamino-stable-carryMain carry sleeveReal SDK bundle builder
marginfi-canaryCanary sleeve with capped exposureManifest or static fallback
perena-exoticExotic / RWA sleeveManifest or static fallback
  1. Quickstart
  2. Current Status
  3. Architecture Overview
  4. Solver Deep Dive
  5. Business Overview
  6. Operations Overview
  7. Testing Overview

Repository map

AreaPurpose
programs/multi_strategy_vault/Anchor program
services/adapters/Protocol integration layer
services/solver/Deterministic optimizer and backtester
services/ranger/Execution runtime and operator CLIs
services/shared/Shared types, math, config, hashing, env loading
tests/offchain/Offline validation suite
config/Sample policies, registry, strategy manifests

Current reality

The repo is code-complete for the MVP scaffold, but production operation still depends on external steps:
  • deploying the Anchor program to a real cluster
  • funding the operator wallets
  • bootstrapping the vault on-chain
  • providing real manifests for MarginFi and Perena
  • optionally replacing the simulated COBO layer with a real MPC integration

Business note

The documentation now separates:
  • implemented protocol and solver economics
  • proposed business-model and revenue assumptions
That distinction matters because the financial thesis is broader than the current fee logic implemented in code.