fix weth sale logic for opensea

master
lza_menace 1 year ago
parent d7caba4d16
commit 11de92a928

@ -194,13 +194,16 @@ class Scrape extends Collection {
let rl = logDescription.args.offer.filter((l) => l.token.toLowerCase() === this.contractAddress.toLowerCase()); let rl = logDescription.args.offer.filter((l) => l.token.toLowerCase() === this.contractAddress.toLowerCase());
if (rl.length > 0) tokenId = rl[0].identifier.toString(); if (rl.length > 0) tokenId = rl[0].identifier.toString();
} else if (logDescription.args.offer[0].token.toLowerCase() == WETH_ADDRESS.toLowerCase()) { } else if (logDescription.args.offer[0].token.toLowerCase() == WETH_ADDRESS.toLowerCase()) {
// seller has accepted buyer bid // seller has accepted buyer bid (uses WETH)
// filter down only sales on the contract
const _c = logDescription.args.consideration.filter((c) => c.token.toLowerCase() === this.contractAddress.toLowerCase());
_c.map((o) => {
sale = true; sale = true;
toAddress = logDescription.args.offerer.toLowerCase(); toAddress = logDescription.args.offerer.toLowerCase();
fromAddress = logDescription.args.recipient.toLowerCase(); fromAddress = logDescription.args.recipient.toLowerCase();
amountWei = BigNumber.from(logDescription.args.offer[0].amount).toString(); amountWei = BigNumber.from(logDescription.args.offer[0].amount).toString();
const _c = logDescription.args.consideration.filter((c) => c.token.toLowerCase() === this.contractAddress.toLowerCase());
tokenId = _c[0].identifier.toString(); tokenId = _c[0].identifier.toString();
})
} else { } else {
// unknown condition // unknown condition
} }

Loading…
Cancel
Save