SantaToken:burn() does not burn the correct amount of SANTA token
The SantaToken:burn() function burns a hard-coded amount of 1e18 SANTA token each time it is called. SantaToken:burn() is called by SantasList:buyPresent() and the documented cost of gifting a present is 2e18 SANTA. This vulnerability results in leaving "gifters" with more SANTA token than they should have.
High
The following Foundry test will fail with current code as the user will be left with 1e18 SANTA instead of 0 SANTA which is expected...
Visual Studio Code, Foundry
Change the SantaToken:burn() function as show below to take a parameter for the amount of SANTA token to be burned...
Change the call to burn() from SantasList:buyPresent() to pass an amount...
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.