Skip to content
This repository was archived by the owner on Jun 24, 2022. It is now read-only.

Commit

Permalink
revert: "fix: handle insufficient input amount error in v2 add liquid…
Browse files Browse the repository at this point in the history
…ity (#1652)" (#1665)

This reverts commit 307a995.
  • Loading branch information
Justin Domingue authored May 20, 2021
1 parent 536a5d9 commit ecdbb4a
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions src/state/mint/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,16 +158,10 @@ export function useDerivedMintInfo(
const { [Field.CURRENCY_A]: currencyAAmount, [Field.CURRENCY_B]: currencyBAmount } = parsedAmounts
const [tokenAmountA, tokenAmountB] = [currencyAAmount?.wrapped, currencyBAmount?.wrapped]
if (pair && totalSupply && tokenAmountA && tokenAmountB) {
try {
return pair.getLiquidityMinted(totalSupply, tokenAmountA, tokenAmountB)
} catch (error) {
if (error.isInsufficientInputAmountError) {
return CurrencyAmount.fromRawAmount(pair.liquidityToken, ZERO)
}
return undefined
}
return pair.getLiquidityMinted(totalSupply, tokenAmountA, tokenAmountB)
} else {
return undefined
}
return undefined
}, [parsedAmounts, pair, totalSupply])

const poolTokenPercentage = useMemo(() => {
Expand Down Expand Up @@ -201,10 +195,6 @@ export function useDerivedMintInfo(
error = 'Insufficient ' + currencies[Field.CURRENCY_B]?.symbol + ' balance'
}

if (!liquidityMinted?.greaterThan(ZERO)) {
error = `Insufficient input amount`
}

return {
dependentField,
currencies,
Expand Down

0 comments on commit ecdbb4a

Please sign in to comment.