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

buyPresent spends 1 token instead of 2

Summary

The documents state:

buyPresent: A function that trades 2e18 of SantaToken for an NFT. This function can be called by anyone.

Also the notice in the code specifies:

* @notice Buy a present for someone else. This should only be callable by someone who is naughty.

Which is also NOT true, as anyone can call the function.

Vulnerability Details

buyPresent function calls:

i_santaToken.burn(presentReceiver);

Which burns 1e18 instead of 2e18 as written in the documentation.

Impact

User can buy NFT's cheaper.

Tools Used

Manual review

Recommendations

Either change the documentation to reflect the real state or the function.

Updates

Lead Judging Commences

inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

Price is not enforced in buyPresent

This line indicates that the intended cost of presents for naughty people should be 2e18: https://github.com/Cyfrin/2023-11-Santas-List/blob/6627a6387adab89ae2ba2e82b38296723261c08a/src/SantasList.sol#L87 PURCHASE_PRESENT_COST should be implemented to enforce the cost of presents.

Support

FAQs

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