Reward Manager
Last updated
Last updated
The Curvance Protocol operates on a biweekly (2-week) epoch cycle for distributing rewards point amounts across all supported chains. This process is coordinated by the MessagingHub contract which serves as the cross-chain communication layer.
Key aspects:
Each epoch lasts exactly 2 weeks as defined by EPOCH_DURATION
in the CentralRegistry.
The MessagingHub coordinates epoch transitions by querying points across all chains.
The RewardManager tracks which epoch's rewards have been delivered using nextEpochToDeliver
.
State transitions occur when the MessagingHub calls recordEpochRewards()
with the calculated reward amounts.
State machine:
Rewards are distributed proportionally across all chains based on the amount of points on each chain.
Key aspects:
The MessagingHub uses Wormhole's Cross-Chain Query (CCQ) to get accurate point counts from all chains.
Reward distribution is calculated as: (Chain's Points / Total Points) * Total Rewards
.
Each chain receives a pro-rata share of the total protocol fees based on its proportion of points.
This creates an incentive for chains to accumulate points to increase their share of rewards.
Data flow:
The system allows users to accumulate rewards over multiple epochs without having to claim them immediately.
Key aspects:
Each user has a userNextClaimIndex
that tracks the next epoch they can claim rewards from.
epochRewardsPerPoint
records the rewards allocated per point for each epoch.
Users can claim multiple epochs of accumulated rewards in a single transaction.
The formula for a user's rewards for an epoch is: (User's Points * epochRewardsPerPoint[epoch]) / WAD
.
The cross-chain movement of rewards (primarily USDC) is handled through Circle's Cross-Chain Transfer Protocol (CCTP) and Wormhole's messaging system.
Key aspects:
The protocol uses CCTP to transfer USDC between chains, ensuring secure token transfers.
Wormhole's automatic relayer system delivers cross-chain messages with execution guarantees.
The MessagingHub sends both USDC tokens via CCTP and reward metadata via Wormhole.
When a chain receives USDC, it routes the tokens to its local RewardManager.
Cross-chain token flow:
This architecture ensures that rewards are efficiently distributed across chains while maintaining a consistent state of reward records throughout the entire protocol.