Skip to content

Commit

Permalink
fix: replace nan with 0 (#59)
Browse files Browse the repository at this point in the history
* fix: replace nan with 0

* Update usePoolLists.ts
  • Loading branch information
anukulpandey authored Jul 18, 2024
1 parent b12d068 commit f43eb49
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/hooks/usePoolLists.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ current: boolean): BigNumber => {
.div(new BigNumber(10).pow(decimals2))
.multipliedBy(tokenPrices[token2]);

return dv1.plus(dv2);
return dv1.plus(dv2).toString()=="NaN"? new BigNumber(0) :dv1.plus(dv2);
};

const calculateVolumeChange = (pool: PoolListItem, tokenPrices: TokenPrices): number => {
Expand Down Expand Up @@ -106,7 +106,7 @@ const calculateUserLiquidity = (
.multipliedBy(tokenPrices[token2]);
const res = v1.plus(v2);

return res.gt(0) ? res.toFormat(2) : undefined;
return res.gt(0) ? res.toFormat(2) : "0";
};

const getUserPoolList = (queryType: PoolQueryType, limit: number, offset: number, search: string, signerAddress: string): PoolQueryObject => ({
Expand Down

0 comments on commit f43eb49

Please sign in to comment.