Skip to content

Commit

Permalink
gas tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
waynebruce0x committed Apr 19, 2024
1 parent 6342980 commit 4a9cef1
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions adapters/balance/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) =>
Expand All @@ -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] })),
Expand Down

0 comments on commit 4a9cef1

Please sign in to comment.