L-01 Rounding down the rewards in the claimPot function will lead to the loss of dust amounts.
The division of the remaining rewards by the total number of players will always round down the claimant cut, this dust amount will get stuck in the protocol forever.
function closePot() external onlyOwner {
if (block.timestamp - i_deployedAt < 90 days) {
revert Pot__StillOpenForClaim();
}
if (remainingRewards > 0) {
uint256 managerCut = remainingRewards / managerCutPercent;
i_token.transfer(msg.sender, managerCut);
@-> uint256 claimantCut = (remainingRewards - managerCut) / i_players.length;
for (uint256 i = 0; i < claimants.length; i++) {
_transferReward(claimants[i], claimantCut);
}
}
}
Recommendation
Send the entire balance of the contract to the owner after sending all the rewards to the players.
function closePot() external onlyOwner {
if (block.timestamp - i_deployedAt < 90 days) {
revert Pot__StillOpenForClaim();
}
if (remainingRewards > 0) {
uint256 managerCut = remainingRewards / managerCutPercent;
- i_token.transfer(msg.sender, managerCut);
uint256 claimantCut = (remainingRewards - managerCut) / i_players.length;
for (uint256 i = 0; i < claimants.length; i++) {
_transferReward(claimants[i], claimantCut);
}
+ i_token.transfer(msg.sender, i_token.balanceOf(address(this)));
}
}
L-02 The contests array can grow too large resulting in the dos of this function.
Create a function with start index and endIndex to fix this.
function getContests() public view returns (address[] memory) {
return contests;
}