MyCut

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

Declare claimCut() as External to save gas (Pot.sol)

Summary

Public functions consume more gas than external. This function will not be called by the contract itself and thus should be external.

function claimCut() public {
address player = msg.sender;
uint256 reward = playersToRewards[player];
if (reward <= 0) {
revert Pot__RewardNotFound();
}
playersToRewards[player] = 0;
remainingRewards -= reward;//@audit underflow ever possible?
claimants.push(player);
_transferReward(player, reward);
}

Impact

Excessive and unecessary gas usage.

Tools Used

Manual Review

Recommendations

Declare claimCut() functional visibility as external

Updates

Lead Judging Commences

equious Lead Judge 12 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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