When a user lists an NFT, the contract emits an event with listingsCounter as the listing ID, and users see this ID in the frontend to identify which listing they want to interact with.
The mapping stores listings using tokenId as the key, but all the marketplace functions expect listingId as the parameter, so when users try to buy/cancel/collect using the ID from the event, they get the wrong listing or an empty one.
solidity
Likelihood:
Users get the listing ID from the event and use it to call buy(), cancelListing(), updatePrice(), or collectUsdcFromSelling()
The function looks up s_listings[listingId] but the data is stored at s_listings[tokenId], so it returns empty data or wrong listing
Impact:
Nobody can buy NFTs using the listing ID shown in events or frontend
The entire marketplace is broken because the key mismatch makes listings inaccessible
Same issue affects cancelListing, updatePrice, and collectUsdcFromSelling - all unusable
solidity
diff
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.