First Flight #12: Kitty Connect

First Flight #12: Kitty Connect
Beginner FriendlyFoundryNFTGameFi
100 EXP
View results
Submission Details
Severity: low
Invalid

`addShop` method doesn't check if the shop already exists

Summary

addShop method doesn't check if the shop already exists

Vulnerability Details

In the addShop method, we push a new shop partner in the s_kittyShops but we don't check if the shop already exists and it is already in the array.

Impact

Can lead to duplicates in shop partners array and excessive increase in gas costs and storage.

Tools Used

Manual review

Recommendations

Consider adding a require that checks if the shop partner already exists in the array like this :

function addShop(address shopAddress) external onlyKittyConnectOwner {
+ require(!s_isKittyShop[shopAddress], "Shop already exists");
s_isKittyShop[shopAddress] = true;
s_kittyShops.push(shopAddress);
emit ShopPartnerAdded(shopAddress);
}
Updates

Lead Judging Commences

inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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