NFT Dealers

First Flight #58
Beginner FriendlyFoundry
100 EXP
Submission Details
Impact: low
Likelihood: low

Redundant `require(_price > 0)` in `NFTDealers::list()` wastes gas

Author Revealed upon completion

Redundant `require(_price > 0)` in `NFTDealers::list()` wastes gas

Description

`NFTDealers::list()` contains two price validation checks where the second is completely redundant. Since `MIN_PRICE = 1e6`, any price passing the first check is guaranteed to be greater than zero.

require(_price >= MIN_PRICE, "Price must be at least 1 USDC"); // MIN_PRICE = 1e6
// ...
require(_price > 0, "Price must be greater than 0"); // @> never reachable

Risk

-

Proof of Concept

-

Recommended Mitigation

Remove the redundant check:

-require(_price > 0, "Price must be greater than 0");

Support

FAQs

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

Give us feedback!