From 61ba41335a9327568312821acdeb48894d4425a9 Mon Sep 17 00:00:00 2001 From: Filippo Fontana Date: Wed, 13 Nov 2024 23:17:18 +0100 Subject: [PATCH] chore: cosmetics --- src/mappings/handlers/evmHandlers.ts | 5 +---- src/mappings/services/trancheBalanceService.ts | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/mappings/handlers/evmHandlers.ts b/src/mappings/handlers/evmHandlers.ts index a8fba92..5c40c3e 100644 --- a/src/mappings/handlers/evmHandlers.ts +++ b/src/mappings/handlers/evmHandlers.ts @@ -9,13 +9,10 @@ import { InvestorTransactionData, InvestorTransactionService } from '../services import { CurrencyService } from '../services/currencyService' import { BlockchainService } from '../services/blockchainService' import { CurrencyBalanceService } from '../services/currencyBalanceService' -import type { Provider } from '@ethersproject/providers' import { TrancheBalanceService } from '../services/trancheBalanceService' import { escrows } from '../../config' import { InvestorPositionService } from '../services/investorPositionService' import { getPeriodStart } from '../../helpers/timekeeperService' - -const _ethApi = api as Provider //const networkPromise = typeof ethApi.getNetwork === 'function' ? ethApi.getNetwork() : null export const handleEvmDeployTranche = errorHandler(_handleEvmDeployTranche) @@ -123,7 +120,7 @@ async function _handleEvmTransfer(event: TransferLog): Promise { await investLpCollect.save() const trancheBalance = await TrancheBalanceService.getOrInit( - toAccount.id, + toAccount!.id, orderData.poolId, orderData.trancheId, timestamp diff --git a/src/mappings/services/trancheBalanceService.ts b/src/mappings/services/trancheBalanceService.ts index 9b34812..5249fad 100644 --- a/src/mappings/services/trancheBalanceService.ts +++ b/src/mappings/services/trancheBalanceService.ts @@ -25,9 +25,9 @@ export class TrancheBalanceService extends TrancheBalance { return trancheBalance as TrancheBalanceService | undefined } - static getOrInit = async (address: string, poolId: string, trancheId: string, timestamp: Date) => { + static async getOrInit(address: string, poolId: string, trancheId: string, timestamp: Date) { let trancheBalance = await this.getById(address, poolId, trancheId) - if (trancheBalance === undefined) { + if (!trancheBalance) { trancheBalance = this.init(address, poolId, trancheId, timestamp) await trancheBalance.save() }