Anyone can buy present at half price.
According to the README.md: "buyPresent: A function that trades 2e18 of SantaToken for an NFT. This function can be called by anyone."
We can know that buy present need 2e18 SantaToken, but through testing found that anyone can buy present at half price.
Only burn 1e18 of SnataToken.
Working Test Case:
Add the test to the SantasListTest.t.sol file. Running the test with forge test --match-test testAnyoneCanBuyPresentAtHalfPrice -vvv we can see:
It directly leads to the loss of funds.
It's like you sell something for $100 and you only get $50.
Foundry
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.