NFT Dealers

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

Redundant Zero-Price Check in `list`

Author Revealed upon completion

Root + Impact

Description

  • Normal Behavior: Validation checks should ensure that inputs meet the minimum business requirements of the protocol.


  • Specific Issue: In the list function, the contract checks require(_price >= MIN_PRICE). Since MIN_PRICE is a constant set to 1e6 (1 USDC), any price that passes this check is already guaranteed to be greater than zero. The subsequent require(_price > 0) check is redundant. Similarly, in updatePrice, while MIN_PRICE isn't used, the protocol's business logic establishes that 1 USDC is the floor.

function list(uint256 _tokenId, uint32 _price) external onlyWhitelisted {
// ...
@> require(_price > 0, "Price must be greater than 0");
//...
}

Risk

Likelihood: High

  • Reason 1: This code is executed every time a listing is created or updated.

Impact: Low (Gas)

  • Impact 1: Wasted Gas. Each execution costs additional gas to load the _price variable again, perform a comparison, and evaluate the conditional jump.

Proof of Concept

Recommended Mitigation

Remove the redundant _price > 0 check

function list(uint256 _tokenId, uint32 _price) external onlyWhitelisted {
// ...
- 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!