Skip to content

Commit

Permalink
fix: Correctly handle undefined token decimals in onchain balance.
Browse files Browse the repository at this point in the history
  • Loading branch information
johngrantuk committed Oct 18, 2023
1 parent d5de8e2 commit 4ecb6e1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion balancer-js/src/modules/data/pool/onchain-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,11 @@ const merge = <T extends GenericPool>(pool: T, result: OnchainData) => ({
.indexOf(token.address);
const wrappedToken =
pool.wrappedIndex && pool.tokensList[pool.wrappedIndex];
const tokenDecimals =
token.decimals === undefined ? 18 : token.decimals;
return {
...token,
balance: formatFixed(result.poolTokens[1][idx], token.decimals || 18),
balance: formatFixed(result.poolTokens[1][idx], tokenDecimals),
weight:
(result.weights && formatFixed(result.weights[idx], 18)) ||
token.weight,
Expand Down

0 comments on commit 4ecb6e1

Please sign in to comment.