How It Works
When a vault manager allocates or deallocates funds, the vault program:- Transfers tokens to/from the
vault_strategy_authPDA - Calls your adaptor’s
depositorwithdrawinstruction via CPI - Reads the returned
u64(via Solana’sget_return_data) to track the strategy’s position value
Core Requirements
Every adaptor must implement at minimum these three instructions:| Instruction | Called When | Must Return |
|---|---|---|
initialize | Strategy is first created | Result<()> |
deposit | Vault allocates funds to strategy | Result<u64> — current position value in underlying token terms |
withdraw | Vault deallocates funds from strategy | Result<u64> — remaining position value in underlying token terms |
remaining_accounts or separate transactions, not by the vault program itself.
Key Concept: Strategy = Your Protocol’s State
The vault passes astrategy account to your adaptor. This account maps to your protocol’s own state — a market PDA, a reserve, a lending pool, etc. Your adaptor validates this mapping:
Accounts Passed by the Vault
The vault program always passes these accounts in a fixed order when calling your adaptor: Initialize:payer, vault_strategy_auth (signer), strategy, system_program, + remaining accounts
Deposit / Withdraw: vault_strategy_auth (signer), strategy, vault_asset_mint, vault_strategy_asset_ata, asset_token_program, + remaining accounts
Any additional protocol-specific accounts are appended via remaining_accounts.
Getting Started
Core Components
Required instructions and account structures
Security Considerations
Security best practices for adaptor development