Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
interface
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LuckySwap
interface
Commits
60d1f874
Unverified
Commit
60d1f874
authored
Apr 23, 2021
by
Moody Salem
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
just a bit more refactoring to remove the data directory
parent
2d118a90
Changes
21
Show whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
47 additions
and
510 deletions
+47
-510
UniBalanceContent.tsx
src/components/Header/UniBalanceContent.tsx
+1
-1
V2.tsx
src/components/PositionCard/V2.tsx
+1
-1
index.tsx
src/components/PositionCard/index.tsx
+1
-1
PoolCard.tsx
src/components/earn/PoolCard.tsx
+3
-3
StakingRewards.json
src/hooks/StakingRewards.json
+0
-474
useSwapCallback.ts
src/hooks/useSwapCallback.ts
+1
-1
useToggledVersion.ts
src/hooks/useToggledVersion.ts
+1
-0
useTotalSupply.ts
src/hooks/useTotalSupply.ts
+1
-1
useUSDCPrice.ts
src/hooks/useUSDCPrice.ts
+2
-2
useV2Pairs.ts
src/hooks/useV2Pairs.ts
+4
-5
v2Trades.ts
src/hooks/v2Trades.ts
+2
-2
index.tsx
src/pages/AddLiquidityV2/index.tsx
+1
-1
Manage.tsx
src/pages/Earn/Manage.tsx
+3
-3
MigrateV2Pair.tsx
src/pages/MigrateV2/MigrateV2Pair.tsx
+1
-1
index.tsx
src/pages/MigrateV2/index.tsx
+2
-2
v2.tsx
src/pages/Pool/v2.tsx
+3
-3
index.tsx
src/pages/PoolFinder/index.tsx
+2
-2
index.tsx
src/pages/Swap/index.tsx
+2
-1
hooks.ts
src/state/burn/hooks.ts
+3
-3
v2.ts
src/state/mint/v2.ts
+3
-3
getTradeVersion.ts
src/utils/getTradeVersion.ts
+10
-0
No files found.
src/components/Header/UniBalanceContent.tsx
View file @
60d1f874
...
...
@@ -4,7 +4,7 @@ import { X } from 'react-feather'
import
styled
from
'
styled-components
'
import
tokenLogo
from
'
../../assets/images/token-logo.png
'
import
{
UNI
}
from
'
../../constants
'
import
{
useTotalSupply
}
from
'
../../
data/
TotalSupply
'
import
{
useTotalSupply
}
from
'
../../
hooks/use
TotalSupply
'
import
{
useActiveWeb3React
}
from
'
../../hooks
'
import
{
useMerkleDistributorContract
}
from
'
../../hooks/useContract
'
import
useCurrentBlockTimestamp
from
'
../../hooks/useCurrentBlockTimestamp
'
...
...
src/components/PositionCard/V2.tsx
View file @
60d1f874
...
...
@@ -5,7 +5,7 @@ import { ChevronDown, ChevronUp } from 'react-feather'
import
{
Link
}
from
'
react-router-dom
'
import
{
Text
}
from
'
rebass
'
import
styled
from
'
styled-components
'
import
{
useTotalSupply
}
from
'
../../
data/
TotalSupply
'
import
{
useTotalSupply
}
from
'
../../
hooks/use
TotalSupply
'
import
{
useActiveWeb3React
}
from
'
../../hooks
'
import
{
useTokenBalance
}
from
'
../../state/wallet/hooks
'
...
...
src/components/PositionCard/index.tsx
View file @
60d1f874
...
...
@@ -6,7 +6,7 @@ import { ChevronDown, ChevronUp } from 'react-feather'
import
{
Link
}
from
'
react-router-dom
'
import
{
Text
}
from
'
rebass
'
import
styled
from
'
styled-components
'
import
{
useTotalSupply
}
from
'
../../
data/
TotalSupply
'
import
{
useTotalSupply
}
from
'
../../
hooks/use
TotalSupply
'
import
{
useActiveWeb3React
}
from
'
../../hooks
'
import
{
useTokenBalance
}
from
'
../../state/wallet/hooks
'
...
...
src/components/earn/PoolCard.tsx
View file @
60d1f874
...
...
@@ -12,8 +12,8 @@ import { useColor } from '../../hooks/useColor'
import
{
currencyId
}
from
'
../../utils/currencyId
'
import
{
Break
,
CardNoise
,
CardBGImage
}
from
'
./styled
'
import
{
unwrappedToken
}
from
'
../../utils/wrappedCurrency
'
import
{
useTotalSupply
}
from
'
../../
data/
TotalSupply
'
import
{
use
Pair
}
from
'
../../data/V2
'
import
{
useTotalSupply
}
from
'
../../
hooks/use
TotalSupply
'
import
{
use
V2Pair
}
from
'
../../hooks/useV2Pairs
'
import
useUSDCPrice
from
'
../../hooks/useUSDCPrice
'
import
{
BIG_INT_SECONDS_IN_WEEK
}
from
'
../../constants
'
...
...
@@ -84,7 +84,7 @@ export default function PoolCard({ stakingInfo }: { stakingInfo: StakingInfo })
const
backgroundColor
=
useColor
(
token
)
const
totalSupplyOfStakingToken
=
useTotalSupply
(
stakingInfo
.
stakedAmount
.
token
)
const
[,
stakingTokenPair
]
=
usePair
(...
stakingInfo
.
tokens
)
const
[,
stakingTokenPair
]
=
use
V2
Pair
(...
stakingInfo
.
tokens
)
// let returnOverMonth: Percent = new Percent('0')
let
valueOfTotalStakedAmountInWETH
:
TokenAmount
|
undefined
...
...
src/hooks/StakingRewards.json
deleted
100644 → 0
View file @
2d118a90
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/hooks/useSwapCallback.ts
View file @
60d1f874
...
...
@@ -4,7 +4,7 @@ import { JSBI, Router, SwapParameters, Trade } from '@uniswap/v2-sdk'
import
{
Percent
,
TradeType
}
from
'
@uniswap/sdk-core
'
import
{
useMemo
}
from
'
react
'
import
{
BIPS_BASE
,
INITIAL_ALLOWED_SLIPPAGE
}
from
'
../constants
'
import
{
getTradeVersion
}
from
'
../
data
/getTradeVersion
'
import
{
getTradeVersion
}
from
'
../
utils
/getTradeVersion
'
import
{
useTransactionAdder
}
from
'
../state/transactions/hooks
'
import
{
calculateGasMargin
,
getRouterContract
,
isAddress
,
shortenAddress
}
from
'
../utils
'
import
isZero
from
'
../utils/isZero
'
...
...
src/hooks/useToggledVersion.ts
View file @
60d1f874
...
...
@@ -2,6 +2,7 @@ import useParsedQueryString from './useParsedQueryString'
export
enum
Version
{
v2
=
'
v2
'
,
v3
=
'
v3
'
,
}
export
const
DEFAULT_VERSION
:
Version
=
Version
.
v2
...
...
src/
data/
TotalSupply.ts
→
src/
hooks/use
TotalSupply.ts
View file @
60d1f874
import
{
BigNumber
}
from
'
@ethersproject/bignumber
'
import
{
Token
,
TokenAmount
}
from
'
@uniswap/sdk-core
'
import
{
useTokenContract
}
from
'
.
./hooks
/useContract
'
import
{
useTokenContract
}
from
'
./useContract
'
import
{
useSingleCallResult
}
from
'
../state/multicall/hooks
'
// returns undefined if input token is undefined, or fails to get token contract,
...
...
src/hooks/useUSDCPrice.ts
View file @
60d1f874
...
...
@@ -2,7 +2,7 @@ import { ChainId, Currency, currencyEquals, Price, WETH9 } from '@uniswap/sdk-co
import
{
JSBI
}
from
'
@uniswap/v2-sdk
'
import
{
useMemo
}
from
'
react
'
import
{
USDC
}
from
'
../constants
'
import
{
PairState
,
use
Pairs
}
from
'
../data/V2
'
import
{
PairState
,
use
V2Pairs
}
from
'
./useV2Pairs
'
import
{
useActiveWeb3React
}
from
'
../hooks
'
import
{
wrappedCurrency
}
from
'
../utils/wrappedCurrency
'
...
...
@@ -24,7 +24,7 @@ export default function useUSDCPrice(currency?: Currency): Price | undefined {
],
[
chainId
,
currency
,
wrapped
]
)
const
[[
ethPairState
,
ethPair
],
[
usdcPairState
,
usdcPair
],
[
usdcEthPairState
,
usdcEthPair
]]
=
usePairs
(
tokenPairs
)
const
[[
ethPairState
,
ethPair
],
[
usdcPairState
,
usdcPair
],
[
usdcEthPairState
,
usdcEthPair
]]
=
use
V2
Pairs
(
tokenPairs
)
return
useMemo
(()
=>
{
if
(
!
currency
||
!
wrapped
||
!
chainId
)
{
...
...
src/
data/V2
.ts
→
src/
hooks/useV2Pairs
.ts
View file @
60d1f874
...
...
@@ -2,8 +2,7 @@ import { Pair } from '@uniswap/v2-sdk'
import
{
useMemo
}
from
'
react
'
import
{
abi
as
IUniswapV2PairABI
}
from
'
@uniswap/v2-core/build/IUniswapV2Pair.json
'
import
{
Interface
}
from
'
@ethersproject/abi
'
import
{
useActiveWeb3React
}
from
'
../hooks
'
import
{
useActiveWeb3React
}
from
'
./index
'
import
{
useMultipleContractSingleData
}
from
'
../state/multicall/hooks
'
import
{
wrappedCurrency
}
from
'
../utils/wrappedCurrency
'
import
{
Currency
,
TokenAmount
}
from
'
@uniswap/sdk-core
'
...
...
@@ -17,7 +16,7 @@ export enum PairState {
INVALID
,
}
export
function
usePairs
(
currencies
:
[
Currency
|
undefined
,
Currency
|
undefined
][]):
[
PairState
,
Pair
|
null
][]
{
export
function
use
V2
Pairs
(
currencies
:
[
Currency
|
undefined
,
Currency
|
undefined
][]):
[
PairState
,
Pair
|
null
][]
{
const
{
chainId
}
=
useActiveWeb3React
()
const
tokens
=
useMemo
(
...
...
@@ -58,6 +57,6 @@ export function usePairs(currencies: [Currency | undefined, Currency | undefined
},
[
results
,
tokens
])
}
export
function
usePair
(
tokenA
?:
Currency
,
tokenB
?:
Currency
):
[
PairState
,
Pair
|
null
]
{
return
usePairs
([[
tokenA
,
tokenB
]])[
0
]
export
function
use
V2
Pair
(
tokenA
?:
Currency
,
tokenB
?:
Currency
):
[
PairState
,
Pair
|
null
]
{
return
use
V2
Pairs
([[
tokenA
,
tokenB
]])[
0
]
}
src/hooks/v2Trades.ts
View file @
60d1f874
...
...
@@ -10,7 +10,7 @@ import {
BETTER_TRADE_LESS_HOPS_THRESHOLD
,
CUSTOM_BASES
,
}
from
'
../constants
'
import
{
PairState
,
use
Pairs
}
from
'
../data/V2
'
import
{
PairState
,
use
V2Pairs
}
from
'
./useV2Pairs
'
import
{
wrappedCurrency
}
from
'
../utils/wrappedCurrency
'
import
{
useActiveWeb3React
}
from
'
./index
'
...
...
@@ -69,7 +69,7 @@ function useAllCommonPairs(currencyA?: Currency, currencyB?: Currency): Pair[] {
[
tokenA
,
tokenB
,
bases
,
basePairs
,
chainId
]
)
const
allPairs
=
usePairs
(
allPairCombinations
)
const
allPairs
=
use
V2
Pairs
(
allPairCombinations
)
// only pass along valid pairs, non-duplicated pairs
return
useMemo
(
...
...
src/pages/AddLiquidityV2/index.tsx
View file @
60d1f874
...
...
@@ -18,7 +18,7 @@ import { MinimalPositionCard } from '../../components/PositionCard'
import
Row
,
{
RowBetween
,
RowFlat
}
from
'
../../components/Row
'
import
{
ROUTER_ADDRESS
}
from
'
../../constants
'
import
{
PairState
}
from
'
../../
data/V2
'
import
{
PairState
}
from
'
../../
hooks/useV2Pairs
'
import
{
useActiveWeb3React
}
from
'
../../hooks
'
import
{
useCurrency
}
from
'
../../hooks/Tokens
'
import
{
ApprovalState
,
useApproveCallback
}
from
'
../../hooks/useApproveCallback
'
...
...
src/pages/Earn/Manage.tsx
View file @
60d1f874
...
...
@@ -25,8 +25,8 @@ import { CountUp } from 'use-count-up'
import
{
wrappedCurrency
}
from
'
../../utils/wrappedCurrency
'
import
{
currencyId
}
from
'
../../utils/currencyId
'
import
{
useTotalSupply
}
from
'
../../
data/
TotalSupply
'
import
{
use
Pair
}
from
'
../../data/V2
'
import
{
useTotalSupply
}
from
'
../../
hooks/use
TotalSupply
'
import
{
use
V2Pair
}
from
'
../../hooks/useV2Pairs
'
import
usePrevious
from
'
../../hooks/usePrevious
'
import
useUSDCPrice
from
'
../../hooks/useUSDCPrice
'
import
{
BIG_INT_ZERO
,
BIG_INT_SECONDS_IN_WEEK
}
from
'
../../constants
'
...
...
@@ -100,7 +100,7 @@ export default function Manage({
const
tokenA
=
wrappedCurrency
(
currencyA
??
undefined
,
chainId
)
const
tokenB
=
wrappedCurrency
(
currencyB
??
undefined
,
chainId
)
const
[,
stakingTokenPair
]
=
usePair
(
tokenA
,
tokenB
)
const
[,
stakingTokenPair
]
=
use
V2
Pair
(
tokenA
,
tokenB
)
const
stakingInfo
=
useStakingInfo
(
stakingTokenPair
)?.[
0
]
// detect existing unstaked LP position to show add button if none found
...
...
src/pages/MigrateV2/MigrateV2Pair.tsx
View file @
60d1f874
...
...
@@ -8,7 +8,7 @@ import CurrencyLogo from '../../components/CurrencyLogo'
import
FormattedCurrencyAmount
from
'
../../components/FormattedCurrencyAmount
'
import
QuestionHelper
from
'
../../components/QuestionHelper
'
import
{
AutoRow
,
RowBetween
,
RowFixed
}
from
'
../../components/Row
'
import
{
useTotalSupply
}
from
'
../../
data/
TotalSupply
'
import
{
useTotalSupply
}
from
'
../../
hooks/use
TotalSupply
'
import
{
useActiveWeb3React
}
from
'
../../hooks
'
import
{
useToken
}
from
'
../../hooks/Tokens
'
import
{
usePairContract
,
useV2MigratorContract
}
from
'
../../hooks/useContract
'
...
...
src/pages/MigrateV2/index.tsx
View file @
60d1f874
...
...
@@ -13,7 +13,7 @@ import QuestionHelper from '../../components/QuestionHelper'
import
{
Dots
}
from
'
../../components/swap/styleds
'
import
{
toV2LiquidityToken
,
useTrackedTokenPairs
}
from
'
../../state/user/hooks
'
import
MigrateV2PositionCard
from
'
components/PositionCard/V2
'
import
{
use
Pairs
}
from
'
data/V2
'
import
{
use
V2Pairs
}
from
'
hooks/useV2Pairs
'
// TODO there's a bug in loading where "No V2 Liquidity found" flashes
// TODO add support for more pairs
...
...
@@ -52,7 +52,7 @@ export default function MigrateV2() {
[
tokenPairsWithLiquidityTokens
,
v2PairsBalances
]
)
const
v2Pairs
=
usePairs
(
liquidityTokensWithBalances
.
map
(({
tokens
})
=>
tokens
))
const
v2Pairs
=
use
V2
Pairs
(
liquidityTokensWithBalances
.
map
(({
tokens
})
=>
tokens
))
const
v2IsLoading
=
fetchingV2PairBalances
||
v2Pairs
?.
length
<
liquidityTokensWithBalances
.
length
||
v2Pairs
?.
some
((
V2Pair
)
=>
!
V2Pair
)
const
allV2PairsWithLiquidity
=
v2Pairs
.
map
(([,
pair
])
=>
pair
).
filter
((
v2Pair
):
v2Pair
is
Pair
=>
Boolean
(
v2Pair
))
...
...
src/pages/Pool/v2.tsx
View file @
60d1f874
...
...
@@ -13,7 +13,7 @@ import { ButtonPrimary, ButtonSecondary } from '../../components/Button'
import
{
AutoColumn
}
from
'
../../components/Column
'
import
{
useActiveWeb3React
}
from
'
../../hooks
'
import
{
use
Pairs
}
from
'
../../data/V2
'
import
{
use
V2Pairs
}
from
'
../../hooks/useV2Pairs
'
import
{
toV2LiquidityToken
,
useTrackedTokenPairs
}
from
'
../../state/user/hooks
'
import
{
Dots
}
from
'
../../components/swap/styleds
'
import
{
CardSection
,
DataCard
,
CardNoise
,
CardBGImage
}
from
'
../../components/earn/styled
'
...
...
@@ -100,7 +100,7 @@ export default function Pool() {
[
tokenPairsWithLiquidityTokens
,
v2PairsBalances
]
)
const
v2Pairs
=
usePairs
(
liquidityTokensWithBalances
.
map
(({
tokens
})
=>
tokens
))
const
v2Pairs
=
use
V2
Pairs
(
liquidityTokensWithBalances
.
map
(({
tokens
})
=>
tokens
))
const
v2IsLoading
=
fetchingV2PairBalances
||
v2Pairs
?.
length
<
liquidityTokensWithBalances
.
length
||
v2Pairs
?.
some
((
V2Pair
)
=>
!
V2Pair
)
...
...
@@ -109,7 +109,7 @@ export default function Pool() {
// show liquidity even if its deposited in rewards contract
const
stakingInfo
=
useStakingInfo
()
const
stakingInfosWithBalance
=
stakingInfo
?.
filter
((
pool
)
=>
JSBI
.
greaterThan
(
pool
.
stakedAmount
.
raw
,
BIG_INT_ZERO
))
const
stakingPairs
=
usePairs
(
stakingInfosWithBalance
?.
map
((
stakingInfo
)
=>
stakingInfo
.
tokens
))
const
stakingPairs
=
use
V2
Pairs
(
stakingInfosWithBalance
?.
map
((
stakingInfo
)
=>
stakingInfo
.
tokens
))
// remove any pairs that also are included in pairs with stake in mining pool
const
v2PairsWithoutStakedAmount
=
allV2PairsWithLiquidity
.
filter
((
v2Pair
)
=>
{
...
...
src/pages/PoolFinder/index.tsx
View file @
60d1f874
...
...
@@ -11,7 +11,7 @@ import { FindPoolTabs } from '../../components/NavigationTabs'
import
{
MinimalPositionCard
}
from
'
../../components/PositionCard
'
import
Row
from
'
../../components/Row
'
import
CurrencySearchModal
from
'
../../components/SearchModal/CurrencySearchModal
'
import
{
PairState
,
use
Pair
}
from
'
../../data/V2
'
import
{
PairState
,
use
V2Pair
}
from
'
../../hooks/useV2Pairs
'
import
{
useActiveWeb3React
}
from
'
../../hooks
'
import
{
usePairAdder
}
from
'
../../state/user/hooks
'
import
{
useTokenBalance
}
from
'
../../state/wallet/hooks
'
...
...
@@ -43,7 +43,7 @@ export default function PoolFinder() {
const
[
currency0
,
setCurrency0
]
=
useState
<
Currency
|
null
>
(
ETHER
)
const
[
currency1
,
setCurrency1
]
=
useState
<
Currency
|
null
>
(
null
)
const
[
pairState
,
pair
]
=
usePair
(
currency0
??
undefined
,
currency1
??
undefined
)
const
[
pairState
,
pair
]
=
use
V2
Pair
(
currency0
??
undefined
,
currency1
??
undefined
)
const
addPair
=
usePairAdder
()
useEffect
(()
=>
{
if
(
pair
)
{
...
...
src/pages/Swap/index.tsx
View file @
60d1f874
...
...
@@ -22,7 +22,7 @@ import ProgressSteps from '../../components/ProgressSteps'
import
SwapHeader
from
'
../../components/swap/SwapHeader
'
import
{
INITIAL_ALLOWED_SLIPPAGE
}
from
'
../../constants
'
import
{
getTradeVersion
}
from
'
../../
data
/getTradeVersion
'
import
{
getTradeVersion
}
from
'
../../
utils
/getTradeVersion
'
import
{
useActiveWeb3React
}
from
'
../../hooks
'
import
{
useCurrency
,
useAllTokens
}
from
'
../../hooks/Tokens
'
import
{
ApprovalState
,
useApproveCallbackFromTrade
}
from
'
../../hooks/useApproveCallback
'
...
...
@@ -101,6 +101,7 @@ export default function Swap({ history }: RouteComponentProps) {
const
toggledVersion
=
useToggledVersion
()
const
tradesByVersion
=
{
[
Version
.
v2
]:
v2Trade
,
[
Version
.
v3
]:
undefined
,
}
const
trade
=
showWrap
?
undefined
:
tradesByVersion
[
toggledVersion
]
...
...
src/state/burn/hooks.ts
View file @
60d1f874
...
...
@@ -2,8 +2,8 @@ import { Currency, CurrencyAmount, Percent, TokenAmount } from '@uniswap/sdk-cor
import
{
JSBI
,
Pair
}
from
'
@uniswap/v2-sdk
'
import
{
useCallback
}
from
'
react
'
import
{
useDispatch
,
useSelector
}
from
'
react-redux
'
import
{
use
Pair
}
from
'
../../data/V2
'
import
{
useTotalSupply
}
from
'
../../
data/
TotalSupply
'
import
{
use
V2Pair
}
from
'
../../hooks/useV2Pairs
'
import
{
useTotalSupply
}
from
'
../../
hooks/use
TotalSupply
'
import
{
useActiveWeb3React
}
from
'
../../hooks
'
import
{
wrappedCurrency
}
from
'
../../utils/wrappedCurrency
'
...
...
@@ -34,7 +34,7 @@ export function useDerivedBurnInfo(
const
{
independentField
,
typedValue
}
=
useBurnState
()
// pair + totalsupply
const
[,
pair
]
=
usePair
(
currencyA
,
currencyB
)
const
[,
pair
]
=
use
V2
Pair
(
currencyA
,
currencyB
)
// balances
const
relevantTokenBalances
=
useTokenBalances
(
account
??
undefined
,
[
pair
?.
liquidityToken
])
...
...
src/state/mint/v2.ts
View file @
60d1f874
...
...
@@ -2,8 +2,8 @@ import { useMemo } from 'react'
import
{
Pair
}
from
'
@uniswap/v2-sdk
'
import
{
Currency
,
CurrencyAmount
,
ETHER
,
Percent
,
Price
,
TokenAmount
}
from
'
@uniswap/sdk-core
'
import
JSBI
from
'
jsbi
'
import
{
PairState
,
use
Pair
}
from
'
../../data/V2
'
import
{
useTotalSupply
}
from
'
../../
data/
TotalSupply
'
import
{
PairState
,
use
V2Pair
}
from
'
../../hooks/useV2Pairs
'
import
{
useTotalSupply
}
from
'
../../
hooks/use
TotalSupply
'
import
{
useActiveWeb3React
}
from
'
../../hooks
'
import
{
wrappedCurrency
,
wrappedCurrencyAmount
}
from
'
../../utils/wrappedCurrency
'
...
...
@@ -46,7 +46,7 @@ export function useV2DerivedMintInfo(
)
// pair
const
[
pairState
,
pair
]
=
usePair
(
currencies
[
Field
.
CURRENCY_A
],
currencies
[
Field
.
CURRENCY_B
])
const
[
pairState
,
pair
]
=
use
V2
Pair
(
currencies
[
Field
.
CURRENCY_A
],
currencies
[
Field
.
CURRENCY_B
])
const
totalSupply
=
useTotalSupply
(
pair
?.
liquidityToken
)
const
noLiquidity
:
boolean
=
...
...
src/
data
/getTradeVersion.ts
→
src/
utils
/getTradeVersion.ts
View file @
60d1f874
import
{
Trade
as
V2Trade
}
from
'
@uniswap/v2-sdk
'
import
{
Trade
as
V3Trade
}
from
'
@uniswap/v3-sdk
'
import
{
Version
}
from
'
../hooks/useToggledVersion
'
export
function
getTradeVersion
(
trade
?:
V2Trade
):
Version
|
undefined
{
export
function
getTradeVersion
(
trade
?:
V2Trade
|
V3Trade
):
Version
|
undefined
{
if
(
!
trade
)
return
undefined
return
Version
.
v2
if
(
trade
instanceof
V2Trade
)
return
Version
.
v2
if
(
trade
instanceof
V3Trade
)
return
Version
.
v3
throw
new
Error
(
'
Unknown trade type
'
)
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment