Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.meteora.ag/llms.txt

Use this file to discover all available pages before exploring further.

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

InstructionParametersMain signersBehavior
initialize_fee_vaultparams: InitializeFeeVaultParametersfee_vault, payerCreates a non-PDA fee vault account and its token vault PDA.
initialize_fee_vault_pdaparams: InitializeFeeVaultParametersbase, payerCreates a deterministic PDA fee vault from base and token_mint, plus its token vault PDA.
fund_feemax_amount: u64funderTransfers up to max_amount from the funder’s token account into the vault and updates fee-per-share accounting.
fund_by_claiming_feepayload: Vec<u8>signerInvokes a whitelisted DAMM v2 or DBC instruction with the PDA fee vault as signer, then credits the token vault balance increase.
claim_feeindex: u8userClaims the user’s currently available fee amount for the configured user index.

Initialize Non-PDA Fee Vault

AccountWritableSignerNotes
fee_vaultYesYesNew external account initialized with 8 + FeeVault::INIT_SPACE bytes.
fee_vault_authorityNoNoPDA from ["fee_vault_authority"].
token_vaultYesNoPDA token account from ["token_vault", fee_vault].
token_mintNoNoMint for the fee vault. Must be supported by the token utility.
ownerNoNoStored in the FeeVault account.
payerYesYesPays rent for the new accounts.
token_programNoNoSPL Token or Token 2022 program for token_mint.
system_programNoNoSystem program.
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

AccountWritableSignerNotes
fee_vaultYesNoPDA from ["fee_vault", base, token_mint].
fee_vault_authorityNoNoPDA from ["fee_vault_authority"].
token_vaultYesNoPDA token account from ["token_vault", fee_vault].
token_mintNoNoMint for the fee vault.
ownerNoNoStored in the FeeVault account.
baseNoYesSeed signer used to derive the fee vault PDA.
payerYesYesPays rent for the new accounts.
token_programNoNoSPL Token or Token 2022 program for token_mint.
system_programNoNoSystem program.
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

AccountWritableSignerNotes
fee_vaultYesNoMust have token_vault and token_mint relations.
token_vaultYesNoFee vault token account.
token_mintNoNoFee vault mint.
fund_token_vaultYesNoFunder’s token account. The transferred amount is capped by its balance.
funderNoYesToken authority for fund_token_vault.
token_programNoNoToken program for checked transfer.
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.
AccountWritableSignerNotes
fee_vaultYesNoMust be a PDA fee vault. Used as a signer for the downstream invocation.
token_vaultYesNoFee vault token account. The handler measures this balance before and after the downstream CPI.
signerNoYesMust be one of the configured shareholders in the fee vault.
source_programNoNoWhitelisted DAMM v2 or DBC program.
Remaining accountsVariesVariesPassed directly to the downstream instruction. One expected account must equal token_vault.
The first 8 bytes of payload must be the downstream Anchor instruction discriminator.

Whitelisted Source Actions

Source programDownstream instructionExpected token_vault remaining-account indexSDK wrapper
DAMM v2 cp_ammclaim_position_fee4fundByClaimDammV2Fee
DAMM v2 cp_ammclaim_reward5fundByClaimDammV2Reward
DBC dynamic_bonding_curvecreator_withdraw_surplus3fundByWithdrawDbcCreatorSurplus
DBC dynamic_bonding_curveclaim_creator_trading_fee3fundByClaimDbcCreatorTradingFee
DBC dynamic_bonding_curvepartner_withdraw_surplus3fundByWithdrawDbcPartnerSurplus
DBC dynamic_bonding_curveclaim_trading_fee4fundByClaimDbcPartnerTradingFee
DBC dynamic_bonding_curvewithdraw_migration_fee3fundByWithdrawDbcMigrationFee
The index is zero-based within the remaining accounts passed to fund_by_claiming_fee.

User Claim

AccountWritableSignerNotes
fee_vaultYesNoMust have token_vault and token_mint relations.
fee_vault_authorityNoNoMust equal EYqHRdtepv1KKUkPAYMBYpSfiGfNd8sa55ZtswodTfBS.
token_vaultYesNoSource token account controlled by fee vault authority.
token_mintNoNoFee vault mint.
user_token_vaultYesNoDestination token account.
userNoYesMust match fee_vault.users[index].address.
token_programNoNoToken program for checked transfer.
If the calculated claim amount is zero, the instruction updates no tokens and emits no claim event.

Validation

AreaRule
User countVault initialization requires at least 2 and at most 5 users.
User shareEach share must be greater than zero.
User addressEach address must be non-default.
Mint supportSPL Token mints are supported. Token 2022 mints are supported only with transfer-fee, metadata-pointer, and token-metadata extensions.
Direct fundingmax_amount is capped by the funder’s token account balance.
Source fundingOnly PDA fee vaults can be used, the signer must be a configured shareholder, and the downstream action must be whitelisted.
ClaimsThe index must exist in the fixed user array and the signer must match that user entry.