MyCut

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

Insufficient Token Approval

Summary

https://github.com/Cyfrin/2024-08-MyCut/blob/946231db0fe717039429a11706717be568d03b54/src/ContestManager.sol#L33

if (token.balanceOf(msg.sender) < totalRewards)
{
revert ContestManager\_\_InsufficientFunds();
}

Before transferring tokens in fundContest(), you should check whether the msg.sender has approved the required amount of tokens for the contract to transfer.

If not approved, the transferFrom will fail if there's no allowance set.

Recommendations

if (token.allowance(msg.sender, address(this)) < totalRewards) {
revert ContestManager__InsufficientFunds();
}
Updates

Lead Judging Commences

equious Lead Judge 12 months ago
Submission Judgement Published
Invalidated
Reason: Known issue

Support

FAQs

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