Dynamic Fee Sharing is a program that allows any project to configure a fee sharing mechanism for their fees earned.

Program Address

  • Mainnet-beta: dfsdo2UqvwfN8DuUVrMRNfQe11VaiNoKcMqLHVvDPzh
  • Devnet: dfsdo2UqvwfN8DuUVrMRNfQe11VaiNoKcMqLHVvDPzh

Resources

Features

Dynamic Fee Vault Creation

Two initialization methods:
  • initialize_fee_vault: Creates a fee vault with a signer keypair
  • initialize_fee_vault_pda: Creates a fee vault using PDA for deterministic addresses
Multi-user support: Supports 2-5 users per vault (configurable via MAX_USER constant)Token compatibility: Supports both SPL Token and Token-2022 standards

Proportional Fee Distribution System

Share-based allocation: Each user has a defined share amount that determines their portion of feesPrecision calculations: Uses 52-bit precision scaling for accurate fee distribution mathDynamic fee accumulation: Tracks fee_per_share to calculate individual user rewards over time

Fee Funding Mechanism

Flexible funding: Anyone can fund fees into the vault via fund_fee instructionTransfer fee handling: Automatically accounts for token transfer fees (important for Token-2022)Amount validation: Ensures funded amounts are greater than zeroReal-time distribution: Fees are immediately distributed proportionally to all users

Individual Fee Claiming

Index-based claiming: Users claim fees using their assigned index (0-4)Authorization: Only the designated user can claim their feesCheckpoint system: Tracks fee_per_share_checkpoint to calculate unclaimed rewardsAccumulated tracking: Maintains running total of claimed fees per user

Token Management

Vault authority: Uses PDA-based authority for secure token operationsToken vault: Dedicated token account for holding feesMulti-token support: Each vault is tied to a specific token mintTransfer utilities: Includes helper functions for token transfers