The Dynamic Fee Sharing program allows for the creation of fee vaults where collected fees can be automatically distributed among multiple recipients based on predetermined share allocations.

Key Features

Secure Fee Management

On-chain fee collection and distribution with support for both SPL tokens and Token-2022 tokens. Features precise mathematical calculations with overflow protection and immutable share configurations after initialization.

Multi-User Support

Support for 2-5 users per fee vault with configurable share allocations for each user. Includes individual claim tracking to prevent double claims and user-specific checkpoints for accurate fee distribution.

Flexible Fee Distribution

Real-time fee accumulation with pro-rata distribution based on share percentages. Uses lazy evaluation for gas efficiency and supports partial funding and claiming.

Core Components

  1. Fee Vault: The main account that stores user shares, accumulated fees, and distribution state
  2. Token Vault: A PDA-controlled token account that holds the actual fee tokens
  3. Fee Vault Authority: A PDA that controls the token vault for secure transfers