Pieces Protocol

First Flight #32
Beginner FriendlyFoundrySolidityNFT
100 EXP
View results
Submission Details
Severity: low
Invalid

Wrong order of NftClaimed event

Summary

The claimNft function in Solidity allows a user to claim an NFT (non-fungible token) under certain conditions.

Vulnerability Details

The NftClaimedevent is before transfer the NFTs tokens.

IERC721(nftAddress).safeTransferFrom(address(this), msg.sender, tokenInfo.tokenId);

Impact

If the event is emitted before the actual transfer of the NFT, it might lead to a situation where the event log indicates that a transfer has occurred, even though it may have failed. This can result in misleading records about the state of the contract.

Tools Used

manual review

Recommendations

The emit NftClaimed(nftAddress) statement should be placed after the safeTransferFrom method to ensure the NFT has been successfully transferred before emitting the event.

Please check example:

IERC721(nftAddress).safeTransferFrom(address(this), msg.sender, tokenInfo.tokenId);
emit NftClaimed(nftAddress);
Updates

Lead Judging Commences

fishy Lead Judge 7 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.