Skip to main content
Use CPI when your Solana program must call Dynamic Vault directly, for example to deposit user funds into a vault, withdraw vault LP, or compose vault withdrawals as part of a larger protocol instruction.
Prefer generated Anchor bindings from the IDL and compare account metas against SDK-built instructions. Most CPI failures come from wrong PDA seeds, a stale LP mint, a missing fee vault, or strategy-specific remaining accounts in the wrong order.

Program ID

The public program ID is the same on mainnet and devnet.

CPI Scope

For off-chain apps, use the TypeScript SDK. For on-chain CPI, your program owns the outer validation, signer seeds, and slippage thresholds.

Deposit CPI Accounts

deposit uses DepositWithdrawLiquidity. Arguments:

Withdraw CPI Accounts

withdraw uses the same DepositWithdrawLiquidity accounts. Your program should calculate or validate unmint_amount in LP units. To withdraw a target underlying amount, convert using current unlocked amount and LP supply.

Direct Strategy Withdrawal CPI

withdraw_directly_from_strategy is used when vault reserve liquidity is not enough and the transaction should pull from a strategy first. Direct strategy withdrawal can refine the LP burn amount if the strategy cannot return the full desired amount. It rejects precision loss greater than one underlying unit.

Vault Signer Seeds

The vault signs token transfers and LP minting with:
If your program signs for a PDA-owned user token account in the outer CPI, pass your own signer seeds to the outer token account authority as well. The vault program only signs for vault-owned accounts.

Account Planning

Rebalance CPI Notes

Strategy rebalance instructions are admin/operator flows and require vault.admin == operator or vault.operator == operator.

Common CPI Failures

Testing

For public partner integrations, keep the CPI surface narrow: deposit, reserve withdrawal, and carefully audited direct strategy withdrawal only when your protocol truly needs it.