Snowman::mintSnowman()
contains risky loop for minting NFTs, a single bad item can fail whole transaction and fail to mint NFTsSnowman::mintSnowman()
mints amount
of NFTs at receiver
address.
NFTs are minted at receiver
address by running a for loop 'amount' times
incrementing s_TokenCounter
each time to ensure unique token IDs.
runs a loop amount of times to mint amount of NFTs, running a loop for minting NFTs can be risky such that a single bad item can fail whole transaction
Likelihood:
If receiver
is a contract and User mints more than 100 NFTs, and the 100th mint fails due to onERC721Received()
on receiver's contract side, none of the 99 NFTs before that will be minted either.
If receiver
is an broken or malicious contract, it can Revert unexpectedly, Fail to return the required selector
.
Impact:
Whole transaction can failed due to a single bad item or bad transaction
It can dissrupt the s_TokenCounter
to ensure the unique tokenId
The below test depects the unusal behaviour of Snowman::mintSnowman()
If receiver
is an broken contract that does not implement onERC721Received()
, can be the cause of error
Before calling _safeMint
, check if the receiver
is a smart contract, and validate it implements onERC721Received()
correctly.
Add OpenZeppelins::ReentrancyGuard
which can prevent the future Re-entrancy
attack
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.