Skip to main content
Use CPI when your Solana program must call Dynamic Fee Sharing directly, for example to create a vault, fund a vault from program-controlled token accounts, or claim fees as part of a larger protocol instruction.

Program ID

Generated Bindings

For a Rust program in the same workspace, enable the Dynamic Fee Sharing program crate with the cpi feature:
For local development inside the program repository:
The crate name in Rust code is dynamic_fee_sharing.

CPI Pattern

Anchor generates CPI helpers for the program instructions. Account structs use the same names as the instruction contexts in the Dynamic Fee Sharing source.
Instructions marked with #[event_cpi] require the event-CPI accounts generated by Anchor. If you construct CPI calls manually, include the Dynamic Fee Sharing event authority and program accounts expected by the IDL.

Common CPI Calls

Account Requirements

Source-Program Funding

fund_by_claiming_fee is the most account-order-sensitive CPI path. The handler validates: Whitelisted actions are DAMM v2 claim_position_fee, DAMM v2 claim_reward, and DBC creator/partner trading fee, surplus, and migration fee withdrawals.

Token Programs

Common CPI Failures

Best Practices