The caller of the function trickOrTreat
can be an external contract which can revert the transaction until he is lucky enough to mint the NFT for half the price.
The problem lies in the last few lines of the function treatOrTrick
If the sender is an external contract, it can revert the transaction until it gets the NFT for half the price. It will pay gas fees, but may receive really expensive NFT for 1/2 of the price.
The impact is that someone can receive really valuable NFT for much cheaper
foundry
Create separate function for example refundExcessETH
which the users can call after they successfully minted the NFT.
Move the aforementioned lines there.
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.