From f1713efdf2648d6a5fd312b9c48f62b41fc5d367 Mon Sep 17 00:00:00 2001 From: 0xPeluche <0xpeluche@proton.me> Date: Mon, 11 Mar 2024 09:43:28 +0100 Subject: [PATCH 1/2] small fixes --- src/adapters/balancer/common/balance.ts | 4 ++-- src/lib/balance.ts | 11 +++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/adapters/balancer/common/balance.ts b/src/adapters/balancer/common/balance.ts index f867c2fb8..6b5270b25 100644 --- a/src/adapters/balancer/common/balance.ts +++ b/src/adapters/balancer/common/balance.ts @@ -55,7 +55,7 @@ export async function getBalancerBalances(ctx: BalancesContext, pools: Contract[ } async function getBalancerRewards(ctx: BalancesContext, pools: Contract[]): Promise { - const rewardCalls: Call[] = pools.flatMap( + const rewardCalls: Call[] = (pools || []).flatMap( (pool, poolIndex) => pool.rewards?.map( (rewardToken, rewardTokenIndex) => @@ -70,7 +70,7 @@ async function getBalancerRewards(ctx: BalancesContext, pools: Contract[]): Prom const [pendingBals, extraRewardsBalances] = await Promise.all([ multicall({ ctx, - calls: pools.map((pool) => ({ target: pool.gauge, params: [ctx.address] }) as const), + calls: (pools || []).map((pool) => ({ target: pool.gauge, params: [ctx.address] }) as const), abi: abi.claimable_tokens, }), multicall({ diff --git a/src/lib/balance.ts b/src/lib/balance.ts index 66b24e58f..8aa6de90c 100644 --- a/src/lib/balance.ts +++ b/src/lib/balance.ts @@ -14,7 +14,6 @@ import { getBalancesOf } from '@lib/erc20' import { unixFromDate } from '@lib/fmt' import { parseFloatBI } from '@lib/math' import { multicall } from '@lib/multicall' -import { sendSlackMessage } from '@lib/slack' import type { Token } from '@lib/token' import { isNotNullish } from '@lib/type' @@ -212,11 +211,11 @@ export async function resolveBalances( throw error } - await sendSlackMessage(ctx, { - level: 'error', - title: `[${ctx.adapterId}][${ctx.chain}] resolver ${contractKey} failed`, - message: (error as any).message, - }) + // await sendSlackMessage(ctx, { + // level: 'error', + // title: `[${ctx.adapterId}][${ctx.chain}] resolver ${contractKey} failed`, + // message: (error as any).message, + // }) // Catch execution errors in adapters getBalances console.error(`[${ctx.adapterId}][${ctx.chain}] resolver ${contractKey} failed`, error) From 43ce06e8bd8d89a69650eace8ee63ac9c4f0540f Mon Sep 17 00:00:00 2001 From: 0xPeluche <0xpeluche@proton.me> Date: Mon, 11 Mar 2024 09:44:49 +0100 Subject: [PATCH 2/2] sendSlackMessage --- src/lib/balance.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/lib/balance.ts b/src/lib/balance.ts index 8aa6de90c..66b24e58f 100644 --- a/src/lib/balance.ts +++ b/src/lib/balance.ts @@ -14,6 +14,7 @@ import { getBalancesOf } from '@lib/erc20' import { unixFromDate } from '@lib/fmt' import { parseFloatBI } from '@lib/math' import { multicall } from '@lib/multicall' +import { sendSlackMessage } from '@lib/slack' import type { Token } from '@lib/token' import { isNotNullish } from '@lib/type' @@ -211,11 +212,11 @@ export async function resolveBalances( throw error } - // await sendSlackMessage(ctx, { - // level: 'error', - // title: `[${ctx.adapterId}][${ctx.chain}] resolver ${contractKey} failed`, - // message: (error as any).message, - // }) + await sendSlackMessage(ctx, { + level: 'error', + title: `[${ctx.adapterId}][${ctx.chain}] resolver ${contractKey} failed`, + message: (error as any).message, + }) // Catch execution errors in adapters getBalances console.error(`[${ctx.adapterId}][${ctx.chain}] resolver ${contractKey} failed`, error)