NFTDealers::list() and NFTDealers::buy(), NFTDealers::cancelListing() and any other function that need to get nft data causes all listings to be permanently unreachableIn NFTDealers::list(), listings are stored in s_listings using _tokenId as the mapping key, but the NFT_Dealers_Listed event emits listingsCounter as the listing identifier. When a buyer calls NFTDealers::buy() using the listingId obtained from the event, s_listings[_listingId] returns an empty struct since the actual data is stored under _tokenId. The same inconsistency propagates to cancelListing() and collectUsdcFromSelling().
Any buyer relying on the emitted listingId to call NFCDealers::buy() will always receive an empty listing causing the transaction to always revert with ListingNotActive. This effectively **breaks the core marketplace functionality, **no NFT can be purchased through the intended flow.
Likelihood: HIGH
occur when minting NFT
Impact: HIGH
when user call function that need to get data of nft such as buy(), user assume get with listingId, however in the NFTDealers::mintNft() contract store with _tokenId
1. User 1 mint 2 nft, but only list 1
2. User 2 mint 1 nft and list em
3. Form user 2 list call successfull, event emited that listingId is 2
4. Buyer want to buy NFT that listed by user 2
5. Because inconsistency of mapping on storing in list and get, log from other func, become s_lisitngs[2] is on default state
Use listingsCounter as the consistent mapping key across all functions:
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.