Skip to main content
The dynamic_fee_sharing program exposes the instructions below. Integrators should use the TypeScript SDK for normal transaction construction, or build through CPI.

Instruction Summary

Initialize Non-PDA Fee Vault

params.users must contain 2 to 5 entries. Each UserShare.address must be non-default, and each UserShare.share must be greater than zero.

Initialize PDA Fee Vault

Use PDA fee vaults when the fee vault must sign downstream source-program instructions, such as DAMM v2 fee claims or DBC fee withdrawals.

Direct Funding

fund_fee transfers min(max_amount, fund_token_vault.amount). If the resulting amount is zero, the instruction returns AmountIsZero. For Token 2022 transfer-fee mints, the vault credits the transfer-fee excluded amount to total_funded_fee and fee_per_share.

Source-Program Funding

fund_by_claiming_fee is a wrapper for whitelisted source-program actions. The caller passes the downstream instruction data as payload and the downstream account metas as remaining accounts. The first 8 bytes of payload must be the downstream Anchor instruction discriminator.

Whitelisted Source Actions

The index is zero-based within the remaining accounts passed to fund_by_claiming_fee.
A fee vault is designed to support a single token mint and a single token vault. fund_by_claiming_fee credits only the balance increase of the fee vault’s token_vault, and the whitelist check pins exactly one token account of the downstream instruction to it. The source pool’s CollectFeeMode must therefore collect fees only in the fee vault’s token mint: OnlyB or Compounding for DAMM v2 and QuoteToken for DBC.

User Claim

If the calculated claim amount is zero, the instruction updates no tokens and emits no claim event.

Validation