fudgebucket27 / Lexplorer

Loopring explorer alternative
14 stars 10 forks source link

TradeNFT transactions don't show the price and amount correctly #188

Closed modersohn closed 2 years ago

modersohn commented 2 years ago

E.g. https://lexplorer.io/transactions/23257-199

image

This should display the realised NFT price of 100 LRC, instead it shows some bogus E+21 numbers. This could be because token IDs > 32767 are NFTs, not regular traded tokens.

modersohn commented 2 years ago

This graph snipped brought me on track:

https://github.com/Loopring/loopring-subgraph-v2/blob/c2319a3e9f5b23f3e685fc02110542e9ad3a1b31/src/utils/helpers/transactionProcessors/spotTrade.ts#L532

Thanks to monty on discord I just read that NFTs haven token IDs > 32767. And that is exactly how one determines whether the seller (of the NFT!) is A: if tokenIDAS, i.e. the token that A sold, is an NFT, then A is the seller, otherwise it is B. Consequently, if A is selling then fillSA holds the amount of NFTs that were sold, otherwise fillSB.

For everything else we luckily don't have to use the A vs. B logic, because realizedNFTPrice is there.

fudgebucket27 commented 2 years ago

Oh monty to the rescue again! Yep this was bugging me for the NFT trades!

fudgebucket27 commented 2 years ago

Fixed with #189