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.

This page summarizes the dynamic_fee_sharing account model from the local Anchor source and SDK IDL. For generated TypeScript layouts, use the account types exported by @meteora-ag/dynamic-fee-sharing-sdk.

Address Map

AddressHow it is chosenUse
FeeVaultExternal signer account for non-PDA vaults, or PDA from ["fee_vault", base, token_mint] for PDA vaultsMain zero-copy state for one token fee sharing configuration.
Fee vault authorityPDA from ["fee_vault_authority"]Program signer authority for vault token transfers.
Token vaultPDA token account from ["token_vault", fee_vault]Holds the funded token mint for the fee vault.
Event authorityAnchor event-CPI PDA from ["__event_authority"]Required by event-emitting instructions as generated by Anchor clients.

PDA Seeds

SDK helperSeedsReturnsUse
deriveFeeVaultAuthorityAddress()["fee_vault_authority"]PublicKeyProgram-wide authority over token vault accounts.
deriveTokenVaultAddress(feeVault)["token_vault", fee_vault]PublicKeyToken account PDA for a fee vault.
deriveFeeVaultPdaAddress(base, tokenMint)["fee_vault", base, token_mint]PublicKeyDeterministic PDA fee vault address.
deriveDammV2EventAuthorityAddress()["__event_authority"] under the DAMM v2 programPublicKeyHelper for DAMM v2 source-program account lists.

Constants

ConstantValueMeaning
DYNAMIC_FEE_SHARING_PROGRAM_IDdfsdo2UqvwfN8DuUVrMRNfQe11VaiNoKcMqLHVvDPzhProgram ID on mainnet and devnet.
Fee vault authorityEYqHRdtepv1KKUkPAYMBYpSfiGfNd8sa55ZtswodTfBSPDA derived from FEE_VAULT_AUTHORITY_PREFIX.
MAX_USER5Maximum number of configured shareholders.
Minimum users2Minimum number of configured shareholders enforced during initialization.
PRECISION_SCALE64Fixed-point scale used for fee_per_share accounting.
FEE_VAULT_PREFIXfee_vaultSeed prefix for PDA fee vaults.
FEE_VAULT_AUTHORITY_PREFIXfee_vault_authoritySeed prefix for the program token authority.
TOKEN_VAULT_PREFIXtoken_vaultSeed prefix for vault token accounts.
FeeVault::INIT_SPACE640 bytesAccount data size before the Anchor discriminator.
UserFee::INIT_SPACE80 bytesPer-user fixed-size share record inside FeeVault.

FeeVault

FeeVault is the primary zero-copy account. Padding fields are omitted from this table.
FieldTypeUse
ownerPubkeyOwner recorded during vault initialization. The current program does not expose an owner-only management instruction.
token_mintPubkeyMint accepted by the vault and paid out to users.
token_vaultPubkeyToken account PDA that stores funded fees.
token_flagu8Token program flag: 0 SPL Token, 1 Token 2022.
fee_vault_typeu8Fee vault type: 0 non-PDA account, 1 PDA account.
fee_vault_bumpu8PDA bump for PDA fee vaults. Non-PDA vaults store 0.
total_shareu32Sum of all configured user shares.
total_funded_feeu64Total token amount credited to the fee vault after transfer-fee adjustments.
fee_per_shareu128Accumulated Q64 fixed-point fee per share.
basePubkeyBase signer used in the PDA fee vault seeds. Non-PDA vaults store the default public key.
users[UserFee; 5]Fixed array of shareholder records. Unused slots remain defaulted.

UserFee

FieldTypeUse
addressPubkeyShareholder address allowed to claim at this user index.
shareu32Share weight for fee distribution.
fee_claimedu64Total amount this user has claimed.
fee_per_share_checkpointu128User checkpoint used to calculate the next claimable amount.

Initialization Parameters

TypeFieldRule
InitializeFeeVaultParameterspadding: [u64; 8]Reserved for future use. SDK callers pass an empty array, which Anchor serializes for the fixed array.
InitializeFeeVaultParametersusers: Vec<UserShare>Must contain at least 2 and at most 5 users.
UserShareaddress: PubkeyMust not be the default public key.
UserShareshare: u32Must be greater than zero.
The program validates the number of users, nonzero shares, and non-default addresses. It does not enforce unique user addresses, so integrations should validate duplicate shareholder addresses before initialization.

Share Accounting

StepProgram behavior
FundingAdds the credited token amount to total_funded_fee.
Fee-per-share updateAdds (amount << 64) / total_share to fee_per_share.
Claim calculationUses share * (fee_per_share - fee_per_share_checkpoint) >> 64.
Claim checkpointUpdates the user’s fee_per_share_checkpoint to the current vault fee_per_share.
Claim counterAdds the claimed amount to user.fee_claimed.
Amounts are raw token units. Apply mint decimals off-chain for display.

Token Support

Token behaviorSupport
SPL TokenSupported.
Token 2022 transfer feeSupported for direct funding. The credited amount excludes the current epoch transfer fee.
Token 2022 metadata pointerSupported mint extension.
Token 2022 token metadataSupported mint extension.
Other Token 2022 extensionsRejected by is_supported_mint.
Native SOLSupported through wrapped SOL token accounts in the TypeScript SDK helpers.

Vault Type Behavior

BehaviorNon-PDA fee vaultPDA fee vault
AddressExternal keypair accountPDA from base and token_mint.
Initialization signerfee_vault signs.base signs.
base state fieldDefault public key.The base signer public key.
Direct fund_feeSupported.Supported.
claim_feeSupported.Supported.
fund_by_claiming_feeNot supported by program validation.Supported when the source action is whitelisted and the signer is a shareholder.