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
| Address | How it is chosen | Use |
|---|
FeeVault | External signer account for non-PDA vaults, or PDA from ["fee_vault", base, token_mint] for PDA vaults | Main zero-copy state for one token fee sharing configuration. |
| Fee vault authority | PDA from ["fee_vault_authority"] | Program signer authority for vault token transfers. |
| Token vault | PDA token account from ["token_vault", fee_vault] | Holds the funded token mint for the fee vault. |
| Event authority | Anchor event-CPI PDA from ["__event_authority"] | Required by event-emitting instructions as generated by Anchor clients. |
PDA Seeds
| SDK helper | Seeds | Returns | Use |
|---|
deriveFeeVaultAuthorityAddress() | ["fee_vault_authority"] | PublicKey | Program-wide authority over token vault accounts. |
deriveTokenVaultAddress(feeVault) | ["token_vault", fee_vault] | PublicKey | Token account PDA for a fee vault. |
deriveFeeVaultPdaAddress(base, tokenMint) | ["fee_vault", base, token_mint] | PublicKey | Deterministic PDA fee vault address. |
deriveDammV2EventAuthorityAddress() | ["__event_authority"] under the DAMM v2 program | PublicKey | Helper for DAMM v2 source-program account lists. |
Constants
| Constant | Value | Meaning |
|---|
DYNAMIC_FEE_SHARING_PROGRAM_ID | dfsdo2UqvwfN8DuUVrMRNfQe11VaiNoKcMqLHVvDPzh | Program ID on mainnet and devnet. |
| Fee vault authority | EYqHRdtepv1KKUkPAYMBYpSfiGfNd8sa55ZtswodTfBS | PDA derived from FEE_VAULT_AUTHORITY_PREFIX. |
MAX_USER | 5 | Maximum number of configured shareholders. |
| Minimum users | 2 | Minimum number of configured shareholders enforced during initialization. |
PRECISION_SCALE | 64 | Fixed-point scale used for fee_per_share accounting. |
FEE_VAULT_PREFIX | fee_vault | Seed prefix for PDA fee vaults. |
FEE_VAULT_AUTHORITY_PREFIX | fee_vault_authority | Seed prefix for the program token authority. |
TOKEN_VAULT_PREFIX | token_vault | Seed prefix for vault token accounts. |
FeeVault::INIT_SPACE | 640 bytes | Account data size before the Anchor discriminator. |
UserFee::INIT_SPACE | 80 bytes | Per-user fixed-size share record inside FeeVault. |
FeeVault
FeeVault is the primary zero-copy account. Padding fields are omitted from this table.
| Field | Type | Use |
|---|
owner | Pubkey | Owner recorded during vault initialization. The current program does not expose an owner-only management instruction. |
token_mint | Pubkey | Mint accepted by the vault and paid out to users. |
token_vault | Pubkey | Token account PDA that stores funded fees. |
token_flag | u8 | Token program flag: 0 SPL Token, 1 Token 2022. |
fee_vault_type | u8 | Fee vault type: 0 non-PDA account, 1 PDA account. |
fee_vault_bump | u8 | PDA bump for PDA fee vaults. Non-PDA vaults store 0. |
total_share | u32 | Sum of all configured user shares. |
total_funded_fee | u64 | Total token amount credited to the fee vault after transfer-fee adjustments. |
fee_per_share | u128 | Accumulated Q64 fixed-point fee per share. |
base | Pubkey | Base 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
| Field | Type | Use |
|---|
address | Pubkey | Shareholder address allowed to claim at this user index. |
share | u32 | Share weight for fee distribution. |
fee_claimed | u64 | Total amount this user has claimed. |
fee_per_share_checkpoint | u128 | User checkpoint used to calculate the next claimable amount. |
Initialization Parameters
| Type | Field | Rule |
|---|
InitializeFeeVaultParameters | padding: [u64; 8] | Reserved for future use. SDK callers pass an empty array, which Anchor serializes for the fixed array. |
InitializeFeeVaultParameters | users: Vec<UserShare> | Must contain at least 2 and at most 5 users. |
UserShare | address: Pubkey | Must not be the default public key. |
UserShare | share: u32 | Must 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
| Step | Program behavior |
|---|
| Funding | Adds the credited token amount to total_funded_fee. |
| Fee-per-share update | Adds (amount << 64) / total_share to fee_per_share. |
| Claim calculation | Uses share * (fee_per_share - fee_per_share_checkpoint) >> 64. |
| Claim checkpoint | Updates the user’s fee_per_share_checkpoint to the current vault fee_per_share. |
| Claim counter | Adds the claimed amount to user.fee_claimed. |
Amounts are raw token units. Apply mint decimals off-chain for display.
Token Support
| Token behavior | Support |
|---|
| SPL Token | Supported. |
| Token 2022 transfer fee | Supported for direct funding. The credited amount excludes the current epoch transfer fee. |
| Token 2022 metadata pointer | Supported mint extension. |
| Token 2022 token metadata | Supported mint extension. |
| Other Token 2022 extensions | Rejected by is_supported_mint. |
| Native SOL | Supported through wrapped SOL token accounts in the TypeScript SDK helpers. |
Vault Type Behavior
| Behavior | Non-PDA fee vault | PDA fee vault |
|---|
| Address | External keypair account | PDA from base and token_mint. |
| Initialization signer | fee_vault signs. | base signs. |
base state field | Default public key. | The base signer public key. |
Direct fund_fee | Supported. | Supported. |
claim_fee | Supported. | Supported. |
fund_by_claiming_fee | Not supported by program validation. | Supported when the source action is whitelisted and the signer is a shareholder. |