Skip to main content
This guide details the essential components and instructions required to implement a Voltr adaptor. Each adaptor must implement these core components to maintain compatibility with the Voltr vault system.

Required Instructions

Every adaptor must implement these three core instructions:

1. Initialize Instruction

The vault calls this when a strategy is first created. Your adaptor should set up any protocol-specific accounts needed. The vault passes these accounts in order: payer, vault_strategy_auth (signer), strategy, system_program, followed by any remaining accounts.
Key responsibilities:
  • Create protocol-specific accounts (e.g. market state, token mints)
  • Initialize token accounts (e.g. receipt token ATAs)
  • Configure protocol-specific parameters

2. Deposit Instruction

The vault calls this after transferring tokens from idle to the vault_strategy_asset_ata. Your adaptor must deploy those tokens into your protocol and return the current position value as u64. The vault passes these accounts in order: vault_strategy_auth (signer), strategy, vault_asset_mint, vault_strategy_asset_ata, asset_token_program, followed by any remaining accounts.
The returned u64 is critical — the vault uses it to track the strategy’s position value and calculate P&L.

3. Withdraw Instruction

The vault calls this with the amount of underlying tokens to withdraw. Your adaptor must convert this to the protocol’s units (e.g. receipt tokens), execute the withdrawal, and return the remaining position value as u64. The vault passes the same account order as deposit: vault_strategy_auth (signer), strategy, vault_asset_mint, vault_strategy_asset_ata, asset_token_program, followed by remaining accounts.
After the CPI returns, the vault sweeps any tokens in vault_strategy_asset_ata back to idle.

Position Value Calculation

Your adaptor must accurately calculate the position value in underlying token terms. This is the u64 returned by deposit and withdraw. Common patterns:

Additional Instructions

Adaptors are not limited to the three core instructions. Depending on your protocol, you may need:
  • Multi-step withdrawals — Some protocols (e.g. Drift vaults) require a request/withdraw flow. Add request_withdraw and cancel_request_withdraw instructions alongside the core withdraw.
  • Reward harvesting — Add claim_rewards or harvest instructions to collect yield, optionally swapping reward tokens back to the vault’s base asset.
  • Multiple strategy types — A single adaptor can support multiple strategy types within the same protocol. For example, a Drift adaptor can handle vault depositor strategies, spot lending strategies, and curve strategies, each with different instruction sets and seed derivations.
These extra instructions are called directly by the vault manager (not by the vault program) and can interact with the vault’s StrategyInitReceipt for position tracking.

Remaining Accounts

Protocol-specific accounts beyond the fixed ones are passed via remaining_accounts. Common uses:
  • Market/oracle data for equity calculations
  • Protocol state accounts needed for CPI calls
  • Additional token accounts for reward claiming or swaps
Your adaptor receives these as ctx.remaining_accounts and can forward them to protocol CPIs or parse them for position calculations.

Error Handling

Define protocol-specific errors for your adaptor:

Account Validation Patterns

PDA Verification

Verify protocol accounts using seeds constraints:

ATA Verification

Validate associated token accounts:

Implementation Checklist

  • Implemented core three instructions (Initialize, Deposit, Withdraw)
  • Deposit and Withdraw return accurate u64 position values
  • Strategy account correctly maps to protocol state
  • Protocol-specific accounts validated (PDAs, ATAs, ownership)
  • Used checked math operations for all arithmetic
  • Handled token decimal conversions correctly
  • Added any protocol-specific instructions (multi-step withdrawals, reward harvesting, etc.)
  • Remaining accounts correctly parsed and forwarded where needed
  • Tested deposit, withdraw, and edge cases (zero amount, first deposit)