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.