NFT Dealers

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

Limited price set

Author Revealed upon completion

`uint32` price type caps maximum listing price at ~4,294 USDC

Description

The price field in the Listing struct and the parameters of list() and updatePrice() are typed as uint32. The maximum value of uint32 is 4,294,967,295, which with USDC's 6 decimal places equates to a maximum price of approximately **4,294 USDC**. This severely limits the protocol's ability to handle high-value NFT sales.

struct Listing {
uint32 price; // @> max ~4,294 USDC
}
function list(uint256 _tokenId, uint32 _price) external onlyWhitelisted {}
function updatePrice(uint256 _listingId, uint32 _newPrice) external onlySeller(_listingId) {}

Risk

NFTs cannot be listed above ~4,294 USDC, limiting the protocol's addressable market and preventing high-value trades entirely.

Likelihood: LOW

Impact: LOW

Proof of Concept

User want to sell their NFT worth of price 5000 USDC, but with current contract design that is not possible

// After suer mintNft()
// user can only list their nft with only max of uint32 which is around ~4,294 USDC
function test_listMaxUint32() public whitelisted revealed {
vm.startPrank(userWithCash);
usdc.approve(address(nftDealers), type(uint256).max);
nftDealers.mintNft();
nftDealers.list(1, 4_294_967_295);
// nftDealers.list(1, 4_294_967_295 + 1); // revert of course
vm.stopPrank();
}

Recommended Mitigation

Keep on mind what if user want to sell their nft higher than uint32 maximum number, consider to upgrading the level of uint32 to higher

struct Listing {
address seller;
- uint32 price;
+ uint256 price;
address nft;
uint256 tokenId;
bool isActive;
}

Support

FAQs

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

Give us feedback!