Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | 1x 1x 1x 1x 1x 1x 44x 817x 2x 817x 44x 1x 1x 1x 43x | import { Log, TransactionResponse, ethers } from "ethers";
import { LogParser } from "./parser.definition";
import { config } from "../config";
import looksRareABI from '../abi/looksRareABI.json';
const looksInterface = new ethers.Interface(looksRareABI);
const looksRareContractAddress = '0x59728544b08ab483533076417fbbb2fd0b17ce3a'; // Don't change unless deprecated
export class LooksRareParser implements LogParser {
platform: string = 'looksrare';
parseLogs(transaction:TransactionResponse, logs: Log[], tokenId: string): number {
const result = logs.map((log: any) => {
if (log.address.toLowerCase() === looksRareContractAddress.toLowerCase()) {
return looksInterface.parseLog(log);
}
}).filter((log: any) => (log?.name === 'TakerAsk' || log?.name === 'TakerBid') &&
log?.args.tokenId == tokenId);
if (result.length) {
const weiValue = (result[0]?.args?.price)?.toString();
const value = ethers.formatEther(weiValue);
return parseFloat(value)
}
return undefined
}
} |