Skip to content

Commit

Permalink
handle farm & create classic pool
Browse files Browse the repository at this point in the history
  • Loading branch information
namgold committed Oct 17, 2023
1 parent 96c506f commit 66ecab1
Show file tree
Hide file tree
Showing 4 changed files with 285 additions and 126 deletions.
1 change: 0 additions & 1 deletion src/hooks/useApproveCallback.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { MaxUint256 } from '@ethersproject/constants'
import { TransactionResponse } from '@ethersproject/providers'
import { Currency, CurrencyAmount, TokenAmount } from '@kyberswap/ks-sdk-core'
import { t } from '@lingui/macro'
import JSBI from 'jsbi'
Expand Down
14 changes: 13 additions & 1 deletion src/pages/CreatePool/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { AlertTriangle, Plus } from 'react-feather'
import { Link, Navigate, useNavigate, useParams } from 'react-router-dom'
import { Flex, Text } from 'rebass'

import { NotificationType } from 'components/Announcement/type'
import { ButtonError, ButtonLight, ButtonPrimary } from 'components/Button'
import { BlueCard, LightCard } from 'components/Card'
import { AutoColumn, ColumnCenter } from 'components/Column'
Expand All @@ -35,7 +36,7 @@ import useTheme from 'hooks/useTheme'
import useTransactionDeadline from 'hooks/useTransactionDeadline'
import DisclaimerERC20 from 'pages/AddLiquidityV2/components/DisclaimerERC20'
import { Dots, Wrapper } from 'pages/Pool/styleds'
import { useWalletModalToggle } from 'state/application/hooks'
import { useNotify, useWalletModalToggle } from 'state/application/hooks'
import { Field } from 'state/mint/actions'
import { useDerivedMintInfo, useMintActionHandlers, useMintState } from 'state/mint/hooks'
import { useDerivedPairInfo } from 'state/pair/hooks'
Expand All @@ -47,6 +48,7 @@ import { StyledInternalLink, TYPE } from 'theme'
import { calculateGasMargin, calculateSlippageAmount, formattedNum } from 'utils'
import { currencyId } from 'utils/currencyId'
import { feeRangeCalc, useCurrencyConvertedToNative } from 'utils/dmm'
import { friendlyError } from 'utils/errorMessage'
import { getDynamicFeeRouterContract, getStaticFeeRouterContract } from 'utils/getContract'
import isZero from 'utils/isZero'
import { maxAmountSpend } from 'utils/maxAmountSpend'
Expand Down Expand Up @@ -184,6 +186,7 @@ export default function CreatePool() {

const addTransactionWithType = useTransactionAdder()
const addPair = usePairAdderByTokens()
const notify = useNotify()

async function onAdd() {
// if (!pair) return
Expand Down Expand Up @@ -300,6 +303,15 @@ export default function CreatePool() {
if (!didUserReject(error)) {
console.error(error)
}
const message = friendlyError(error)
notify(
{
title: t`Create Classic Pool Error`,
summary: message,
type: NotificationType.ERROR,
},
8000,
)
})
}

Expand Down
Loading

0 comments on commit 66ecab1

Please sign in to comment.