list() is expected to store a listing that callers can reference by a stable listing ID emitted in the event. All read and write functions (buy, cancelListing, updatePrice, collectUsdcFromSelling) accept a _listingId that maps directly to s_listings[_listingId].
The listing is stored at s_listings[_tokenId] but the event emits listingsCounter as the listing ID. These two values diverge as soon as a token with ID ≠ 1 is listed first, or when the counter and token ID differ. Any frontend or integration that calls buy(emittedListingId) will operate on the wrong listing entry.
Likelihood:
Any token listed with a tokenId that does not equal its position in the mint order produces a mismatched event.
The mismatch grows over time as listings are cancelled, tokens are transferred, and re-listed.
Impact:
Buyers calling buy(listingId) from event data attempt to purchase an unrelated or non-existent listing.
Off-chain indexers, marketplaces, and UIs built on the event present incorrect data to users.
Two tokens are minted, the second one is listed first. The event emits listingId=1 (from listingsCounter) but the listing is stored at s_listings[2] (from _tokenId). A buyer acting on the emitted ID reverts.
Use listingsCounter as both the storage key and the emitted ID, and keep a reverse mapping from listing ID to tokenId so internal functions can still look up the token.
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.