From 4a9cef142d3cd8608209f3f4ab8b977de953cf9d Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Fri, 19 Apr 2024 12:02:51 +0100 Subject: [PATCH] gas tokens --- adapters/balance/index.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/adapters/balance/index.ts b/adapters/balance/index.ts index 5e00269..c0c42b2 100644 --- a/adapters/balance/index.ts +++ b/adapters/balance/index.ts @@ -49,6 +49,8 @@ export async function balance( const chainData = await findBlockHeightArray(trackedTimestamp, chain); + if (target == GAS_TOKEN && owners.length > 1) + throw new Error(`cant multicall gas token balance.`); await PromisePool.withConcurrency(10) .for(Object.keys(chainData)) .process(async (block) => @@ -57,14 +59,10 @@ export async function balance( target: owners[0], block: Number(block), chain, - decimals, }).then((r: any) => { - if (r.includes(null)) + if (!r.output) throw new Error(`balance call failed for ${adapter}`); - chainData[block].result = r.reduce( - (p: number, c: any) => Number(p) + Number(c), - 0, - ); + chainData[block].result = Number(r.output); }) : await multiCall({ calls: owners.map((o: string) => ({ target, params: [o] })),