From d1ca2a2e68b64204d08899e5ad04137632a18a3a Mon Sep 17 00:00:00 2001 From: Filippo Date: Tue, 19 Nov 2024 18:05:36 +0100 Subject: [PATCH] fix: cfg pending amounts (#270) --- .github/workflows/subql_multi_deploy_workflow.yaml | 1 - src/mappings/services/poolFeeService.ts | 13 ++++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/subql_multi_deploy_workflow.yaml b/.github/workflows/subql_multi_deploy_workflow.yaml index 626c598..9df7ae1 100644 --- a/.github/workflows/subql_multi_deploy_workflow.yaml +++ b/.github/workflows/subql_multi_deploy_workflow.yaml @@ -121,7 +121,6 @@ jobs: --dict="$SUBQL_DICTIONARIES" \ --type=$SUBQL_DEPLOYMENT_TYPE \ --disableHistorical \ - --disableIndexerStoreCacheAsync \ --queryLimit=1000 \ --indexerWorkers=0 \ --indexerUnsafe \ diff --git a/src/mappings/services/poolFeeService.ts b/src/mappings/services/poolFeeService.ts index 4f6b116..bc725a3 100644 --- a/src/mappings/services/poolFeeService.ts +++ b/src/mappings/services/poolFeeService.ts @@ -54,7 +54,13 @@ export class PoolFeeService extends PoolFee { } static async getActives(poolId: string) { - const poolFees = await this.getByFields([['poolId', '=', poolId],['isActive', '=', true]], { limit: 100 }) + const poolFees = await this.getByFields( + [ + ['poolId', '=', poolId], + ['isActive', '=', true], + ], + { limit: 100 } + ) return poolFees as PoolFeeService[] } @@ -147,11 +153,12 @@ export class PoolFeeService extends PoolFee { } static computeSumPendingFees(poolFees: PoolFeeService[]): bigint { - if(poolFees.length === 0) return BigInt(0) + if (poolFees.length === 0) return BigInt(0) const poolId = poolFees[0].poolId logger.info(`Computing pendingFees for pool: ${poolId} `) return poolFees.reduce((sumPendingAmount, poolFee) => { - if (!poolFee.pendingAmount) throw new Error(`pendingAmount not available in poolFee ${poolFee.id}`) + if (typeof poolFee.pendingAmount !== 'bigint') + throw new Error(`pendingAmount not available in poolFee ${poolFee.id}`) return sumPendingAmount + poolFee.pendingAmount }, BigInt(0)) }