MyCut

First Flight #23
Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: low
Invalid

Lack of sanity checks in Pot contract's constructor

Summary

The lack of sanity checks inside the Pot contract's constrcutor() allows the owner to deploy and fund the Pot contract with incorrect values, performing basic sanity checks makes it less likely for such a thing to happen.

Tools Used

manual review

Recommendations

+error Pot__NoZeroAddress();
+error Pot__ArrayLengthDontMatch();
constructor(address[] memory players, uint256[] memory rewards, IERC20 token, uint256 totalRewards) {
+ if(players.length != rewards.length) {
+ revert Pot__ArrayLengthDontMatch();
+ }
+ if(adress(token) == address(0)) {
+ revert Pot__NoZeroAddress();
+ }
i_players = players;
i_rewards = rewards;
i_token = token;
i_totalRewards = totalRewards;
remainingRewards = totalRewards;
i_deployedAt = block.timestamp;
// i_token.transfer(address(this), i_totalRewards);
for (uint256 i = 0; i < i_players.length; i++) {
playersToRewards[i_players[i]] = i_rewards[i];
}
}
Updates

Lead Judging Commences

equious Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Known issue

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.