Fee Management Overview
Architecture
┌─────────────────────────────────────────────────────────────────────────────┐
│ SWAP EXECUTION │
│ │
│ User → SwapRouter → VinuSwapPool.swap() │
│ │ │
│ ▼ │
│ ┌─────────────────┐ │
│ │ feeManager │ ← IFeeManager.computeFee(fee) │
│ └────────┬────────┘ │
│ │ │
│ ┌────────────────┼────────────────┐ │
│ ▼ ▼ ▼ │
│ ┌─────────────────┐ ┌──────────────┐ ┌───────────────────────┐ │
│ │ TieredDiscount │ │ NoDiscount │ │ OverridableFeeManager │ │
│ │ Balance-based │ │ Passthrough │ │ Per-pool routing │ │
│ │ discounts │ │ │ │ │ │
│ └─────────────────┘ └──────────────┘ └───────────────────────┘ │
└─────────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────┐
│ FEE COLLECTION │
│ │
│ Pool.protocolFees → Controller.collectProtocolFees() │
│ │ │
│ ▼ │
│ ┌─────────────────┐ │
│ │ Controller │ │
│ │ Fee Distribution│ │
│ └────────┬────────┘ │
│ │ │
│ ┌────────────────┼────────────────┐ │
│ ▼ ▼ ▼ │
│ ┌─────────┐ ┌─────────┐ ┌─────────┐ │
│ │Account 1│ │Account 2│ │Account 3│ │
│ │Share: 1 │ │Share: 2 │ │Share: 2 │ │
│ └─────────┘ └─────────┘ └─────────┘ │
└─────────────────────────────────────────────────────────────────────────────┘Components
IFeeManager Interface
TieredDiscount
OverridableFeeManager
Controller
Fee Flow
1. Swap Fee Application
2. Protocol Fee Split
3. Fee Distribution
Configuration
Setting Up Fee Management
Setting Protocol Fees
Collecting Fees
Fee Manager Implementations
NoDiscount
Custom Fee Managers
Security Considerations
Fee Manager Trust
Protocol Fee Bounds
Controller Access
Best Practices
Related
Last updated