Category: Code Maturity
Incorrect comment
Informational Severity
Informational Impact
N/A Likelihood
Description
The Reward contract distributes the predefined amount of tokens to the reward beneficiaries. The following code defines the amount of tokens to be distributed:
/// @notice The duration of each distribution period
uint256 private constant DISTRIBUTION_CHANGE = 7 days;
/// @notice The amount of tokens to be distributed in the first epoch
uint256 private constant STARTING_TOKEN_COUNT = 216_227 * 10 ** 18;
/// @notice The length of each epoch in seconds
uint256 private constant EPOCH_LENGTH = 1 days;
// (...)
constructor(IERC20 _token, RewardSettings _settings) OnlyYeetContract(msg.sender) {
// (...)
epochRewards[currentEpoch] = STARTING_TOKEN_COUNT / (DISTRIBUTION_CHANGE / EPOCH_LENGTH);
// (...)
}
The comment of the STARTING_TOKEN_COUNT
explains that 216_227 * 10 ** 18
is the amount of tokens to be distributed in the first epoch. However, it is actually the amount for the first distribution period, and the amount of tokens to be distributed in the first epoch will be 1/7th.
Impact
This finding documents the inconsistency between the code and the comment.
Recommendations
Consider revising the comment.
Remediation
This issue has been acknowledged by Sanguine Labs LTD, and a fix was implemented in commit d8de4eb2↗.