diff --git a/src/mapping.ts b/src/mapping.ts index 34a3145..e81ca7c 100644 --- a/src/mapping.ts +++ b/src/mapping.ts @@ -349,8 +349,8 @@ export function handleAuction_Initialized( auction.startsAt = auctionInfo.info.startTime; auction.endsAt = auctionInfo.info.endTime; auction.endsAtOriginal = auctionInfo.info.endTime; - auction.buyNowPrice = auctionInfo.info.buyItNowPrice; - auction.startBidPrice = auctionInfo.info.startingBid; + auction.buyNowPrice = auctionInfo.buyItNowPrice; + auction.startBidPrice = auctionInfo.startingBid; // auction.claimAt = auction.highestBidder = auctionInfo.highestBidder; @@ -541,110 +541,110 @@ export function handleContract_RoyaltyPaid(event: RoyaltyPaidEvent): void { export function handleAuction_BuyItNowUpdated( event: Auction_BuyItNowUpdatedEvent ): void { - // emitter - let emitter = getOrCreateUser(event.transaction.from); - emitter.save(); - - // event - let ev = new Auction_BuyItNowUpdated(events.id(event)); - ev.emitter = emitter.id; - ev.transaction = transactions.log(event).id; - ev.timestamp = event.block.timestamp; - - ev.auctionId = event.params._auctionId; - ev.buyNowPrice = event.params._buyItNowPrice; - ev.save(); - - // update entity - let entity = getOrCreateAuction(event.params._auctionId, event); - if (!entity) { - log.warning("auction with id {} not found", [ - event.params._auctionId.toString(), - ]); - return; - } - entity.buyNowPrice = event.params._buyItNowPrice; - entity.save(); + // // emitter + // let emitter = getOrCreateUser(event.transaction.from); + // emitter.save(); + // + // // event + // let ev = new Auction_BuyItNowUpdated(events.id(event)); + // ev.emitter = emitter.id; + // ev.transaction = transactions.log(event).id; + // ev.timestamp = event.block.timestamp; + // + // ev.auctionId = event.params._auctionId; + // ev.buyNowPrice = event.params._buyItNowPrice; + // ev.save(); + // + // // update entity + // let entity = getOrCreateAuction(event.params._auctionId, event); + // if (!entity) { + // log.warning("auction with id {} not found", [ + // event.params._auctionId.toString(), + // ]); + // return; + // } + // entity.buyNowPrice = event.params._buyItNowPrice; + // entity.save(); } export function handleAuction_StartingPriceUpdated( event: Auction_StartingPriceUpdatedEvent ): void { // emitter - let emitter = getOrCreateUser(event.transaction.from); - emitter.save(); - - // event - let ev = new Auction_StartingPriceUpdated(events.id(event)); - ev.emitter = emitter.id; - ev.transaction = transactions.log(event).id; - ev.timestamp = event.block.timestamp; - - ev.auctionId = event.params._auctionId; - ev.startBidPrice = event.params._startPrice; - ev.save(); - - // update entity - let entity = getOrCreateAuction(event.params._auctionId, event); - if (!entity) { - log.warning("auction with id {} not found", [ - event.params._auctionId.toString(), - ]); - return; - } - entity.startBidPrice = event.params._startPrice; - entity.save(); + // let emitter = getOrCreateUser(event.transaction.from); + // emitter.save(); + // + // // event + // let ev = new Auction_StartingPriceUpdated(events.id(event)); + // ev.emitter = emitter.id; + // ev.transaction = transactions.log(event).id; + // ev.timestamp = event.block.timestamp; + // + // ev.auctionId = event.params._auctionId; + // ev.startBidPrice = event.params._startPrice; + // ev.save(); + // + // // update entity + // let entity = getOrCreateAuction(event.params._auctionId, event); + // if (!entity) { + // log.warning("auction with id {} not found", [ + // event.params._auctionId.toString(), + // ]); + // return; + // } + // entity.startBidPrice = event.params._startPrice; + // entity.save(); } export function handleAuction_BoughtNow( event: Auction_BoughtNowEvent ): void { - // emitter - let emitter = getOrCreateUser(event.transaction.from); - emitter.save(); - - // event - let ev = new Auction_BoughtNow(events.id(event)); - ev.emitter = emitter.id; - ev.transaction = transactions.log(event).id; - ev.timestamp = event.block.timestamp; - - ev.auctionId = event.params._auctionId; - ev.save(); - - // update entity - let auction = getOrCreateAuction(event.params._auctionId, event); - if (!auction) { - log.warning("auction with id {} not found", [ - event.params._auctionId.toString(), - ]); - return; - } - auction.claimed = true; - auction.claimAt = event.block.timestamp; - - let bid = getOrCreateBid( - auction.highestBidder, - auction.highestBid, - auction as Auction, - event - ); - bid.outbid = true; - - let user = getOrCreateUser(auction.highestBidder); - user.outbids = user.outbids.plus(BigInt.fromI32(1)); - user.save(); - - // Update Stats - let stats = Statistic.load("0")!; - stats.totalSalesVolume = stats.totalSalesVolume.plus(auction.buyNowPrice); - stats.save(); - - // update contract stats - let cStats = getOrCreateStatistics(auction.contractAddress); - cStats.totalSalesVolume = cStats.totalSalesVolume.plus(auction.buyNowPrice); - cStats.save(); - - bid.save(); - auction.save(); + // // emitter + // let emitter = getOrCreateUser(event.transaction.from); + // emitter.save(); + // + // // event + // let ev = new Auction_BoughtNow(events.id(event)); + // ev.emitter = emitter.id; + // ev.transaction = transactions.log(event).id; + // ev.timestamp = event.block.timestamp; + // + // ev.auctionId = event.params._auctionId; + // ev.save(); + // + // // update entity + // let auction = getOrCreateAuction(event.params._auctionId, event); + // if (!auction) { + // log.warning("auction with id {} not found", [ + // event.params._auctionId.toString(), + // ]); + // return; + // } + // auction.claimed = true; + // auction.claimAt = event.block.timestamp; + // + // let bid = getOrCreateBid( + // auction.highestBidder, + // auction.highestBid, + // auction as Auction, + // event + // ); + // bid.outbid = true; + // + // let user = getOrCreateUser(auction.highestBidder); + // user.outbids = user.outbids.plus(BigInt.fromI32(1)); + // user.save(); + // + // // Update Stats + // let stats = Statistic.load("0")!; + // stats.totalSalesVolume = stats.totalSalesVolume.plus(auction.buyNowPrice); + // stats.save(); + // + // // update contract stats + // let cStats = getOrCreateStatistics(auction.contractAddress); + // cStats.totalSalesVolume = cStats.totalSalesVolume.plus(auction.buyNowPrice); + // cStats.save(); + // + // bid.save(); + // auction.save(); }