Component: cetus_clmm/rewarder.move
Description
The rewarder module manages liquidity incentives in the concentrated liquidity market maker (CLMM) protocol. It handles the allocation, tracking, and distribution of rewards to liquidity providers based on their contributed liquidity. Reward growth is tracked using Q64.64 fixed-point arithmetic, accumulating proportionally to time and emission amounts per rewarder. When liquidity providers claim rewards (when their price range contains the current pool price), they receive rewards based on their share of total liquidity and withdrawal from the RewarderGlobalVault. For accurate reward distribution, the protocol must maintain sufficient balances for each reward type.
Invariants
Each reward-token type can only be registered once in a
RewarderManager.The
RewarderManagercan have at mostREWARDER_NUM(five) different reward tokens.When increasing emission rate, the vault must contain at least one day's worth of rewards.
Reward-growth values can only increase, never decrease.
Points emissions occur at a fixed rate.
Reward withdrawals cannot exceed available balance.
Only the protocol admin can perform emergency withdrawals.
Reward-settlement calculations skip zero liquidity or zero time-change cases to prevent division by zero.
Test coverage
Cases covered
Adding and registering new reward tokens
Handling reward-token limits (max five rewards)
Proper reward settlement with time passage
Updating emission rates with sufficient balance validation
Deposit and withdrawal of reward tokens
Points-system accumulation and tracking
Emergency withdrawal by admin
Time validation in reward settlement