Summary
The function _updateLastClaimTime, which updates the lastClaimTime mapping, is not called anywhere.
Vulnerability Details
The _updateLastClaimTime function updates the lastClaimTime mapping and should be called when the user claims rewards by calling the claimRewards function.
The claimRewards function should call _updateLastClaimTime to update the mapping whenever the user claims their reward.
function _updateLastClaimTime(address user) internal {
lastClaimTime[user] = block.timestamp;
}
function claimRewards(address user) external override nonReentrant whenNotPaused returns (uint256) {
if (user == address(0)) revert InvalidAddress();
uint256 pendingReward = _calculatePendingRewards(user);
if (pendingReward == 0) revert InsufficientBalance();
userRewards[user] = totalDistributed;
raacToken.safeTransfer(user, pendingReward);
emit RewardClaimed(user, pendingReward);
return pendingReward;
}
Impact
The contract will lose track of users' claim times.
Recommendations
Update the lastClaimTime while user claims the rewards.
function claimRewards(address user) external override nonReentrant whenNotPaused returns (uint256) {
if (user == address(0)) revert InvalidAddress();
uint256 pendingReward = _calculatePendingRewards(user);
if (pendingReward == 0) revert InsufficientBalance();
+ _updateLastClaimTime(user);
// Reset user rewards before transfer
userRewards[user] = totalDistributed;
// Transfer rewards
raacToken.safeTransfer(user, pendingReward);
emit RewardClaimed(user, pendingReward);
return pendingReward;
}