Skip to content

Commit

Permalink
fix: pool weight to number
Browse files Browse the repository at this point in the history
  • Loading branch information
luizakp committed Sep 21, 2023
1 parent 5519524 commit 97ae88c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ async function calculateTokensStats(
}, 0);

const tokenPromises = poolTokenData.map(async (token, idx) => {
token.weight = parseFloat(token.weight);
token.price = tokensPrices[idx];
token.balance = parseFloat(tokenBalance?.[idx]?.balance);
token.percentageValue =
Expand Down Expand Up @@ -198,7 +197,7 @@ export async function calculatePoolStats({
balPriceUSD,
tvl,
volume,
votingShare: parseFloat(votingShare),
votingShare: votingShare,
symbol,
network,
collectedFeesUSD,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,7 @@ export default function PoolTokensTable({
href={tokenUrl(token.address)}
tdClassNames="w-6"
linkClassNames="justify-end w-full"
>{`${(
token.weight * 100
).toFixed()}%`}</Table.BodyCellLink>
>{`${(token.weight * 100).toFixed()}%`}</Table.BodyCellLink>
)}
{token.balance && (
<Table.BodyCellLink
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ export default function TopPoolsChart({
result.tokens
.map(
(t) =>
`${t.symbol}${
t.weight ? `-${(t.weight! * 100).toFixed()}%` : ""
}`,
`${t.symbol}${t.weight ? `-${(t.weight! * 100).toFixed()}%` : ""}`,
)
.join(" "),
`${result.apr.total.toFixed()}% APR`,
Expand Down
4 changes: 2 additions & 2 deletions apps/balancer-tools/src/lib/balancer/gauges.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ const POOL_CACHE: { [id: string]: Pool } = {};
class Token {
logoSrc: string;
address: string;
weight: string | null;
weight: number | null;
symbol: string;

constructor(data: (typeof POOLS_WITH_LIVE_GAUGES)[0]["tokens"][0]) {
this.logoSrc = data.logoURI;
this.address = data.address;
this.weight = data.weight;
this.weight = Number(data.weight);
this.symbol = data.symbol;
}
}
Expand Down

0 comments on commit 97ae88c

Please sign in to comment.