Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: low
Invalid

Custom Error for `buyProduct` Lack of Funds Revert

Summary

In buyProduct, have a custom error for a check that the receiver has enough tokens to burn. This way we get a nice custom error when trying to buy with not enough tokens that frontends can use.

Recommendations

+ error SantasList__NotEnoughFunds();
function buyPresent(address presentReceiver) external {
+ if (i_santaToken.balanceOf(presentReceiver) < 1e18) revert SantasList__NotEnoughFunds();
i_santaToken.burn(presentReceiver);
_mintAndIncrement();
}
Updates

Lead Judging Commences

inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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