The SantasList::buyPresent()
burns a token of the address intended to be the receiver of the present, and the NFT is minted to the address of the caller.
The SantasList::buyPresent()
function is currently working inversely to its intended behavior.
It is burning a token from the address intended to receive the present, and the NFT is minted to the caller's address.
Furthermore, the documentation indicates that 2e18
should be burned, but only 1e18
is currently being burned.
Unintended burning tokens for a user could harm the protocol's reputation
The provided test highlights the undesirable behavior of the function.
Output
Foundry
The SantasList::buyPresent()
function is intended to burn 2e18
tokens from the msg.sender
and mint the NFT to the specified presentReceiver
.
Add the following function to the SantaToken
contract: a parameterized burning function that receives the amount to be burned.
Current implementation allows a malicious actor to burn someone else's tokens as the burn function doesn't actually check for approvals.
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.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.