s_listings mapping uses _tokenId as the key when storing a listing. However, listingsCounter is a separate auto-incrementing value emitted in the NFT_Dealers_Listed event as the listingId. Every function that operates on a listing — buy, cancelListing, collectUsdcFromSelling, updatePrice — takes a _listingId parameter that users and off-chain indexers will naturally populate with the emitted counter value. But the lookup s_listings[_listingId] expects the tokenId, not the counter — resulting in wrong listing lookups or empty struct returns.Risk
Likelihood:
Any user or frontend that calls buy(), cancelListing(), or updatePrice() using the listingId from the emitted event will hit an empty/inactive listing and revert every time
tokenId and listingsCounter only coincidentally align for the very first listing of tokenId #1
Impact:
Core marketplace functionality — buying and canceling — is broken for all practical use
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.
The contest is complete and the rewards are being distributed.