Fee Manager
Last updated
Last updated
The FeeManager serves as the central collection point for protocol fees across the Curvance ecosystem. It acts as a unified hub for aggregating fees generated from various protocol operations.
Protocol Revenue Streams: Fees collected from lending/borrowing operations, liquidations, and other protocol services flow into the FeeManager
Reward Token Registry: The contract maintains a registry of valid reward tokens that can be accepted as fees, enabling flexibility in fee collection
Storage Architecture:
rewardTokens: Array of supported token addresses
rewardTokenInfo: Mapping tracking token status (including OTC eligibility)
Before cross-chain distribution, collected fees may need transformation into the protocol's primary fee token.
Permissioned Swap Execution: Authorized harvesters can initiate swaps through the multiSwap function
OTC Protection: Tokens marked for OTC are protected from automated swaps
Token Verification: Ensures input tokens are registered reward tokens and output is the fee token
Price Oracle Integration: Uses Oracle Manager to determine fair market value for OTC transactions
Token Earmarking: Tokens can be marked as "for OTC" (value=2), preventing them from being swapped
Price Protection: Includes slippage control and deadline validation to ensure fair execution
The cross-chain distribution of fees is coordinated between the FeeManager and MessagingHub.
MessagingHub Pull: The MessagingHub calls pullFees() to retrieve the collected fee tokens
Fee Allocation:
Compounding fees are allocated to DAO address for harvester bot operations
Remaining fees are sent to MessagingHub for cross-chain distribution
Cross-Chain Transfer:
MessagingHub uses Circle's CCTP (Cross-Chain Transfer Protocol) and Wormhole for secure cross-chain messaging
Tokens are distributed proportionally based on veCVE points across chains
Epoch Management:
Rewards are distributed during epoch executions based on veCVE points on each chain
Wormhole's Cross-Chain Query (CCQ) gathers data about locked tokens across chains
Circle CCTP: Used for transferring fee tokens across chains
Wormhole: Provides the messaging infrastructure for cross-chain communications
Wormhole CCQ: Enables querying of lock points data from other chains
FeeManager leverages external liquidity sources to optimize token swaps
Offchain Solvers: Integration with 1inch and potentially other solvers for optimized swap routing
Swap Safety:
SwapperLib.swapSafe()
enforces validation rules
External calldata checker verifies swap transactions
Token approvals are managed automatically
Permissioned Access: Only authorized harvester addresses can execute swaps
Swap Verification:
Validates input/output tokens match expected values
Strict swap parameter validation prevents malicious transactions
The FeeManager's cross-chain architecture enables Curvance to maintain a unified fee management system across multiple blockchains, ensuring proportional reward distribution and efficient token handling throughout the protocol ecosystem.