fix: division by 0 error when both reserves are 0 (#1632)
* set pair to invalid if both reserves are 0 * consider reserve0/1=0 as no liquidity
This commit is contained in:
parent
7fc9a655fc
commit
6a4fa0c9bf
@ -83,7 +83,14 @@ export function useDerivedMintInfo(
|
|||||||
const totalSupply = useTotalSupply(pair?.liquidityToken)
|
const totalSupply = useTotalSupply(pair?.liquidityToken)
|
||||||
|
|
||||||
const noLiquidity: boolean =
|
const noLiquidity: boolean =
|
||||||
pairState === PairState.NOT_EXISTS || Boolean(totalSupply && JSBI.equal(totalSupply.quotient, ZERO))
|
pairState === PairState.NOT_EXISTS ||
|
||||||
|
Boolean(totalSupply && JSBI.equal(totalSupply.quotient, ZERO)) ||
|
||||||
|
Boolean(
|
||||||
|
pairState === PairState.EXISTS &&
|
||||||
|
pair &&
|
||||||
|
JSBI.equal(pair.reserve0.quotient, ZERO) &&
|
||||||
|
JSBI.equal(pair.reserve1.quotient, ZERO)
|
||||||
|
)
|
||||||
|
|
||||||
// balances
|
// balances
|
||||||
const balances = useCurrencyBalances(account ?? undefined, [
|
const balances = useCurrencyBalances(account ?? undefined, [
|
||||||
|
Loading…
Reference in New Issue
Block a user