From 7d57db4e36976aea9a64f097adc86addb5cb011f Mon Sep 17 00:00:00 2001 From: upalinski Date: Wed, 23 Oct 2024 12:09:13 +0300 Subject: [PATCH] debug logs --- src/main.ts | 4 +++- src/processor.ts | 3 +++ src/processors/ddcCustomerChargesProcessor.ts | 4 ++++ src/processors/ddcCustomerDepositsProcessor.ts | 3 +++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main.ts b/src/main.ts index f1427b2..587ca3a 100644 --- a/src/main.ts +++ b/src/main.ts @@ -21,8 +21,8 @@ import {DdcCustomerDepositsProcessor} from "./processors/ddcCustomerDepositsProc import {DdcCustomerChargesProcessor} from "./processors/ddcCustomerChargesProcessor"; processor.run(new TypeormDatabase({ supportHotBlocks: true }), async (ctx) => { + console.log("Got " + ctx.blocks.length + " blocks") const logger = ctx.log - // set up processors const cereBalancesProcessor = new CereBalancesProcessor() const ddcBalancesProcessor = new DdcBalancesProcessor() @@ -307,6 +307,7 @@ processor.run(new TypeormDatabase({ supportHotBlocks: true }), async (ctx) => { amount: deposit.amount })) }) + console.log("Storing customer deposits " + ddcCustomerDepositEntities.length) await ctx.store.insert(ddcCustomerDepositEntities) const ddcCustomerChargeEntities: DdcCustomerCharge[] = [] @@ -318,5 +319,6 @@ processor.run(new TypeormDatabase({ supportHotBlocks: true }), async (ctx) => { amount: charge.amount })) }) + console.log("Storing customer charges " + ddcCustomerChargeEntities.length) await ctx.store.insert(ddcCustomerChargeEntities) }) diff --git a/src/processor.ts b/src/processor.ts index 746a492..be1880b 100644 --- a/src/processor.ts +++ b/src/processor.ts @@ -8,6 +8,9 @@ import { } from '@subsquid/substrate-processor' import { events } from './types' +console.info("Start squid indexer") + + export const processor = new SubstrateBatchProcessor() .setRpcEndpoint({ url: assertNotNull(process.env.RPC_CERE_HTTP, 'No RPC endpoint supplied'), diff --git a/src/processors/ddcCustomerChargesProcessor.ts b/src/processors/ddcCustomerChargesProcessor.ts index 6efec03..bec6996 100644 --- a/src/processors/ddcCustomerChargesProcessor.ts +++ b/src/processors/ddcCustomerChargesProcessor.ts @@ -24,9 +24,12 @@ export class DdcCustomerChargesProcessor extends BaseProcessor { switch (event.name) { case events.ddcCustomers.charged.name: { + console.log("Got customer charged event") if (events.ddcCustomers.charged.v48013.is(event)) { + console.log("Event version v48013") // unsupported version, just skip } else if (events.ddcCustomers.charged.v48014.is(event)) { + console.log("Event version v48014") const decoded = events.ddcCustomers.charged.v48014.decode(event) const accountId = decoded[0] const amount = decoded[1] @@ -36,6 +39,7 @@ export class DdcCustomerChargesProcessor extends BaseProcessor { amount: amount }) } else if (events.ddcCustomers.charged.v48800.is(event)) { + console.log("Event version v48800") const decoded = events.ddcCustomers.charged.v48800.decode(event) const accountId = decoded.ownerId const amount = decoded.charged diff --git a/src/processors/ddcCustomerDepositsProcessor.ts b/src/processors/ddcCustomerDepositsProcessor.ts index ed75265..a236a47 100644 --- a/src/processors/ddcCustomerDepositsProcessor.ts +++ b/src/processors/ddcCustomerDepositsProcessor.ts @@ -24,7 +24,9 @@ export class DdcCustomerDepositsProcessor extends BaseProcessor { switch (event.name) { case events.ddcCustomers.deposited.name: { + console.log("Got customer deposited event") if (events.ddcCustomers.deposited.v48013.is(event)) { + console.log("Event version v48013") const decoded = events.ddcCustomers.deposited.v48013.decode(event) const accountId = decoded[0] const amount = decoded[1] @@ -34,6 +36,7 @@ export class DdcCustomerDepositsProcessor extends BaseProcessor { amount: amount }) } else if (events.ddcCustomers.deposited.v48800.is(event)) { + console.log("Event version v48800") const decoded = events.ddcCustomers.deposited.v48800.decode(event) const accountId = decoded.ownerId const amount = decoded.amount