The RewardsDistributor contract serves multiple purposes in the Metronome protocol. It allocates rewards to users who deposit collateral or create synths and collaborates with both DepositToken (suppliers) and DebtToken (borrowers) contracts. It also not only tracks each user's right to rewards, considering the number of tokens they have deposited or generated and the holding duration, but also calculates and updates index values for eligible tokens based on their total supply and holding period. These index values are utilized to determine each user's share of rewards, which can be claimed as reward tokens and transferred to their wallets.
To support reward management, the contract includes several functions, such as updating token speeds and determines the claimable amount for each user. Additionally, it features modifiers that ensure access is limited to authorized accounts and the appropriate token contracts are used.
The Metronome protocol is also designed to interact with Vesper in order to issue rewards. If a user deposits a Vesper pool asset, like vaUSDC, it will still drip those rewards to the user. This ensures that users don't miss out on Vesper pool rewards when they choose to interact with Metronome.
The rewards accrual rate in the Metronome ecosystem is synchronized with the Vesper reward rate approximately every 48 hours. Please note that Metronome doesn't guarantee that the reward rates will match exactly. If deposits or withdrawals occur between two sync calls, the rewards rate may differ from the rate in the Vesper pool until the next sync call.
Here's how it works:
Deposit: When you deposit vaUSDC in the Metronome ecosystem, the underlying smart contracts are triggered to interact with the RewardsDistributor contract. This deposit kickstarts the rewards process, earning you rewards at the rate defined in the RewardsDistributor contract for this particular asset.
Reward Accrual: Your reward earnings are tracked and calculated by the RewardsDistributor contract. This calculates your share of rewards considering the number of tokens you've deposited and the duration of the deposit.
Syncing: The rewards rate is synced with the Vesper pool rewards rate approximately every 48 hours.
Claiming rewards within the Metronome system is an ongoing process. Users who deposit vaUSDC for example into Metronome begin accruing rewards, however, the Metronome contracts must first claim the rewards from Vesper. Currently, this is scheduled every one to two weeks, but future updates will automate the Synth contract, eliminating any lag.
Keep in mind that the balance of reward tokens in the RewardsDistributor contract may sometimes be less than the sum of the rewards claimable by all users. This discrepancy happens because the Vesper rewards for vaUSDC have not yet been claimed by the Keeper.
This does not mean that all users have to wait until the next Vesper claim cycle. If the contract still holds reward token balances from previous claims that users have not yet redeemed, these users will not need to wait. They can claim their rewards as long as there's a sufficient balance in the contract.