Architecture

Explore the Dnipro v2 routing path, Registry-gated adapter model, live Devnet proof, and remaining production work.

System Overview

Dnipro is organized as two core Anchor programs plus adapter programs:

1. Dispatcher — the wallet-facing entry point for deposit(amount) and withdraw(amount). It owns per-user position PDAs and performs CPI only after validating the selected route against Registry.

2. Registry — a governance-controlled allowlist. Each record binds an adapter program to its underlying mint, state PDA, token vault, vault authority, and active status.

3. Adapters — programs behind the common Dnipro route interface. The included Dnipro USDC Devnet Vault is the live end-to-end proof. Kamino, MarginFi, Jupiter, Maple/Syrup, and Drift remain reference integrations until their protocol-specific CPIs are implemented and verified.

PDA Model

The live v2 path uses deterministic Program Derived Addresses:

AccountSeedsProgramDescription
`DispatcherConfig``["dispatcher_config_v2"]`DispatcherAdmin, Registry program, pause state
`DispatcherAuthority``["dispatcher_authority_v2"]`DispatcherCPI signer accepted by adapters
`Position``["position_v2", user, adapter_program_id]`DispatcherPer-user per-adapter test-USDC position
`RegistryConfig``["registry_config_v2"]`RegistryGovernance authority, adapter count
`AdapterRecord``["adapter_v2", adapter_program_id]`RegistryProgram, mint, state, vault, authority, active status
`AdapterState``["adapter_state_v1"]`AdapterAdapter admin/config and routed deposits
`AdapterVault``["vault_v1"]`AdapterProgram-controlled SPL-token vault
`VaultAuthority``["vault_authority_v1"]`AdapterPDA that signs vault withdrawals

Instruction Set

Dispatcher Instructions: - initialize(registry_program) — initializes v2 config and Dispatcher authority PDA - deposit(amount) — validates Registry record, CPIs to adapter, updates Position - withdraw(amount) — validates Registry record, CPIs to adapter, updates Position - set_paused(paused) — admin emergency control

Registry Instructions: - initialize_registry() — initializes governance config - register_adapter(name) — creates the Registry record for one deployed adapter - set_adapter_active(active) — governance-controlled route status

Live adapter interface: - initialize_adapter() — creates adapter state and SPL-token vault - adapter_deposit(amount) — receives tokens only from a CPI authorized by the Dispatcher PDA - adapter_withdraw(amount) — returns tokens from the vault using the adapter vault-authority PDA

Registry-gated Routing

The Dispatcher does not accept an arbitrary adapter as a trusted route. Before CPI it derives the expected Registry record PDA and verifies:

- the Registry program owns the record; - the record was derived for the supplied adapter program; - the record's underlying mint matches the transaction mint; - the adapter state, vault, and vault-authority accounts match the registered accounts; - the adapter is active.

Only after those checks does the Dispatcher sign the adapter CPI with dispatcher_authority_v2. The live adapter stores that authority during initialization and rejects direct withdrawal/deposit calls that do not carry the Dispatcher PDA signature.

Live Devnet Route

The current Colosseum demo uses Circle-compatible Solana Devnet test USDC and a Dnipro-owned vault adapter.

A successful live deposit proves:

wallet → Dispatcher → Registry validation → adapter CPI → SPL vault → Position PDA → confirmed Solana signature

A withdrawal follows the same path in reverse and is constrained by the user's Dispatcher position.

The live vault is deliberately not described as a yield-bearing protocol. It proves the common routing standard and keeps protocol claims honest while the external venue adapters are completed.

Security & Current Limits

Controls in the live v2 demo path: - Registry-gated adapter routing - Program-executable checks for registered adapters - Dispatcher-only adapter authorization through a PDA signer - Per-user Position PDAs - SPL token mint/authority constraints - Adapter active/inactive control - Dispatcher pause control - Checked arithmetic for position/vault accounting

Current limits: - The Devnet vault is a routing proof, not an external yield strategy - Kamino, MarginFi, Jupiter, Maple/Syrup, and Drift are still reference integrations - The demo path uses a single underlying mint (Devnet USDC) - Upgrade authorities/governance are appropriate for a hackathon Devnet build, not a production treasury - No program in this repository should be represented as audited or mainnet-ready until independent review and protocol-specific testing support that claim

Adapter Interface Standard

The v2 live adapter contract is intentionally small. A compatible adapter receives a Dispatcher-authority signer plus the user and token accounts:

pub fn adapter_deposit(
    ctx: Context<RouteTokens>,
    amount: u64,

pub fn adapter_withdraw( ctx: Context, amount: u64, ) -> Result<()> ```

A production protocol adapter can replace the Devnet vault's direct SPL transfer with protocol-specific CPI while keeping the same Dispatcher-facing route. That is the core Dnipro abstraction: the app integrates the Dispatcher once while adapters absorb venue-specific account and instruction complexity.