From 3864858e946f97de1a087f9d762e107fe0547a40 Mon Sep 17 00:00:00 2001 From: danielailie Date: Wed, 22 May 2024 15:27:53 +0300 Subject: [PATCH] Update event logs model --- src/modules/metrics/metrics.controller.ts | 6 +-- src/modules/metrics/rabbitEvent.ts | 17 ++++++++ .../acceptGlobalOffer-event.handler.ts | 5 ++- .../acceptOffer-event.handler.ts | 9 ++-- .../handlers-reindex/bid-event.handler.ts | 9 ++-- .../handlers-reindex/buy-event.handler.ts | 15 +++---- .../endAuction-event.handler.ts | 8 ++-- .../sendOffer-event.handler.ts | 9 ++-- .../startAuction-event.handler.ts | 11 ++--- .../swapUpdate-event.handler.ts | 9 ++-- .../updateListing-event.handler.ts | 9 ++-- .../updatePrice-event.handler.ts | 9 ++-- .../withdrawAuction-event.handler.ts | 11 ++--- .../withdrawOffer-event.handler.ts | 7 ++-- .../marketplace-events-processing.service.ts | 41 ++++++++++--------- .../acceptGlobalOffer.event.ts | 6 +-- .../auction-reindex/acceptOffer.event.ts | 6 +-- .../acceptOfferDeadrare.event.ts | 6 +-- .../acceptOfferFrameit.event.ts | 6 +-- .../auction-reindex/acceptOfferXoxno.event.ts | 5 ++- .../auction-reindex/auctionToken.event.ts | 6 +-- .../entities/auction-reindex/bid.event.ts | 6 +-- .../entities/auction-reindex/buySft.event.ts | 6 +-- .../entities/auction-reindex/claim.event.ts | 6 +-- .../elrondnftswap/elrondswap-auction.event.ts | 6 +-- .../elrondnftswap/elrondswap-buy.event.ts | 5 ++- .../elrondswap-updateAuction.event.ts | 6 +-- .../elrondswap-withdraw.event.ts | 6 +-- .../auction-reindex/endAuction.event.ts | 6 +-- .../entities/auction-reindex/listNft.event.ts | 6 +-- .../auction-reindex/sendOffer.event.ts | 6 +-- .../auction-reindex/updateListing.event.ts | 6 +-- .../auction-reindex/updatePrice.event.ts | 6 +-- .../auction-reindex/withdraw.event.ts | 6 +-- .../auction-reindex/withdrawOffer.event.ts | 6 +-- 35 files changed, 161 insertions(+), 132 deletions(-) diff --git a/src/modules/metrics/metrics.controller.ts b/src/modules/metrics/metrics.controller.ts index bdfaed233..08c51458b 100644 --- a/src/modules/metrics/metrics.controller.ts +++ b/src/modules/metrics/metrics.controller.ts @@ -1,6 +1,6 @@ import { Body, Controller, Get, HttpStatus, Post } from '@nestjs/common'; import { MetricsCollector } from './metrics.collector'; -import { RabbitEvent } from './rabbitEvent'; +import { EventLog } from './rabbitEvent'; import { MarketplaceEventsProcessingService } from '../rabbitmq/blockchain-events/marketplace-events-processing.service'; @Controller() @@ -17,8 +17,8 @@ export class MetricsController { } @Post('/event') - async notify(@Body() payload: RabbitEvent): Promise { - await this.marketplaceEvents.handleNftAuctionEvents(payload?.events, payload?.hash); + async notify(@Body() payload: EventLog[]): Promise { + await this.marketplaceEvents.handleNftAuctionEvents(payload); return HttpStatus.OK; } } diff --git a/src/modules/metrics/rabbitEvent.ts b/src/modules/metrics/rabbitEvent.ts index 02c9a702c..79068e5a5 100644 --- a/src/modules/metrics/rabbitEvent.ts +++ b/src/modules/metrics/rabbitEvent.ts @@ -19,3 +19,20 @@ export class RabbitEventLog { Object.assign(this, init); } } + +export class EventLog { + eventId: string = ''; + txHash: string = ''; + shardId: number = 0; + timestamp: number = 0; + address: string = ''; + identifier: string = ''; + topics: string[] = []; + data: string = ''; + additionalData: string[] = []; + txOrder: number = 0; + eventOrder: number = 0; + constructor(init?: Partial) { + Object.assign(this, init); + } +} diff --git a/src/modules/rabbitmq/blockchain-events/handlers-reindex/acceptGlobalOffer-event.handler.ts b/src/modules/rabbitmq/blockchain-events/handlers-reindex/acceptGlobalOffer-event.handler.ts index cd80dec0c..ee52c8299 100644 --- a/src/modules/rabbitmq/blockchain-events/handlers-reindex/acceptGlobalOffer-event.handler.ts +++ b/src/modules/rabbitmq/blockchain-events/handlers-reindex/acceptGlobalOffer-event.handler.ts @@ -5,6 +5,7 @@ import { AuctionStatusEnum } from 'src/modules/auctions/models'; import { XOXNO_KEY } from 'src/utils/constants'; import { AcceptGlobalOfferEvent } from '../../entities/auction-reindex/acceptGlobalOffer.event'; import { Marketplace } from 'src/modules/marketplaces/models'; +import { EventLog } from 'src/modules/metrics/rabbitEvent'; @Injectable() export class AcceptGlobalOfferEventHandler { @@ -14,11 +15,11 @@ export class AcceptGlobalOfferEventHandler { private auctionsService: AuctionsSetterService, ) { } - async handle(event: any, hash: string, marketplace: Marketplace) { + async handle(event: EventLog, marketplace: Marketplace) { try { const acceptGlobalOfferEvent = new AcceptGlobalOfferEvent(event); const topics = acceptGlobalOfferEvent.getTopics(); - this.logger.log(`Accept Global Offer event detected for hash '${hash}' and marketplace '${marketplace?.name}'`); + this.logger.log(`Accept Global Offer event detected for marketplace '${marketplace?.name}'`); if (marketplace.key !== XOXNO_KEY || topics.auctionId <= 0) { return; } diff --git a/src/modules/rabbitmq/blockchain-events/handlers-reindex/acceptOffer-event.handler.ts b/src/modules/rabbitmq/blockchain-events/handlers-reindex/acceptOffer-event.handler.ts index bb3cb7c76..d54e8efc2 100644 --- a/src/modules/rabbitmq/blockchain-events/handlers-reindex/acceptOffer-event.handler.ts +++ b/src/modules/rabbitmq/blockchain-events/handlers-reindex/acceptOffer-event.handler.ts @@ -13,6 +13,7 @@ import { AcceptOfferXoxnoEvent } from '../../entities/auction-reindex/acceptOffe import { FeedEventsSenderService } from '../feed-events.service'; import { AcceptOfferFrameitEvent } from '../../entities/auction-reindex/acceptOfferFrameit.event'; import { Marketplace } from 'src/modules/marketplaces/models'; +import { EventLog } from 'src/modules/metrics/rabbitEvent'; @Injectable() export class AcceptOfferEventHandler { @@ -27,7 +28,7 @@ export class AcceptOfferEventHandler { private readonly notificationsService: NotificationsService, ) { } - async handle(event: any, hash: string, marketplace: Marketplace) { + async handle(event: EventLog, marketplace: Marketplace) { try { if (marketplace?.type === MarketplaceTypeEnum.External) { let acceptOfferEvent = undefined; @@ -43,7 +44,7 @@ export class AcceptOfferEventHandler { if (!acceptOfferEvent) return; this.logger.log( - `${acceptOfferEvent.getIdentifier()} event detected for hash '${hash}' and marketplace '${marketplace?.name}'`, + `${acceptOfferEvent.getIdentifier()} event detected for marketplace '${marketplace?.name}'`, ); if (topics.auctionId || topics.auctionId !== 0) { @@ -60,11 +61,11 @@ export class AcceptOfferEventHandler { const acceptOfferEvent = new AcceptOfferEvent(event); const topics = acceptOfferEvent.getTopics(); marketplace = await this.marketplaceService.getMarketplaceByType( - acceptOfferEvent.getAddress(), + acceptOfferEvent.address, marketplace.type, topics.collection, ); - this.logger.log(`Accept Offer event detected for hash '${hash}' and marketplace '${marketplace?.name}'`); + this.logger.log(`Accept Offer event detected for hash marketplace '${marketplace?.name}'`); const offer = await this.offersService.getOfferByIdAndMarketplace(topics.offerId, marketplace.key); diff --git a/src/modules/rabbitmq/blockchain-events/handlers-reindex/bid-event.handler.ts b/src/modules/rabbitmq/blockchain-events/handlers-reindex/bid-event.handler.ts index b9296a807..dd6418c7e 100644 --- a/src/modules/rabbitmq/blockchain-events/handlers-reindex/bid-event.handler.ts +++ b/src/modules/rabbitmq/blockchain-events/handlers-reindex/bid-event.handler.ts @@ -12,6 +12,7 @@ import { ELRONDNFTSWAP_KEY } from 'src/utils/constants'; import { BidEvent } from '../../entities/auction-reindex'; import { ElrondSwapBidEvent } from '../../entities/auction-reindex/elrondnftswap/elrondswap-bid.event'; import { FeedEventsSenderService } from '../feed-events.service'; +import { EventLog } from 'src/modules/metrics/rabbitEvent'; @Injectable() export class BidEventHandler { @@ -27,7 +28,7 @@ export class BidEventHandler { private readonly persistenceService: PersistenceService, ) { } - async handle(event: any, hash: string, marketplace: Marketplace) { + async handle(event: EventLog, marketplace: Marketplace) { try { let [bidEvent, topics] = [undefined, undefined]; if (marketplace.type === MarketplaceTypeEnum.External) { @@ -37,7 +38,7 @@ export class BidEventHandler { marketplace = await this.marketplaceService.getMarketplaceByType(bidEvent.getAddress(), marketplace.type, topics.collection); } if (!marketplace) return; - this.logger.log(`${bidEvent.getIdentifier()} event detected for hash '${hash}' and marketplace '${marketplace?.name}'`); + this.logger.log(`${bidEvent.getIdentifier()} event detected for marketplace '${marketplace?.name}'`); const auction = await this.auctionsGetterService.getAuctionByIdAndMarketplace(parseInt(topics.auctionId, 16), marketplace.key); if (!auction) return; @@ -53,7 +54,7 @@ export class BidEventHandler { priceToken: auction.paymentToken, priceAmount: topics.currentBid, priceNonce: auction.paymentNonce, - blockHash: hash, + blockHash: '', status: OrderStatusEnum.Active, marketplaceKey: marketplace.key, }), @@ -63,7 +64,7 @@ export class BidEventHandler { if (auction.maxBidDenominated === order.priceAmountDenominated) { this.notificationsService.updateNotificationStatus([auction?.id]); this.notificationsService.addNotifications(auction, order); - this.auctionsService.updateAuctionStatus(auction.id, AuctionStatusEnum.Ended, hash, event.identifier); + this.auctionsService.updateAuctionStatus(auction.id, AuctionStatusEnum.Ended, 'hash', event.identifier); this.persistenceService.updateOrderWithStatus(order, OrderStatusEnum.Bought); } } catch (error) { diff --git a/src/modules/rabbitmq/blockchain-events/handlers-reindex/buy-event.handler.ts b/src/modules/rabbitmq/blockchain-events/handlers-reindex/buy-event.handler.ts index b7edc3483..791dcafe4 100644 --- a/src/modules/rabbitmq/blockchain-events/handlers-reindex/buy-event.handler.ts +++ b/src/modules/rabbitmq/blockchain-events/handlers-reindex/buy-event.handler.ts @@ -11,6 +11,7 @@ import { ClaimEvent } from '../../entities/auction-reindex/claim.event'; import { ElrondSwapBuyEvent } from '../../entities/auction-reindex/elrondnftswap/elrondswap-buy.event'; import { FeedEventsSenderService } from '../feed-events.service'; import { Marketplace } from 'src/modules/marketplaces/models'; +import { EventLog } from 'src/modules/metrics/rabbitEvent'; @Injectable() export class BuyEventHandler { @@ -24,15 +25,15 @@ export class BuyEventHandler { private readonly marketplaceService: MarketplacesService, ) { } - async handle(event: any, hash: string, marketplace: Marketplace) { + async handle(event: any, marketplace: Marketplace) { try { - const { buySftEvent, topics } = this.getEventAndTopics(event, hash); + const { buySftEvent, topics } = this.getEventAndTopics(event, 'hash'); let auction: AuctionEntity; - marketplace = await this.marketplaceService.getMarketplaceByType(buySftEvent.getAddress(), marketplace.type, topics.collection); + marketplace = await this.marketplaceService.getMarketplaceByType(buySftEvent.address, marketplace.type, topics.collection); if (!marketplace) return; - this.logger.log(`${buySftEvent.getIdentifier()} event detected for hash '${hash}' and marketplace '${marketplace?.name}'`); + this.logger.log(`${buySftEvent.identifier} event detected for marketplace '${marketplace?.name}'`); if (topics.auctionId) { auction = await this.auctionsGetterService.getAuctionByIdAndMarketplace(parseInt(topics.auctionId, 16), marketplace.key); @@ -45,7 +46,7 @@ export class BuyEventHandler { const result = await this.auctionsGetterService.getAvailableTokens(auction.id); const totalRemaining = result ? result[0]?.availableTokens - parseFloat(topics.boughtTokens) : 0; if (totalRemaining === 0) { - this.auctionsService.updateAuctionStatus(auction.id, AuctionStatusEnum.Ended, hash, AuctionStatusEnum.Ended); + this.auctionsService.updateAuctionStatus(auction.id, AuctionStatusEnum.Ended, 'hash', AuctionStatusEnum.Ended); } const orderSft = await this.ordersService.createOrderForSft( new CreateOrderArgs({ @@ -54,7 +55,7 @@ export class BuyEventHandler { priceToken: auction.paymentToken, priceAmount: auction.minBid, priceNonce: auction.paymentNonce, - blockHash: hash, + blockHash: 'hash', status: OrderStatusEnum.Bought, boughtTokens: topics.boughtTokens, marketplaceKey: marketplace.key, @@ -73,7 +74,7 @@ export class BuyEventHandler { } } - private getEventAndTopics(event: any, hash: string) { + private getEventAndTopics(event: EventLog, hash: string) { if (event.identifier === KroganSwapAuctionEventEnum.Purchase) { if (Buffer.from(event.topics[0], 'base64').toString() === KroganSwapAuctionEventEnum.UpdateListing) { this.logger.log( diff --git a/src/modules/rabbitmq/blockchain-events/handlers-reindex/endAuction-event.handler.ts b/src/modules/rabbitmq/blockchain-events/handlers-reindex/endAuction-event.handler.ts index 1adbb4a33..09c5de699 100644 --- a/src/modules/rabbitmq/blockchain-events/handlers-reindex/endAuction-event.handler.ts +++ b/src/modules/rabbitmq/blockchain-events/handlers-reindex/endAuction-event.handler.ts @@ -23,23 +23,23 @@ export class EndAuctionEventHandler { private notificationsService: NotificationsService, ) { } - async handle(event: any, hash: string, marketplace: Marketplace) { + async handle(event: any, marketplace: Marketplace) { try { const endAuctionEvent = new EndAuctionEvent(event); const topics = endAuctionEvent.getTopics(); marketplace = await this.marketplaceService.getMarketplaceByType( - endAuctionEvent.getAddress(), + endAuctionEvent.address, marketplace.type, topics.collection, ); if (!marketplace) return; - this.logger.log(`End auction event detected for hash '${hash}' and marketplace '${marketplace?.name}'`); + this.logger.log(`End auction event detected for marketplace '${marketplace?.name}'`); const auction = await this.auctionsGetterService.getAuctionByIdAndMarketplace(parseInt(topics.auctionId, 16), marketplace.key); if (!auction) return; - this.auctionsService.updateAuctionStatus(auction.id, AuctionStatusEnum.Ended, hash, AuctionEventEnum.EndAuctionEvent); + this.auctionsService.updateAuctionStatus(auction.id, AuctionStatusEnum.Ended, 'hash', AuctionEventEnum.EndAuctionEvent); this.notificationsService.updateNotificationStatus([auction.id]); this.ordersService.updateOrder(auction.id, OrderStatusEnum.Bought); await this.feedEventsSenderService.sendWonAuctionEvent(topics, auction, marketplace); diff --git a/src/modules/rabbitmq/blockchain-events/handlers-reindex/sendOffer-event.handler.ts b/src/modules/rabbitmq/blockchain-events/handlers-reindex/sendOffer-event.handler.ts index 42ebb4c98..5619d5c51 100644 --- a/src/modules/rabbitmq/blockchain-events/handlers-reindex/sendOffer-event.handler.ts +++ b/src/modules/rabbitmq/blockchain-events/handlers-reindex/sendOffer-event.handler.ts @@ -8,6 +8,7 @@ import { OffersService } from 'src/modules/offers/offers.service'; import { SendOfferEvent } from '../../entities/auction-reindex/sendOffer.event'; import { FeedEventsSenderService } from '../feed-events.service'; import { Marketplace } from 'src/modules/marketplaces/models'; +import { EventLog } from 'src/modules/metrics/rabbitEvent'; @Injectable() export class SendOfferEventHandler { @@ -20,22 +21,22 @@ export class SendOfferEventHandler { private readonly marketplaceService: MarketplacesService, ) { } - async handle(event: any, hash: string, marketplace: Marketplace) { + async handle(event: EventLog, marketplace: Marketplace) { try { if (marketplace.type === MarketplaceTypeEnum.External) { return; } const sendOffer = new SendOfferEvent(event); const topics = sendOffer.getTopics(); - marketplace = await this.marketplaceService.getMarketplaceByType(sendOffer.getAddress(), marketplace.type, topics.collection); + marketplace = await this.marketplaceService.getMarketplaceByType(sendOffer.address, marketplace.type, topics.collection); if (!marketplace) { return; } - this.logger.log(`Send Offer event detected for hash '${hash}' and marketplace '${marketplace?.name}'`); + this.logger.log(`Send Offer event detected for marketplace '${marketplace?.name}'`); - const offer = await this.offersService.saveOffer(OfferEntity.fromEventTopics(topics, hash, marketplace.key, OfferStatusEnum.Active)); + const offer = await this.offersService.saveOffer(OfferEntity.fromEventTopics(topics, 'hash', marketplace.key, OfferStatusEnum.Active)); if (!offer) return; await this.feedEventsSenderService.sendOfferEvent(offer); diff --git a/src/modules/rabbitmq/blockchain-events/handlers-reindex/startAuction-event.handler.ts b/src/modules/rabbitmq/blockchain-events/handlers-reindex/startAuction-event.handler.ts index 03c25c52a..9710aa9ed 100644 --- a/src/modules/rabbitmq/blockchain-events/handlers-reindex/startAuction-event.handler.ts +++ b/src/modules/rabbitmq/blockchain-events/handlers-reindex/startAuction-event.handler.ts @@ -13,6 +13,7 @@ import { AuctionTokenEvent } from '../../entities/auction-reindex'; import { ElrondSwapAuctionEvent } from '../../entities/auction-reindex/elrondnftswap/elrondswap-auction.event'; import { ListNftEvent } from '../../entities/auction-reindex/listNft.event'; import { FeedEventsSenderService } from '../feed-events.service'; +import { EventLog } from 'src/modules/metrics/rabbitEvent'; @Injectable() export class StartAuctionEventHandler { @@ -27,22 +28,22 @@ export class StartAuctionEventHandler { private readonly marketplaceService: MarketplacesService, ) { } - async handle(event: any, hash: string, marketplace: Marketplace) { + async handle(event: any, marketplace: Marketplace) { try { const { auctionTokenEvent, topics } = this.getEventAndTopics(event); if (!auctionTokenEvent && !topics) return; marketplace = await this.marketplaceService.getMarketplaceByType( - auctionTokenEvent.getAddress(), + auctionTokenEvent.address, marketplace.type, topics.collection, ); if (!marketplace) return; this.logger.log( - `${auctionTokenEvent.getIdentifier()} listing event detected for hash '${hash}' and marketplace '${marketplace?.name}'`, + `${auctionTokenEvent.identifier} listing event detected for marketplace '${marketplace?.name}'`, ); - const auction = await this.saveAuction(topics, marketplace, hash); + const auction = await this.saveAuction(topics, marketplace, 'hash'); if (!auction) return; @@ -89,7 +90,7 @@ export class StartAuctionEventHandler { ); } - private getEventAndTopics(event: any) { + private getEventAndTopics(event: EventLog) { if (event.identifier === KroganSwapAuctionEventEnum.NftSwap) { const auctionTokenEvent = new ElrondSwapAuctionEvent(event); const topics = auctionTokenEvent.getTopics(); diff --git a/src/modules/rabbitmq/blockchain-events/handlers-reindex/swapUpdate-event.handler.ts b/src/modules/rabbitmq/blockchain-events/handlers-reindex/swapUpdate-event.handler.ts index 8f297800d..2c5b131ae 100644 --- a/src/modules/rabbitmq/blockchain-events/handlers-reindex/swapUpdate-event.handler.ts +++ b/src/modules/rabbitmq/blockchain-events/handlers-reindex/swapUpdate-event.handler.ts @@ -17,15 +17,15 @@ export class SwapUpdateEventHandler { private usdPriceService: UsdPriceService, ) { } - async handle(event: any, hash: string, marketplace: Marketplace) { + async handle(event: any, marketplace: Marketplace) { try { const updateEvent = new ElrondSwapUpdateEvent(event); const topics = updateEvent.getTopics(); - this.logger.log(`${updateEvent.getIdentifier()} auction event detected for hash '${hash}' and marketplace '${marketplace?.name}'`); + this.logger.log(`${updateEvent.identifier} auction event detected for marketplace '${marketplace?.name}'`); let auction = await this.auctionsGetterService.getAuctionByIdAndMarketplace(parseInt(topics.auctionId, 16), marketplace.key); if (auction) { - await this.updateAuctionPrice(auction, topics, hash); + await this.updateAuctionPrice(auction, topics); this.auctionsService.updateAuction(auction, KroganSwapAuctionEventEnum.NftSwapUpdate); } } catch (error) { @@ -44,7 +44,6 @@ export class SwapUpdateEventHandler { price: string; deadline: number; }, - hash: string, ) { const paymentToken = await this.usdPriceService.getToken(auction.paymentToken); const decimals = paymentToken?.decimals ?? mxConfig.decimals; @@ -54,6 +53,6 @@ export class SwapUpdateEventHandler { auction.maxBidDenominated = auction.minBidDenominated; auction.endDate = topics.deadline; auction.nrAuctionedTokens = topics.nrAuctionTokens; - auction.blockHash = hash; + auction.blockHash = 'hash'; } } diff --git a/src/modules/rabbitmq/blockchain-events/handlers-reindex/updateListing-event.handler.ts b/src/modules/rabbitmq/blockchain-events/handlers-reindex/updateListing-event.handler.ts index 00fc801c2..9d449b87c 100644 --- a/src/modules/rabbitmq/blockchain-events/handlers-reindex/updateListing-event.handler.ts +++ b/src/modules/rabbitmq/blockchain-events/handlers-reindex/updateListing-event.handler.ts @@ -9,6 +9,7 @@ import { UsdPriceService } from 'src/modules/usdPrice/usd-price.service'; import { BigNumberUtils } from 'src/utils/bigNumber-utils'; import { UpdateListingEvent } from '../../entities/auction-reindex/updateListing.event'; import { Marketplace } from 'src/modules/marketplaces/models'; +import { EventLog } from 'src/modules/metrics/rabbitEvent'; @Injectable() export class UpdateListingEventHandler { @@ -21,20 +22,20 @@ export class UpdateListingEventHandler { private usdPriceService: UsdPriceService, ) { } - async handle(event: any, hash: string, marketplace: Marketplace) { + async handle(event: EventLog, marketplace: Marketplace) { try { const updateListingEvent = new UpdateListingEvent(event); const topics = updateListingEvent.getTopics(); - marketplace = await this.marketplaceService.getMarketplaceByType(updateListingEvent.getAddress(), marketplace.type, topics.collection); + marketplace = await this.marketplaceService.getMarketplaceByType(updateListingEvent.address, marketplace.type, topics.collection); this.logger.log( - `${updateListingEvent.getIdentifier()} listing event detected for hash '${hash}' and marketplace '${marketplace?.name}'`, + `${updateListingEvent.identifier} listing event detected for marketplace '${marketplace?.name}'`, ); let auction = await this.auctionsGetterService.getAuctionByIdAndMarketplace(parseInt(topics.auctionId, 16), marketplace.key); if (auction && marketplace) { const paymentToken = await this.usdPriceService.getToken(auction.paymentToken); - this.updateAuctionListing(auction, updateListingEvent, paymentToken, hash); + this.updateAuctionListing(auction, updateListingEvent, paymentToken, 'hash'); this.auctionsService.updateAuction(auction, ExternalAuctionEventEnum.UpdateListing); } diff --git a/src/modules/rabbitmq/blockchain-events/handlers-reindex/updatePrice-event.handler.ts b/src/modules/rabbitmq/blockchain-events/handlers-reindex/updatePrice-event.handler.ts index 42fa505d0..90400aa55 100644 --- a/src/modules/rabbitmq/blockchain-events/handlers-reindex/updatePrice-event.handler.ts +++ b/src/modules/rabbitmq/blockchain-events/handlers-reindex/updatePrice-event.handler.ts @@ -9,6 +9,7 @@ import { UsdPriceService } from 'src/modules/usdPrice/usd-price.service'; import { BigNumberUtils } from 'src/utils/bigNumber-utils'; import { DEADRARE_KEY } from 'src/utils/constants'; import { UpdatePriceEvent } from '../../entities/auction-reindex/updatePrice.event'; +import { EventLog } from 'src/modules/metrics/rabbitEvent'; @Injectable() export class UpdatePriceEventHandler { @@ -22,21 +23,21 @@ export class UpdatePriceEventHandler { private nftAbiService: NftMarketplaceAbiService, ) { } - async handle(event: any, hash: string, marketplace: Marketplace) { + async handle(event: EventLog, marketplace: Marketplace) { try { const updatePriceEvent = new UpdatePriceEvent(event); const topics = updatePriceEvent.getTopics(); marketplace = await this.marketplaceService.getMarketplaceByType( - updatePriceEvent.getAddress(), + updatePriceEvent.address, marketplace.type, topics.collection, ); - this.logger.log(`${updatePriceEvent.getIdentifier()} event detected for hash '${hash}' and marketplace '${marketplace?.name}'`); + this.logger.log(`${updatePriceEvent.identifier} event detected for marketplace '${marketplace?.name}'`); let auction = await this.auctionsGetterService.getAuctionByIdAndMarketplace(parseInt(topics.auctionId, 16), marketplace.key); let newPrice: string = await this.getNewPrice(marketplace, topics); if (auction && newPrice) { const paymentToken = await this.usdPriceService.getToken(auction.paymentToken); - this.updateAuctionPrice(auction, newPrice, hash, paymentToken?.decimals); + this.updateAuctionPrice(auction, newPrice, 'hash', paymentToken?.decimals); this.auctionsService.updateAuction(auction, ExternalAuctionEventEnum.UpdatePrice); } diff --git a/src/modules/rabbitmq/blockchain-events/handlers-reindex/withdrawAuction-event.handler.ts b/src/modules/rabbitmq/blockchain-events/handlers-reindex/withdrawAuction-event.handler.ts index c5864a7e7..a68f1129d 100644 --- a/src/modules/rabbitmq/blockchain-events/handlers-reindex/withdrawAuction-event.handler.ts +++ b/src/modules/rabbitmq/blockchain-events/handlers-reindex/withdrawAuction-event.handler.ts @@ -8,6 +8,7 @@ import { WithdrawEvent } from '../../entities/auction-reindex'; import { ClaimEvent } from '../../entities/auction-reindex/claim.event'; import { ElrondSwapWithdrawEvent } from '../../entities/auction-reindex/elrondnftswap/elrondswap-withdraw.event'; import { Marketplace } from 'src/modules/marketplaces/models'; +import { EventLog } from 'src/modules/metrics/rabbitEvent'; @Injectable() export class WithdrawAuctionEventHandler { @@ -19,14 +20,14 @@ export class WithdrawAuctionEventHandler { private readonly marketplaceService: MarketplacesService, ) { } - async handle(event: any, hash: string, marketplace: Marketplace) { + async handle(event: EventLog, marketplace: Marketplace) { try { const { withdraw, topics } = this.getEventAndTopics(event); let auction: AuctionEntity; - marketplace = await this.marketplaceService.getMarketplaceByType(withdraw.getAddress(), marketplace.type, topics.collection); + marketplace = await this.marketplaceService.getMarketplaceByType(withdraw.address, marketplace.type, topics.collection); if (!marketplace) return; - this.logger.log(`${withdraw.getIdentifier()} event detected for hash '${hash}' and marketplace '${marketplace?.name}'`); + this.logger.log(`${withdraw.identifier} event detected for marketplace '${marketplace?.name}'`); if (topics.auctionId) { auction = await this.auctionsGetterService.getAuctionByIdAndMarketplace(parseInt(topics.auctionId, 16), marketplace.key); } else { @@ -36,13 +37,13 @@ export class WithdrawAuctionEventHandler { if (!auction) return; - this.auctionsService.updateAuctionStatus(auction.id, AuctionStatusEnum.Closed, hash, AuctionEventEnum.WithdrawEvent); + this.auctionsService.updateAuctionStatus(auction.id, AuctionStatusEnum.Closed, 'hash', AuctionEventEnum.WithdrawEvent); } catch (error) { console.error('An errror occured while handling bid event', error); } } - private getEventAndTopics(event: any) { + private getEventAndTopics(event: EventLog) { if (event.identifier === KroganSwapAuctionEventEnum.WithdrawSwap) { const withdraw = new ElrondSwapWithdrawEvent(event); const topics = withdraw.getTopics(); diff --git a/src/modules/rabbitmq/blockchain-events/handlers-reindex/withdrawOffer-event.handler.ts b/src/modules/rabbitmq/blockchain-events/handlers-reindex/withdrawOffer-event.handler.ts index 2538a97a3..7ecdd33fc 100644 --- a/src/modules/rabbitmq/blockchain-events/handlers-reindex/withdrawOffer-event.handler.ts +++ b/src/modules/rabbitmq/blockchain-events/handlers-reindex/withdrawOffer-event.handler.ts @@ -6,6 +6,7 @@ import { OfferStatusEnum } from 'src/modules/offers/models'; import { OffersService } from 'src/modules/offers/offers.service'; import { WithdrawOfferEvent } from '../../entities/auction-reindex/withdrawOffer.event'; import { Marketplace } from 'src/modules/marketplaces/models'; +import { EventLog } from 'src/modules/metrics/rabbitEvent'; @Injectable() export class WithdrawOfferEventHandler { @@ -17,7 +18,7 @@ export class WithdrawOfferEventHandler { private readonly marketplaceService: MarketplacesService, ) { } - async handle(event: any, hash: string, marketplace: Marketplace) { + async handle(event: EventLog, marketplace: Marketplace) { try { if (marketplace.type === MarketplaceTypeEnum.External) { return; @@ -25,14 +26,14 @@ export class WithdrawOfferEventHandler { const withdrawOfferEvent = new WithdrawOfferEvent(event); const topics = withdrawOfferEvent.getTopics(); marketplace = await this.marketplaceService.getMarketplaceByCollectionAndAddress( - withdrawOfferEvent.getAddress(), + withdrawOfferEvent.address, topics.collection, ); if (!marketplace) { return; } - this.logger.log(`Withdraw Offer event detected for hash '${hash}' and marketplace '${marketplace?.name}'`); + this.logger.log(`Withdraw Offer event detected for marketplace '${marketplace?.name}'`); const withdrawOffer = await this.offersService.getOfferByIdAndMarketplace(topics.offerId, marketplace.key); diff --git a/src/modules/rabbitmq/blockchain-events/marketplace-events-processing.service.ts b/src/modules/rabbitmq/blockchain-events/marketplace-events-processing.service.ts index 00c0614d2..75adb6c5a 100644 --- a/src/modules/rabbitmq/blockchain-events/marketplace-events-processing.service.ts +++ b/src/modules/rabbitmq/blockchain-events/marketplace-events-processing.service.ts @@ -14,6 +14,7 @@ import { AcceptOfferEventHandler } from './handlers-reindex/acceptOffer-event.ha import { WithdrawOfferEventHandler } from './handlers-reindex/withdrawOffer-event.handler'; import { UpdateListingEventHandler } from './handlers-reindex/updateListing-event.handler'; import { MarketplacesService } from 'src/modules/marketplaces/marketplaces.service'; +import { EventLog } from 'src/modules/metrics/rabbitEvent'; @Injectable() export class MarketplaceEventsProcessingService { @@ -36,13 +37,13 @@ export class MarketplaceEventsProcessingService { private marketplaceService: MarketplacesService, ) { } - public async handleNftAuctionEvents(auctionEvents: any[], hash: string) { + public async handleNftAuctionEvents(auctionEvents: EventLog[]) { for (let event of auctionEvents) { const marketplace = await this.marketplaceService.getMarketplaceByAddress(event.address); switch (event.identifier) { case AuctionEventEnum.BidEvent: case KroganSwapAuctionEventEnum.Bid: - await this.bidEventHandler.handle(event, hash, marketplace); + await this.bidEventHandler.handle(event, marketplace); break; case AuctionEventEnum.BuySftEvent: @@ -53,10 +54,10 @@ export class MarketplaceEventsProcessingService { case KroganSwapAuctionEventEnum.Purchase: const eventName = Buffer.from(event.topics[0], 'base64').toString(); if (eventName === ExternalAuctionEventEnum.UpdateOffer || eventName === KroganSwapAuctionEventEnum.UpdateListing) { - this.logger.log(`${eventName} event detected for hash '${hash}' for marketplace ${event.address}, ignore it for the moment`); + this.logger.log(`${eventName} event detected for marketplace ${event.address}, ignore it for the moment`); continue; } - await this.buyEventHandler.handle(event, hash, marketplace); + await this.buyEventHandler.handle(event, marketplace); break; case AuctionEventEnum.WithdrawEvent: case KroganSwapAuctionEventEnum.WithdrawSwap: @@ -64,61 +65,61 @@ export class MarketplaceEventsProcessingService { case ExternalAuctionEventEnum.ReturnListing: if (Buffer.from(event.topics[0], 'base64').toString() === ExternalAuctionEventEnum.UpdateOffer) { this.logger.log( - `${event.topics[0]} event detected for hash '${hash}' for marketplace ${event.addreses}, ignore it for the moment`, + `${event.topics[0]} event detected for marketplace ${event.address}, ignore it for the moment`, ); continue; } - await this.withdrawAuctionEventHandler.handle(event, hash, marketplace); + await this.withdrawAuctionEventHandler.handle(event, marketplace); break; case AuctionEventEnum.EndAuctionEvent: - await this.endAuctionEventHandler.handle(event, hash, marketplace); + await this.endAuctionEventHandler.handle(event, marketplace); break; case AuctionEventEnum.AuctionTokenEvent: case ExternalAuctionEventEnum.Listing: case ExternalAuctionEventEnum.ListNftOnMarketplace: case KroganSwapAuctionEventEnum.NftSwap: - await this.startAuctionEventHandler.handle(event, hash, marketplace); + await this.startAuctionEventHandler.handle(event, marketplace); break; case ExternalAuctionEventEnum.ChangePrice: case ExternalAuctionEventEnum.UpdatePrice: - await this.updatePriceEventHandler.handle(event, hash, marketplace); + await this.updatePriceEventHandler.handle(event, marketplace); break; case ExternalAuctionEventEnum.UpdateListing: { - await this.updateListingEventHandler.handle(event, hash, marketplace); + await this.updateListingEventHandler.handle(event, marketplace); break; } case ExternalAuctionEventEnum.AcceptOffer: case ExternalAuctionEventEnum.AcceptOfferFromAuction: - const acceptOfferEventName = Buffer.from(event.topics[0], 'base64').toString(); + const acceptOfferEventName = Buffer.from(event.topics[0], 'hex').toString(); if (acceptOfferEventName === ExternalAuctionEventEnum.UserDeposit) { continue; } if (acceptOfferEventName === ExternalAuctionEventEnum.EndTokenEvent) { - await this.withdrawAuctionEventHandler.handle(event, hash, marketplace); + await this.withdrawAuctionEventHandler.handle(event, marketplace); } else { - await this.acceptOfferEventHandler.handle(event, hash, marketplace); + await this.acceptOfferEventHandler.handle(event, marketplace); } break; case AuctionEventEnum.WithdrawAuctionAndAcceptOffer: - if (Buffer.from(event.topics[0], 'base64').toString() === AuctionEventEnum.Accept_offer_token_event) { - await this.acceptOfferEventHandler.handle(event, hash, marketplace); + if (Buffer.from(event.topics[0], 'hex').toString() === AuctionEventEnum.Accept_offer_token_event) { + await this.acceptOfferEventHandler.handle(event, marketplace); } else { - await this.withdrawAuctionEventHandler.handle(event, hash, marketplace); + await this.withdrawAuctionEventHandler.handle(event, marketplace); } break; case ExternalAuctionEventEnum.AcceptGlobalOffer: - await this.acceptGlobalOfferEventHandler.handle(event, hash, marketplace); + await this.acceptGlobalOfferEventHandler.handle(event, marketplace); break; case AuctionEventEnum.SendOffer: - await this.sendOfferEventHandler.handle(event, hash, marketplace); + await this.sendOfferEventHandler.handle(event, marketplace); break; case AuctionEventEnum.WithdrawOffer: - await this.withdrawOfferEventHandler.handle(event, hash, marketplace); + await this.withdrawOfferEventHandler.handle(event, marketplace); break; case KroganSwapAuctionEventEnum.NftSwapUpdate: case KroganSwapAuctionEventEnum.NftSwapExtend: - await this.swapUpdateEventHandler.handle(event, hash, marketplace); + await this.swapUpdateEventHandler.handle(event, marketplace); break; case MarketplaceEventEnum.SCUpgrade: { await this.slackReportService.sendScUpgradeNotification(event.address); diff --git a/src/modules/rabbitmq/entities/auction-reindex/acceptGlobalOffer.event.ts b/src/modules/rabbitmq/entities/auction-reindex/acceptGlobalOffer.event.ts index be1ed2cf7..e390dfa25 100644 --- a/src/modules/rabbitmq/entities/auction-reindex/acceptGlobalOffer.event.ts +++ b/src/modules/rabbitmq/entities/auction-reindex/acceptGlobalOffer.event.ts @@ -1,10 +1,10 @@ -import { GenericEvent } from '../generic.event'; +import { EventLog } from 'src/modules/metrics/rabbitEvent'; import { AcceptGlobalOfferEventsTopics } from './acceptGlobalOffer.event.topics'; -export class AcceptGlobalOfferEvent extends GenericEvent { +export class AcceptGlobalOfferEvent extends EventLog { private decodedTopics: AcceptGlobalOfferEventsTopics; - constructor(init?: Partial) { + constructor(init?: Partial) { super(init); this.decodedTopics = new AcceptGlobalOfferEventsTopics(this.topics); } diff --git a/src/modules/rabbitmq/entities/auction-reindex/acceptOffer.event.ts b/src/modules/rabbitmq/entities/auction-reindex/acceptOffer.event.ts index 2cc8c602f..b847e26e8 100644 --- a/src/modules/rabbitmq/entities/auction-reindex/acceptOffer.event.ts +++ b/src/modules/rabbitmq/entities/auction-reindex/acceptOffer.event.ts @@ -1,10 +1,10 @@ -import { GenericEvent } from '../generic.event'; +import { EventLog } from 'src/modules/metrics/rabbitEvent'; import { AcceptOfferEventsTopics } from './acceptOffer.event.topics'; -export class AcceptOfferEvent extends GenericEvent { +export class AcceptOfferEvent extends EventLog { private decodedTopics: AcceptOfferEventsTopics; - constructor(init?: Partial) { + constructor(init?: Partial) { super(init); this.decodedTopics = new AcceptOfferEventsTopics(this.topics); } diff --git a/src/modules/rabbitmq/entities/auction-reindex/acceptOfferDeadrare.event.ts b/src/modules/rabbitmq/entities/auction-reindex/acceptOfferDeadrare.event.ts index 8d03cfcc0..72a5e8cad 100644 --- a/src/modules/rabbitmq/entities/auction-reindex/acceptOfferDeadrare.event.ts +++ b/src/modules/rabbitmq/entities/auction-reindex/acceptOfferDeadrare.event.ts @@ -1,10 +1,10 @@ -import { GenericEvent } from '../generic.event'; +import { EventLog } from 'src/modules/metrics/rabbitEvent'; import { AcceptOfferDeadrareEventsTopics } from './acceptOfferDeadrare.event.topics'; -export class AcceptOfferDeadrareEvent extends GenericEvent { +export class AcceptOfferDeadrareEvent extends EventLog { private decodedTopics: AcceptOfferDeadrareEventsTopics; - constructor(init?: Partial) { + constructor(init?: Partial) { super(init); this.decodedTopics = new AcceptOfferDeadrareEventsTopics(this.topics); } diff --git a/src/modules/rabbitmq/entities/auction-reindex/acceptOfferFrameit.event.ts b/src/modules/rabbitmq/entities/auction-reindex/acceptOfferFrameit.event.ts index 9cf7300a1..6ce198b79 100644 --- a/src/modules/rabbitmq/entities/auction-reindex/acceptOfferFrameit.event.ts +++ b/src/modules/rabbitmq/entities/auction-reindex/acceptOfferFrameit.event.ts @@ -1,10 +1,10 @@ -import { GenericEvent } from '../generic.event'; +import { EventLog } from 'src/modules/metrics/rabbitEvent'; import { AcceptOfferFrameitEventsTopics } from './acceptOfferFrameit.event.topics'; -export class AcceptOfferFrameitEvent extends GenericEvent { +export class AcceptOfferFrameitEvent extends EventLog { private decodedTopics: AcceptOfferFrameitEventsTopics; - constructor(init?: Partial) { + constructor(init?: Partial) { super(init); this.decodedTopics = new AcceptOfferFrameitEventsTopics(this.topics); } diff --git a/src/modules/rabbitmq/entities/auction-reindex/acceptOfferXoxno.event.ts b/src/modules/rabbitmq/entities/auction-reindex/acceptOfferXoxno.event.ts index 21c7ddeff..3981bea49 100644 --- a/src/modules/rabbitmq/entities/auction-reindex/acceptOfferXoxno.event.ts +++ b/src/modules/rabbitmq/entities/auction-reindex/acceptOfferXoxno.event.ts @@ -1,10 +1,11 @@ +import { EventLog } from 'src/modules/metrics/rabbitEvent'; import { GenericEvent } from '../generic.event'; import { AcceptOfferXoxnoEventsTopics } from './acceptOfferXoxno.event.topics'; -export class AcceptOfferXoxnoEvent extends GenericEvent { +export class AcceptOfferXoxnoEvent extends EventLog { private decodedTopics: AcceptOfferXoxnoEventsTopics; - constructor(init?: Partial) { + constructor(init?: Partial) { super(init); this.decodedTopics = new AcceptOfferXoxnoEventsTopics(this.topics); } diff --git a/src/modules/rabbitmq/entities/auction-reindex/auctionToken.event.ts b/src/modules/rabbitmq/entities/auction-reindex/auctionToken.event.ts index 6377b9d0d..f4db9303a 100644 --- a/src/modules/rabbitmq/entities/auction-reindex/auctionToken.event.ts +++ b/src/modules/rabbitmq/entities/auction-reindex/auctionToken.event.ts @@ -1,10 +1,10 @@ -import { GenericEvent } from '../generic.event'; +import { EventLog } from 'src/modules/metrics/rabbitEvent'; import { AuctionTokenEventsTopics } from './auctionToken.event.topics'; -export class AuctionTokenEvent extends GenericEvent { +export class AuctionTokenEvent extends EventLog { private decodedTopics: AuctionTokenEventsTopics; - constructor(init?: Partial) { + constructor(init?: Partial) { super(init); this.decodedTopics = new AuctionTokenEventsTopics(this.topics); } diff --git a/src/modules/rabbitmq/entities/auction-reindex/bid.event.ts b/src/modules/rabbitmq/entities/auction-reindex/bid.event.ts index 408cee8b5..a163381a4 100644 --- a/src/modules/rabbitmq/entities/auction-reindex/bid.event.ts +++ b/src/modules/rabbitmq/entities/auction-reindex/bid.event.ts @@ -1,10 +1,10 @@ -import { GenericEvent } from '../generic.event'; +import { EventLog } from 'src/modules/metrics/rabbitEvent'; import { BidEventsTopics } from './bid.event.topics'; -export class BidEvent extends GenericEvent { +export class BidEvent extends EventLog { private decodedTopics: BidEventsTopics; - constructor(init?: Partial) { + constructor(init?: Partial) { super(init); this.decodedTopics = new BidEventsTopics(this.topics); } diff --git a/src/modules/rabbitmq/entities/auction-reindex/buySft.event.ts b/src/modules/rabbitmq/entities/auction-reindex/buySft.event.ts index b4245c176..13339a247 100644 --- a/src/modules/rabbitmq/entities/auction-reindex/buySft.event.ts +++ b/src/modules/rabbitmq/entities/auction-reindex/buySft.event.ts @@ -1,10 +1,10 @@ -import { GenericEvent } from '../generic.event'; +import { EventLog } from 'src/modules/metrics/rabbitEvent'; import { BuySftEventsTopics } from './buySft.event.topics'; -export class BuySftEvent extends GenericEvent { +export class BuySftEvent extends EventLog { private decodedTopics: BuySftEventsTopics; - constructor(init?: Partial) { + constructor(init?: Partial) { super(init); this.decodedTopics = new BuySftEventsTopics(this.topics); } diff --git a/src/modules/rabbitmq/entities/auction-reindex/claim.event.ts b/src/modules/rabbitmq/entities/auction-reindex/claim.event.ts index 45e67713b..1a604ba4a 100644 --- a/src/modules/rabbitmq/entities/auction-reindex/claim.event.ts +++ b/src/modules/rabbitmq/entities/auction-reindex/claim.event.ts @@ -1,10 +1,10 @@ -import { GenericEvent } from '../generic.event'; +import { EventLog } from 'src/modules/metrics/rabbitEvent'; import { ClaimEventsTopics } from './claim.event.topics'; -export class ClaimEvent extends GenericEvent { +export class ClaimEvent extends EventLog { private decodedTopics: ClaimEventsTopics; - constructor(init?: Partial) { + constructor(init?: Partial) { super(init); this.decodedTopics = new ClaimEventsTopics(this.topics); } diff --git a/src/modules/rabbitmq/entities/auction-reindex/elrondnftswap/elrondswap-auction.event.ts b/src/modules/rabbitmq/entities/auction-reindex/elrondnftswap/elrondswap-auction.event.ts index ece09a2a7..268ac5157 100644 --- a/src/modules/rabbitmq/entities/auction-reindex/elrondnftswap/elrondswap-auction.event.ts +++ b/src/modules/rabbitmq/entities/auction-reindex/elrondnftswap/elrondswap-auction.event.ts @@ -1,10 +1,10 @@ -import { GenericEvent } from '../../generic.event'; +import { EventLog } from 'src/modules/metrics/rabbitEvent'; import { ElrondSwapAuctionTopics } from './elrondswap-auction.event.topics'; -export class ElrondSwapAuctionEvent extends GenericEvent { +export class ElrondSwapAuctionEvent extends EventLog { private decodedTopics: ElrondSwapAuctionTopics; - constructor(init?: Partial) { + constructor(init?: Partial) { super(init); this.decodedTopics = new ElrondSwapAuctionTopics(this.topics); } diff --git a/src/modules/rabbitmq/entities/auction-reindex/elrondnftswap/elrondswap-buy.event.ts b/src/modules/rabbitmq/entities/auction-reindex/elrondnftswap/elrondswap-buy.event.ts index ccb002bc5..277467851 100644 --- a/src/modules/rabbitmq/entities/auction-reindex/elrondnftswap/elrondswap-buy.event.ts +++ b/src/modules/rabbitmq/entities/auction-reindex/elrondnftswap/elrondswap-buy.event.ts @@ -1,10 +1,11 @@ +import { EventLog } from 'src/modules/metrics/rabbitEvent'; import { GenericEvent } from '../../generic.event'; import { ElrondSwapBuyTopics } from './elrondswap-buy.event.topics'; -export class ElrondSwapBuyEvent extends GenericEvent { +export class ElrondSwapBuyEvent extends EventLog { private decodedTopics: ElrondSwapBuyTopics; - constructor(init?: Partial) { + constructor(init?: Partial) { super(init); this.decodedTopics = new ElrondSwapBuyTopics(this.topics); } diff --git a/src/modules/rabbitmq/entities/auction-reindex/elrondnftswap/elrondswap-updateAuction.event.ts b/src/modules/rabbitmq/entities/auction-reindex/elrondnftswap/elrondswap-updateAuction.event.ts index 830909699..149333353 100644 --- a/src/modules/rabbitmq/entities/auction-reindex/elrondnftswap/elrondswap-updateAuction.event.ts +++ b/src/modules/rabbitmq/entities/auction-reindex/elrondnftswap/elrondswap-updateAuction.event.ts @@ -1,10 +1,10 @@ -import { GenericEvent } from '../../generic.event'; +import { EventLog } from 'src/modules/metrics/rabbitEvent'; import { ElrondSwapUpdateTopics } from './elrondswap-updateAuction.event.topics'; -export class ElrondSwapUpdateEvent extends GenericEvent { +export class ElrondSwapUpdateEvent extends EventLog { private decodedTopics: ElrondSwapUpdateTopics; - constructor(init?: Partial) { + constructor(init?: Partial) { super(init); this.decodedTopics = new ElrondSwapUpdateTopics(this.topics); } diff --git a/src/modules/rabbitmq/entities/auction-reindex/elrondnftswap/elrondswap-withdraw.event.ts b/src/modules/rabbitmq/entities/auction-reindex/elrondnftswap/elrondswap-withdraw.event.ts index 70d953851..2f7b8a27c 100644 --- a/src/modules/rabbitmq/entities/auction-reindex/elrondnftswap/elrondswap-withdraw.event.ts +++ b/src/modules/rabbitmq/entities/auction-reindex/elrondnftswap/elrondswap-withdraw.event.ts @@ -1,10 +1,10 @@ -import { GenericEvent } from '../../generic.event'; +import { EventLog } from 'src/modules/metrics/rabbitEvent'; import { ElrondSwapWithdrawTopics } from './elrondswap-withdraw.event.topics'; -export class ElrondSwapWithdrawEvent extends GenericEvent { +export class ElrondSwapWithdrawEvent extends EventLog { private decodedTopics: ElrondSwapWithdrawTopics; - constructor(init?: Partial) { + constructor(init?: Partial) { super(init); this.decodedTopics = new ElrondSwapWithdrawTopics(this.topics); } diff --git a/src/modules/rabbitmq/entities/auction-reindex/endAuction.event.ts b/src/modules/rabbitmq/entities/auction-reindex/endAuction.event.ts index 5f0608494..fadee5e25 100644 --- a/src/modules/rabbitmq/entities/auction-reindex/endAuction.event.ts +++ b/src/modules/rabbitmq/entities/auction-reindex/endAuction.event.ts @@ -1,10 +1,10 @@ -import { GenericEvent } from '../generic.event'; +import { EventLog } from 'src/modules/metrics/rabbitEvent'; import { EndAuctionEventsTopics } from './endAuction.event.topics'; -export class EndAuctionEvent extends GenericEvent { +export class EndAuctionEvent extends EventLog { private decodedTopics: EndAuctionEventsTopics; - constructor(init?: Partial) { + constructor(init?: Partial) { super(init); this.decodedTopics = new EndAuctionEventsTopics(this.topics); } diff --git a/src/modules/rabbitmq/entities/auction-reindex/listNft.event.ts b/src/modules/rabbitmq/entities/auction-reindex/listNft.event.ts index b0eb3dfb2..0b34c1f96 100644 --- a/src/modules/rabbitmq/entities/auction-reindex/listNft.event.ts +++ b/src/modules/rabbitmq/entities/auction-reindex/listNft.event.ts @@ -1,10 +1,10 @@ -import { GenericEvent } from '../generic.event'; +import { EventLog } from 'src/modules/metrics/rabbitEvent'; import { ListNftEventsTopics } from './listNft.event.topics'; -export class ListNftEvent extends GenericEvent { +export class ListNftEvent extends EventLog { private decodedTopics: ListNftEventsTopics; - constructor(init?: Partial) { + constructor(init?: Partial) { super(init); this.decodedTopics = new ListNftEventsTopics(this.topics); } diff --git a/src/modules/rabbitmq/entities/auction-reindex/sendOffer.event.ts b/src/modules/rabbitmq/entities/auction-reindex/sendOffer.event.ts index 942032284..59601d177 100644 --- a/src/modules/rabbitmq/entities/auction-reindex/sendOffer.event.ts +++ b/src/modules/rabbitmq/entities/auction-reindex/sendOffer.event.ts @@ -1,10 +1,10 @@ -import { GenericEvent } from '../generic.event'; +import { EventLog } from 'src/modules/metrics/rabbitEvent'; import { SendOfferEventsTopics } from './sendOffer.event.topics'; -export class SendOfferEvent extends GenericEvent { +export class SendOfferEvent extends EventLog { private decodedTopics: SendOfferEventsTopics; - constructor(init?: Partial) { + constructor(init?: Partial) { super(init); this.decodedTopics = new SendOfferEventsTopics(this.topics); } diff --git a/src/modules/rabbitmq/entities/auction-reindex/updateListing.event.ts b/src/modules/rabbitmq/entities/auction-reindex/updateListing.event.ts index d4ef778be..24709d10a 100644 --- a/src/modules/rabbitmq/entities/auction-reindex/updateListing.event.ts +++ b/src/modules/rabbitmq/entities/auction-reindex/updateListing.event.ts @@ -1,10 +1,10 @@ -import { GenericEvent } from '../generic.event'; +import { EventLog } from 'src/modules/metrics/rabbitEvent'; import { UpdateListingEventsTopics } from './updateListing.event.topics'; -export class UpdateListingEvent extends GenericEvent { +export class UpdateListingEvent extends EventLog { private decodedTopics: UpdateListingEventsTopics; - constructor(init?: Partial) { + constructor(init?: Partial) { super(init); this.decodedTopics = new UpdateListingEventsTopics(this.topics); } diff --git a/src/modules/rabbitmq/entities/auction-reindex/updatePrice.event.ts b/src/modules/rabbitmq/entities/auction-reindex/updatePrice.event.ts index 1538b5535..94b5a265d 100644 --- a/src/modules/rabbitmq/entities/auction-reindex/updatePrice.event.ts +++ b/src/modules/rabbitmq/entities/auction-reindex/updatePrice.event.ts @@ -1,10 +1,10 @@ -import { GenericEvent } from '../generic.event'; +import { EventLog } from 'src/modules/metrics/rabbitEvent'; import { UpdatePriceEventsTopics } from './updatePrice.event.topics'; -export class UpdatePriceEvent extends GenericEvent { +export class UpdatePriceEvent extends EventLog { private decodedTopics: UpdatePriceEventsTopics; - constructor(init?: Partial) { + constructor(init?: Partial) { super(init); this.decodedTopics = new UpdatePriceEventsTopics(this.topics); } diff --git a/src/modules/rabbitmq/entities/auction-reindex/withdraw.event.ts b/src/modules/rabbitmq/entities/auction-reindex/withdraw.event.ts index c41f3f5b7..99a85c63f 100644 --- a/src/modules/rabbitmq/entities/auction-reindex/withdraw.event.ts +++ b/src/modules/rabbitmq/entities/auction-reindex/withdraw.event.ts @@ -1,10 +1,10 @@ -import { GenericEvent } from '../generic.event'; +import { EventLog } from 'src/modules/metrics/rabbitEvent'; import { WithdrawEventsTopics } from './withdraw.event.topics'; -export class WithdrawEvent extends GenericEvent { +export class WithdrawEvent extends EventLog { private decodedTopics: WithdrawEventsTopics; - constructor(init?: Partial) { + constructor(init?: Partial) { super(init); this.decodedTopics = new WithdrawEventsTopics(this.topics); } diff --git a/src/modules/rabbitmq/entities/auction-reindex/withdrawOffer.event.ts b/src/modules/rabbitmq/entities/auction-reindex/withdrawOffer.event.ts index 39570c200..258f45b4c 100644 --- a/src/modules/rabbitmq/entities/auction-reindex/withdrawOffer.event.ts +++ b/src/modules/rabbitmq/entities/auction-reindex/withdrawOffer.event.ts @@ -1,10 +1,10 @@ -import { GenericEvent } from '../generic.event'; +import { EventLog } from 'src/modules/metrics/rabbitEvent'; import { WithdrawOfferEventsTopics } from './withdrawOffer.event.topics'; -export class WithdrawOfferEvent extends GenericEvent { +export class WithdrawOfferEvent extends EventLog { private decodedTopics: WithdrawOfferEventsTopics; - constructor(init?: Partial) { + constructor(init?: Partial) { super(init); this.decodedTopics = new WithdrawOfferEventsTopics(this.topics); }