Skip to content

Commit

Permalink
pools: format reserves accounting for decimals
Browse files Browse the repository at this point in the history
  • Loading branch information
fadeev committed Nov 15, 2023
1 parent 6ac3379 commit 0795c69
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions helpers/pools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@ export const getPools = async () => {
provider
);
const reserves = await uniswapPairContract.getReserves();
const r0 = ethers.utils.formatEther(reserves[0]);
const r1 = ethers.utils.formatEther(reserves[1]);
const [r0, r1] = reserves;
[reservesZRC20, reservesZETA] =
zrc20Address < zetaTokenAddress ? [r0, r1] : [r1, r0];

reservesZRC20 = ethers.utils.formatUnits(reservesZRC20, token.decimals);
reservesZETA = ethers.utils.formatUnits(reservesZETA);
}
return { ...token, pair, reservesZETA, reservesZRC20 };
});
Expand Down

0 comments on commit 0795c69

Please sign in to comment.