Pieces Protocol

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

Redundant Condition in transferErcTokens Function

Summary

The transferErcTokens function contains a redundant condition check for to == address(0). This check is performed twice, leading to unnecessary gas consumption.

Vulnerability Details

This check appears twice in the function—once at the beginning and again after retrieving tokenInfo:

ERC20Info memory tokenInfo = nftToErc20Info[nftAddress];

if (to == address(0)) { // <-- Redundant check

revert TokenDivider__CantTransferToAddressZero();

}

The second instance is unnecessary, as the function execution would have already reverted if to was address(0) during the first check.

Impact

Keeping redundant conditions makes code harder to maintain

Tools Used

Manuel review

Recommendations

Remove the second occurrence of the condition

Updates

Lead Judging Commences

fishy Lead Judge 5 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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