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

BuyPresent function execution doesn't match function description

Summary

Anyone can buy a present for a user as opposed to the intended functionality

Vulnerability Details

/*
* @notice Buy a present for someone else. This should only be callable by someone who is naughty.
* @dev You'll first need to approve the SantasList contract to spend your SantaTokens.
*/
function buyPresent(address presentReceiver) external {
i_santaToken.burn(presentReceiver);
_mintAndIncrement();
}

In the buy present function above, there is no logic to ensure that the function can be called by a naughty user only as stated in the developer notice above

Tools Used

Manual Review

Recommendations

Add the following line of code to the buyPresent function

if (s_theListCheckedOnce[msg.sender] == Status.NAUGHTY || s_theListCheckedTwice[msg.sender] == Status.NAUGHTY) revert \* define custom error *\;
Updates

Lead Judging Commences

inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Design choice

Support

FAQs

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