buyPresent()
function is used to trade tokens with NFTs.
i_santaToken.burn(presentReceiver)
function is used to burn the SantaToken and _mintAndIncrement()
is used to mint an NFT.
There is no logic in the burn function to prevent the user to check if the balance is less than the required amount of 1e18 SantaToken.
So even the balance is less than 1e18 the function goes through and causes arithmetic underflow.
foundry
manual code review
A balance check is required before calling the buyPresent()
function to avoid arithmetic underflow
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.