Off-chain Architecture
The off-chain stack is where most of the operational intelligence lives.Shared layer
services/shared/ provides:
- domain types
- sample registry and live snapshot config
- math helpers
- deterministic hashing
.envloading- execution step helpers
Adapters
services/adapters/ exposes a common StrategyAdapter interface for all strategies.
Current adapter types
DriftStrategyAdapterKaminoStrategyAdapterManifestStrategyAdapterStaticStrategyAdapter
Why adapters matter
The solver should not care whether a strategy uses:- direct SDK instructions
- pre-authored instruction manifests
- static placeholders during development
ExecutionStep objects.
Solver
services/solver/ builds a deterministic rebalance plan.
The solver:
- consumes snapshots and policy constraints
- computes expected net APY and haircuts
- ranks strategies
- assigns target weights within limits
- builds execution steps using the adapter catalog
- hashes the plan, target weights, and transaction bundle
Ranger
services/ranger/ is the execution runtime.
It is responsible for:
- loading signers
- building Solana connections
- preparing vault instructions
- sending protocol instruction bundles
- persisting rebalance proofs through the vault program client
Manifest path for partially integrated protocols
MarginFi and Perena use a bridge layer:
- if a manifest exists, Ranger can execute the provided raw envelopes
- if no manifest exists, the adapter falls back to a static placeholder step
Operator CLIs
The repo includes CLIs for:- diagnostics
- protocol smoke tests
- direct Drift send
- vault bootstrap
- vault administration
- vault user actions
- vault state inspection