Pieces Protocol

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

erc20ToNft mapping is initialized/set but never used in contract TokenDivider.sol

Summary

Storage variable erc20ToNft is set in divideNft function. But then its never used.

Vulnerability Details

Storage variable cost considerable amount of gas. A storage variable - " mapping(address erc20 => address nft) erc20ToNft;" is created. It is set as NFT address corresponding to erc20 token in divideNft function of TokenDivider.sol

But then it is never used in any other function.

Why to create a storage variable if it doesnt add value to the logical flow? There is no validation based on this variable. Nowhere, the NFT address is fetched based on erc20 token. Even when user claims NFT this mapping is not reset.

This variable can be removed.

Impact

Additional storage variable which is not useful and costs gas.

Tools Used

Manual Instpection.

Recommendations

Consider removing the storage variable.

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.