Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
15a2446ec8 | ||
|
|
dc5775e318 | ||
|
|
95bb70cf4f | ||
|
|
e454521a97 | ||
|
|
6b99656c1b | ||
|
|
e1436c30c5 | ||
|
|
16e4e0aefa |
2
.github/workflows/3-staging-to-prod.yml
vendored
2
.github/workflows/3-staging-to-prod.yml
vendored
@ -21,7 +21,7 @@ jobs:
|
|||||||
const statuses = await github.rest.repos.listCommitStatusesForRef({
|
const statuses = await github.rest.repos.listCommitStatusesForRef({
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
ref: context.payload.head_commit.sha
|
ref: context.sha
|
||||||
})
|
})
|
||||||
const status = statuses.data.find(status => status.context === 'Test / promotion')?.state || 'missing'
|
const status = statuses.data.find(status => status.context === 'Test / promotion')?.state || 'missing'
|
||||||
core.info('Status: ' + status)
|
core.info('Status: ' + status)
|
||||||
|
|||||||
1
CODEOWNERS
Normal file
1
CODEOWNERS
Normal file
@ -0,0 +1 @@
|
|||||||
|
@uniswap/web-admins
|
||||||
@ -13,6 +13,7 @@ import { QRCodeSVG } from 'qrcode.react'
|
|||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
import styled, { useTheme } from 'styled-components/macro'
|
import styled, { useTheme } from 'styled-components/macro'
|
||||||
import { CloseIcon, ThemedText } from 'theme'
|
import { CloseIcon, ThemedText } from 'theme'
|
||||||
|
import { isIOS } from 'utils/userAgent'
|
||||||
|
|
||||||
import uniPng from '../../assets/images/uniwallet_modal_icon.png'
|
import uniPng from '../../assets/images/uniwallet_modal_icon.png'
|
||||||
import { DownloadButton } from './DownloadButton'
|
import { DownloadButton } from './DownloadButton'
|
||||||
@ -41,8 +42,9 @@ export default function UniwalletModal() {
|
|||||||
const { activationState, cancelActivation } = useActivationState()
|
const { activationState, cancelActivation } = useActivationState()
|
||||||
const [uri, setUri] = useState<string>()
|
const [uri, setUri] = useState<string>()
|
||||||
|
|
||||||
// Displays the modal if a Uniswap Wallet Connection is pending & qrcode URI is available
|
// Displays the modal if not on iOS, a Uniswap Wallet Connection is pending, & qrcode URI is available
|
||||||
const open =
|
const open =
|
||||||
|
!isIOS &&
|
||||||
activationState.status === ActivationStatus.PENDING &&
|
activationState.status === ActivationStatus.PENDING &&
|
||||||
activationState.connection.type === ConnectionType.UNISWAP_WALLET_V2 &&
|
activationState.connection.type === ConnectionType.UNISWAP_WALLET_V2 &&
|
||||||
!!uri
|
!!uri
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
import usePrevious from 'hooks/usePrevious'
|
import React, { Suspense, useDeferredValue } from 'react'
|
||||||
import React, { Suspense } from 'react'
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is useful for keeping the "last rendered" components on-screen while any suspense
|
* This is useful for keeping the "last rendered" components on-screen while any suspense
|
||||||
@ -9,6 +8,7 @@ import React, { Suspense } from 'react'
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
export const SuspenseWithPreviousRenderAsFallback = (props: { children: React.ReactNode }) => {
|
export const SuspenseWithPreviousRenderAsFallback = (props: { children: React.ReactNode }) => {
|
||||||
const previousContents = usePrevious(props.children)
|
const previousChildren = useDeferredValue(props.children)
|
||||||
return <Suspense fallback={previousContents ?? null}>{props.children}</Suspense>
|
|
||||||
|
return <Suspense fallback={previousChildren ?? null}>{props.children}</Suspense>
|
||||||
}
|
}
|
||||||
|
|||||||
28
src/components/V2Unsupported/index.tsx
Normal file
28
src/components/V2Unsupported/index.tsx
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
import { Trans } from '@lingui/macro'
|
||||||
|
import { AutoColumn } from 'components/Column'
|
||||||
|
import styled from 'styled-components/macro'
|
||||||
|
import { ThemedText } from 'theme'
|
||||||
|
|
||||||
|
const TextWrapper = styled.div`
|
||||||
|
border: 1px solid ${({ theme }) => theme.textPrimary};
|
||||||
|
padding: 16px 12px;
|
||||||
|
border-radius: 12px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
`
|
||||||
|
|
||||||
|
export function V2Unsupported() {
|
||||||
|
return (
|
||||||
|
<AutoColumn gap="lg" justify="center">
|
||||||
|
<AutoColumn gap="md" style={{ width: '100%' }}>
|
||||||
|
<TextWrapper>
|
||||||
|
<ThemedText.BodySecondary color="textSecondary" textAlign="center">
|
||||||
|
<Trans>Uniswap V2 is not available on this network.</Trans>
|
||||||
|
</ThemedText.BodySecondary>
|
||||||
|
</TextWrapper>
|
||||||
|
</AutoColumn>
|
||||||
|
</AutoColumn>
|
||||||
|
)
|
||||||
|
}
|
||||||
@ -83,10 +83,7 @@ export class UniwalletConnect extends WalletConnectV2 {
|
|||||||
|
|
||||||
// Opens deeplink to Uniswap Wallet if on iOS
|
// Opens deeplink to Uniswap Wallet if on iOS
|
||||||
if (isIOS) {
|
if (isIOS) {
|
||||||
const newTab = window.open(`https://uniswap.org/app/wc?uri=${encodeURIComponent(uri)}`)
|
window.location.href = `uniswap://wc?uri=${encodeURIComponent(uri)}`
|
||||||
|
|
||||||
// Fixes blank tab opening on mobile Chrome
|
|
||||||
newTab?.close()
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,16 +41,9 @@ export const SUPPORTED_GAS_ESTIMATE_CHAIN_IDS = [
|
|||||||
] as const
|
] as const
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unsupported networks for V2 pool behavior.
|
* Supported networks for V2 pool behavior.
|
||||||
*/
|
*/
|
||||||
export const UNSUPPORTED_V2POOL_CHAIN_IDS = [
|
export const SUPPORTED_V2POOL_CHAIN_IDS = [ChainId.MAINNET, ChainId.GOERLI] as const
|
||||||
ChainId.POLYGON,
|
|
||||||
ChainId.OPTIMISM,
|
|
||||||
ChainId.ARBITRUM_ONE,
|
|
||||||
ChainId.BNB,
|
|
||||||
ChainId.ARBITRUM_GOERLI,
|
|
||||||
ChainId.AVALANCHE,
|
|
||||||
] as const
|
|
||||||
|
|
||||||
export const TESTNET_CHAIN_IDS = [
|
export const TESTNET_CHAIN_IDS = [
|
||||||
ChainId.GOERLI,
|
ChainId.GOERLI,
|
||||||
|
|||||||
@ -35,8 +35,7 @@ export default function useAccountRiskCheck(account: string | null | undefined)
|
|||||||
.catch(() => dispatch(setOpenModal(null)))
|
.catch(() => dispatch(setOpenModal(null)))
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
// leaving this code in place w/ a negligible cache time in case we want to increase cache time later
|
localStorage.setItem(riskCheckLocalStorageKey, (now + ms`1 day`).toString())
|
||||||
localStorage.setItem(riskCheckLocalStorageKey, (now + ms`10 seconds`).toString())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [account, dispatch])
|
}, [account, dispatch])
|
||||||
|
|||||||
7
src/hooks/useNetworkSupportsV2.ts
Normal file
7
src/hooks/useNetworkSupportsV2.ts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import { useWeb3React } from '@web3-react/core'
|
||||||
|
import { SUPPORTED_V2POOL_CHAIN_IDS } from 'constants/chains'
|
||||||
|
|
||||||
|
export function useNetworkSupportsV2() {
|
||||||
|
const { chainId } = useWeb3React()
|
||||||
|
return chainId && SUPPORTED_V2POOL_CHAIN_IDS.includes(chainId)
|
||||||
|
}
|
||||||
3597
src/locales/af-ZA.po
Normal file
3597
src/locales/af-ZA.po
Normal file
File diff suppressed because it is too large
Load Diff
3597
src/locales/ar-SA.po
Normal file
3597
src/locales/ar-SA.po
Normal file
File diff suppressed because it is too large
Load Diff
3597
src/locales/ca-ES.po
Normal file
3597
src/locales/ca-ES.po
Normal file
File diff suppressed because it is too large
Load Diff
3597
src/locales/cs-CZ.po
Normal file
3597
src/locales/cs-CZ.po
Normal file
File diff suppressed because it is too large
Load Diff
3597
src/locales/da-DK.po
Normal file
3597
src/locales/da-DK.po
Normal file
File diff suppressed because it is too large
Load Diff
3597
src/locales/de-DE.po
Normal file
3597
src/locales/de-DE.po
Normal file
File diff suppressed because it is too large
Load Diff
3597
src/locales/el-GR.po
Normal file
3597
src/locales/el-GR.po
Normal file
File diff suppressed because it is too large
Load Diff
3597
src/locales/es-ES.po
Normal file
3597
src/locales/es-ES.po
Normal file
File diff suppressed because it is too large
Load Diff
3597
src/locales/fi-FI.po
Normal file
3597
src/locales/fi-FI.po
Normal file
File diff suppressed because it is too large
Load Diff
3597
src/locales/fr-FR.po
Normal file
3597
src/locales/fr-FR.po
Normal file
File diff suppressed because it is too large
Load Diff
3597
src/locales/he-IL.po
Normal file
3597
src/locales/he-IL.po
Normal file
File diff suppressed because it is too large
Load Diff
3598
src/locales/hu-HU.po
Normal file
3598
src/locales/hu-HU.po
Normal file
File diff suppressed because it is too large
Load Diff
3597
src/locales/id-ID.po
Normal file
3597
src/locales/id-ID.po
Normal file
File diff suppressed because it is too large
Load Diff
3597
src/locales/it-IT.po
Normal file
3597
src/locales/it-IT.po
Normal file
File diff suppressed because it is too large
Load Diff
3597
src/locales/ja-JP.po
Normal file
3597
src/locales/ja-JP.po
Normal file
File diff suppressed because it is too large
Load Diff
3597
src/locales/ko-KR.po
Normal file
3597
src/locales/ko-KR.po
Normal file
File diff suppressed because it is too large
Load Diff
3597
src/locales/nl-NL.po
Normal file
3597
src/locales/nl-NL.po
Normal file
File diff suppressed because it is too large
Load Diff
3597
src/locales/no-NO.po
Normal file
3597
src/locales/no-NO.po
Normal file
File diff suppressed because it is too large
Load Diff
3597
src/locales/pl-PL.po
Normal file
3597
src/locales/pl-PL.po
Normal file
File diff suppressed because it is too large
Load Diff
3597
src/locales/pt-BR.po
Normal file
3597
src/locales/pt-BR.po
Normal file
File diff suppressed because it is too large
Load Diff
3597
src/locales/pt-PT.po
Normal file
3597
src/locales/pt-PT.po
Normal file
File diff suppressed because it is too large
Load Diff
3597
src/locales/ro-RO.po
Normal file
3597
src/locales/ro-RO.po
Normal file
File diff suppressed because it is too large
Load Diff
3597
src/locales/ru-RU.po
Normal file
3597
src/locales/ru-RU.po
Normal file
File diff suppressed because it is too large
Load Diff
3597
src/locales/sl-SI.po
Normal file
3597
src/locales/sl-SI.po
Normal file
File diff suppressed because it is too large
Load Diff
3597
src/locales/sr-SP.po
Normal file
3597
src/locales/sr-SP.po
Normal file
File diff suppressed because it is too large
Load Diff
3597
src/locales/sv-SE.po
Normal file
3597
src/locales/sv-SE.po
Normal file
File diff suppressed because it is too large
Load Diff
3597
src/locales/sw-TZ.po
Normal file
3597
src/locales/sw-TZ.po
Normal file
File diff suppressed because it is too large
Load Diff
3597
src/locales/th-TH.po
Normal file
3597
src/locales/th-TH.po
Normal file
File diff suppressed because it is too large
Load Diff
3597
src/locales/tr-TR.po
Normal file
3597
src/locales/tr-TR.po
Normal file
File diff suppressed because it is too large
Load Diff
3597
src/locales/uk-UA.po
Normal file
3597
src/locales/uk-UA.po
Normal file
File diff suppressed because it is too large
Load Diff
3597
src/locales/vi-VN.po
Normal file
3597
src/locales/vi-VN.po
Normal file
File diff suppressed because it is too large
Load Diff
3597
src/locales/zh-CN.po
Normal file
3597
src/locales/zh-CN.po
Normal file
File diff suppressed because it is too large
Load Diff
3597
src/locales/zh-TW.po
Normal file
3597
src/locales/zh-TW.po
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,10 +1,10 @@
|
|||||||
import { BigNumber } from '@ethersproject/bignumber'
|
import { BigNumber } from '@ethersproject/bignumber'
|
||||||
|
import { parseEther } from '@ethersproject/units'
|
||||||
import { BrowserEvent, InterfaceElementName, NFTEventName } from '@uniswap/analytics-events'
|
import { BrowserEvent, InterfaceElementName, NFTEventName } from '@uniswap/analytics-events'
|
||||||
import { useWeb3React } from '@web3-react/core'
|
import { useWeb3React } from '@web3-react/core'
|
||||||
import { TraceEvent } from 'analytics'
|
import { TraceEvent } from 'analytics'
|
||||||
import clsx from 'clsx'
|
import clsx from 'clsx'
|
||||||
import { OpacityHoverState } from 'components/Common'
|
import { OpacityHoverState } from 'components/Common'
|
||||||
import { parseEther } from 'ethers/lib/utils'
|
|
||||||
import { NftAssetTraitInput, NftMarketplace, NftStandard } from 'graphql/data/__generated__/types-and-hooks'
|
import { NftAssetTraitInput, NftMarketplace, NftStandard } from 'graphql/data/__generated__/types-and-hooks'
|
||||||
import { ASSET_PAGE_SIZE, AssetFetcherParams, useNftAssets } from 'graphql/data/nft/Asset'
|
import { ASSET_PAGE_SIZE, AssetFetcherParams, useNftAssets } from 'graphql/data/nft/Asset'
|
||||||
import useDebounce from 'hooks/useDebounce'
|
import useDebounce from 'hooks/useDebounce'
|
||||||
@ -266,8 +266,8 @@ export const CollectionNfts = ({ contractAddress, collectionStats, rarityVerifie
|
|||||||
filter: {
|
filter: {
|
||||||
listed: buyNow,
|
listed: buyNow,
|
||||||
marketplaces: markets.length > 0 ? markets.map((market) => market.toUpperCase() as NftMarketplace) : undefined,
|
marketplaces: markets.length > 0 ? markets.map((market) => market.toUpperCase() as NftMarketplace) : undefined,
|
||||||
maxPrice: debouncedMaxPrice ? parseEther(debouncedMaxPrice).toString() : undefined,
|
maxPrice: debouncedMaxPrice ? parseEther(debouncedMaxPrice.toString()).toString() : undefined,
|
||||||
minPrice: debouncedMinPrice ? parseEther(debouncedMinPrice).toString() : undefined,
|
minPrice: debouncedMinPrice ? parseEther(debouncedMinPrice.toString()).toString() : undefined,
|
||||||
tokenSearchQuery: debouncedSearchByNameText,
|
tokenSearchQuery: debouncedSearchByNameText,
|
||||||
traits:
|
traits:
|
||||||
traits.length > 0
|
traits.length > 0
|
||||||
|
|||||||
@ -9,6 +9,8 @@ import { useToggleAccountDrawer } from 'components/AccountDrawer'
|
|||||||
import { sendEvent } from 'components/analytics'
|
import { sendEvent } from 'components/analytics'
|
||||||
import UnsupportedCurrencyFooter from 'components/swap/UnsupportedCurrencyFooter'
|
import UnsupportedCurrencyFooter from 'components/swap/UnsupportedCurrencyFooter'
|
||||||
import { SwitchLocaleLink } from 'components/SwitchLocaleLink'
|
import { SwitchLocaleLink } from 'components/SwitchLocaleLink'
|
||||||
|
import { V2Unsupported } from 'components/V2Unsupported'
|
||||||
|
import { useNetworkSupportsV2 } from 'hooks/useNetworkSupportsV2'
|
||||||
import { useCallback, useState } from 'react'
|
import { useCallback, useState } from 'react'
|
||||||
import { Plus } from 'react-feather'
|
import { Plus } from 'react-feather'
|
||||||
import { useLocation, useNavigate, useParams } from 'react-router-dom'
|
import { useLocation, useNavigate, useParams } from 'react-router-dom'
|
||||||
@ -132,9 +134,10 @@ export default function AddLiquidity() {
|
|||||||
const [approvalB, approveBCallback] = useApproveCallback(parsedAmounts[Field.CURRENCY_B], router?.address)
|
const [approvalB, approveBCallback] = useApproveCallback(parsedAmounts[Field.CURRENCY_B], router?.address)
|
||||||
|
|
||||||
const addTransaction = useTransactionAdder()
|
const addTransaction = useTransactionAdder()
|
||||||
|
const networkSupportsV2 = useNetworkSupportsV2()
|
||||||
|
|
||||||
async function onAdd() {
|
async function onAdd() {
|
||||||
if (!chainId || !provider || !account || !router) return
|
if (!chainId || !provider || !account || !router || !networkSupportsV2) return
|
||||||
|
|
||||||
const { [Field.CURRENCY_A]: parsedAmountA, [Field.CURRENCY_B]: parsedAmountB } = parsedAmounts
|
const { [Field.CURRENCY_A]: parsedAmountA, [Field.CURRENCY_B]: parsedAmountB } = parsedAmounts
|
||||||
if (!parsedAmountA || !parsedAmountB || !currencyA || !currencyB || !deadline) {
|
if (!parsedAmountA || !parsedAmountB || !currencyA || !currencyB || !deadline) {
|
||||||
@ -318,6 +321,8 @@ export default function AddLiquidity() {
|
|||||||
|
|
||||||
const addIsUnsupported = useIsSwapUnsupported(currencies?.CURRENCY_A, currencies?.CURRENCY_B)
|
const addIsUnsupported = useIsSwapUnsupported(currencies?.CURRENCY_A, currencies?.CURRENCY_B)
|
||||||
|
|
||||||
|
if (!networkSupportsV2) return <V2Unsupported />
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<AppBody>
|
<AppBody>
|
||||||
|
|||||||
@ -14,8 +14,10 @@ import RangeSelector from 'components/RangeSelector'
|
|||||||
import RateToggle from 'components/RateToggle'
|
import RateToggle from 'components/RateToggle'
|
||||||
import SettingsTab from 'components/Settings'
|
import SettingsTab from 'components/Settings'
|
||||||
import { Dots } from 'components/swap/styleds'
|
import { Dots } from 'components/swap/styleds'
|
||||||
|
import { V2Unsupported } from 'components/V2Unsupported'
|
||||||
import { ApprovalState, useApproveCallback } from 'hooks/useApproveCallback'
|
import { ApprovalState, useApproveCallback } from 'hooks/useApproveCallback'
|
||||||
import useCurrentBlockTimestamp from 'hooks/useCurrentBlockTimestamp'
|
import useCurrentBlockTimestamp from 'hooks/useCurrentBlockTimestamp'
|
||||||
|
import { useNetworkSupportsV2 } from 'hooks/useNetworkSupportsV2'
|
||||||
import { PoolState, usePool } from 'hooks/usePools'
|
import { PoolState, usePool } from 'hooks/usePools'
|
||||||
import useTransactionDeadline from 'hooks/useTransactionDeadline'
|
import useTransactionDeadline from 'hooks/useTransactionDeadline'
|
||||||
import { useV2LiquidityTokenPermit } from 'hooks/useV2LiquidityTokenPermit'
|
import { useV2LiquidityTokenPermit } from 'hooks/useV2LiquidityTokenPermit'
|
||||||
@ -262,6 +264,8 @@ function V2PairMigration({
|
|||||||
const addTransaction = useTransactionAdder()
|
const addTransaction = useTransactionAdder()
|
||||||
const isMigrationPending = useIsTransactionPending(pendingMigrationHash ?? undefined)
|
const isMigrationPending = useIsTransactionPending(pendingMigrationHash ?? undefined)
|
||||||
|
|
||||||
|
const networkSupportsV2 = useNetworkSupportsV2()
|
||||||
|
|
||||||
const migrate = useCallback(() => {
|
const migrate = useCallback(() => {
|
||||||
if (
|
if (
|
||||||
!migrator ||
|
!migrator ||
|
||||||
@ -272,7 +276,8 @@ function V2PairMigration({
|
|||||||
typeof tickUpper !== 'number' ||
|
typeof tickUpper !== 'number' ||
|
||||||
!v3Amount0Min ||
|
!v3Amount0Min ||
|
||||||
!v3Amount1Min ||
|
!v3Amount1Min ||
|
||||||
!chainId
|
!chainId ||
|
||||||
|
!networkSupportsV2
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -354,31 +359,34 @@ function V2PairMigration({
|
|||||||
setConfirmingMigration(false)
|
setConfirmingMigration(false)
|
||||||
})
|
})
|
||||||
}, [
|
}, [
|
||||||
chainId,
|
|
||||||
isNotUniswap,
|
|
||||||
migrator,
|
migrator,
|
||||||
noLiquidity,
|
|
||||||
blockTimestamp,
|
|
||||||
token0,
|
|
||||||
token1,
|
|
||||||
feeAmount,
|
|
||||||
pairBalance,
|
|
||||||
tickLower,
|
|
||||||
tickUpper,
|
|
||||||
sqrtPrice,
|
|
||||||
v3Amount0Min,
|
|
||||||
v3Amount1Min,
|
|
||||||
account,
|
account,
|
||||||
deadline,
|
deadline,
|
||||||
|
blockTimestamp,
|
||||||
|
tickLower,
|
||||||
|
tickUpper,
|
||||||
|
v3Amount0Min,
|
||||||
|
v3Amount1Min,
|
||||||
|
chainId,
|
||||||
|
networkSupportsV2,
|
||||||
signatureData,
|
signatureData,
|
||||||
addTransaction,
|
noLiquidity,
|
||||||
pair,
|
pair.address,
|
||||||
|
pairBalance.quotient,
|
||||||
|
token0.address,
|
||||||
|
token1.address,
|
||||||
|
feeAmount,
|
||||||
|
sqrtPrice,
|
||||||
|
isNotUniswap,
|
||||||
currency0,
|
currency0,
|
||||||
currency1,
|
currency1,
|
||||||
|
addTransaction,
|
||||||
])
|
])
|
||||||
|
|
||||||
const isSuccessfullyMigrated = !!pendingMigrationHash && JSBI.equal(pairBalance.quotient, ZERO)
|
const isSuccessfullyMigrated = !!pendingMigrationHash && JSBI.equal(pairBalance.quotient, ZERO)
|
||||||
|
|
||||||
|
if (!networkSupportsV2) return <V2Unsupported />
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AutoColumn gap="20px">
|
<AutoColumn gap="20px">
|
||||||
<ThemedText.DeprecatedBody my={9} style={{ fontWeight: 400 }}>
|
<ThemedText.DeprecatedBody my={9} style={{ fontWeight: 400 }}>
|
||||||
|
|||||||
@ -7,6 +7,8 @@ import { useWeb3React } from '@web3-react/core'
|
|||||||
import MigrateSushiPositionCard from 'components/PositionCard/Sushi'
|
import MigrateSushiPositionCard from 'components/PositionCard/Sushi'
|
||||||
import MigrateV2PositionCard from 'components/PositionCard/V2'
|
import MigrateV2PositionCard from 'components/PositionCard/V2'
|
||||||
import { SwitchLocaleLink } from 'components/SwitchLocaleLink'
|
import { SwitchLocaleLink } from 'components/SwitchLocaleLink'
|
||||||
|
import { V2Unsupported } from 'components/V2Unsupported'
|
||||||
|
import { useNetworkSupportsV2 } from 'hooks/useNetworkSupportsV2'
|
||||||
import { PairState, useV2Pairs } from 'hooks/useV2Pairs'
|
import { PairState, useV2Pairs } from 'hooks/useV2Pairs'
|
||||||
import { ReactNode, useMemo } from 'react'
|
import { ReactNode, useMemo } from 'react'
|
||||||
import { Text } from 'rebass'
|
import { Text } from 'rebass'
|
||||||
@ -110,6 +112,9 @@ export default function MigrateV2() {
|
|||||||
const v2Pairs = useV2Pairs(tokenPairsWithV2Balance)
|
const v2Pairs = useV2Pairs(tokenPairsWithV2Balance)
|
||||||
const v2IsLoading = fetchingPairBalances || v2Pairs.some(([pairState]) => pairState === PairState.LOADING)
|
const v2IsLoading = fetchingPairBalances || v2Pairs.some(([pairState]) => pairState === PairState.LOADING)
|
||||||
|
|
||||||
|
const networkSupportsV2 = useNetworkSupportsV2()
|
||||||
|
if (!networkSupportsV2) return <V2Unsupported />
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<BodyWrapper style={{ padding: 24 }}>
|
<BodyWrapper style={{ padding: 24 }}>
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
import { Trans } from '@lingui/macro'
|
import { Trans } from '@lingui/macro'
|
||||||
import { BrowserEvent, InterfaceElementName, InterfaceEventName, InterfacePageName } from '@uniswap/analytics-events'
|
import { BrowserEvent, InterfaceElementName, InterfaceEventName, InterfacePageName } from '@uniswap/analytics-events'
|
||||||
import { V2_FACTORY_ADDRESSES } from '@uniswap/sdk-core'
|
|
||||||
import { useWeb3React } from '@web3-react/core'
|
import { useWeb3React } from '@web3-react/core'
|
||||||
import { Trace, TraceEvent } from 'analytics'
|
import { Trace, TraceEvent } from 'analytics'
|
||||||
import { useToggleAccountDrawer } from 'components/AccountDrawer'
|
import { useToggleAccountDrawer } from 'components/AccountDrawer'
|
||||||
@ -12,6 +11,7 @@ import { RowBetween, RowFixed } from 'components/Row'
|
|||||||
import { SwitchLocaleLink } from 'components/SwitchLocaleLink'
|
import { SwitchLocaleLink } from 'components/SwitchLocaleLink'
|
||||||
import { isSupportedChain } from 'constants/chains'
|
import { isSupportedChain } from 'constants/chains'
|
||||||
import { useFilterPossiblyMaliciousPositions } from 'hooks/useFilterPossiblyMaliciousPositions'
|
import { useFilterPossiblyMaliciousPositions } from 'hooks/useFilterPossiblyMaliciousPositions'
|
||||||
|
import { useNetworkSupportsV2 } from 'hooks/useNetworkSupportsV2'
|
||||||
import { useV3Positions } from 'hooks/useV3Positions'
|
import { useV3Positions } from 'hooks/useV3Positions'
|
||||||
import { useMemo } from 'react'
|
import { useMemo } from 'react'
|
||||||
import { AlertTriangle, BookOpen, ChevronDown, ChevronsRight, Inbox, Layers } from 'react-feather'
|
import { AlertTriangle, BookOpen, ChevronDown, ChevronsRight, Inbox, Layers } from 'react-feather'
|
||||||
@ -198,6 +198,7 @@ function WrongNetworkCard() {
|
|||||||
|
|
||||||
export default function Pool() {
|
export default function Pool() {
|
||||||
const { account, chainId } = useWeb3React()
|
const { account, chainId } = useWeb3React()
|
||||||
|
const networkSupportsV2 = useNetworkSupportsV2()
|
||||||
const toggleWalletDrawer = useToggleAccountDrawer()
|
const toggleWalletDrawer = useToggleAccountDrawer()
|
||||||
|
|
||||||
const theme = useTheme()
|
const theme = useTheme()
|
||||||
@ -225,7 +226,6 @@ export default function Pool() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const showConnectAWallet = Boolean(!account)
|
const showConnectAWallet = Boolean(!account)
|
||||||
const showV2Features = Boolean(V2_FACTORY_ADDRESSES[chainId])
|
|
||||||
|
|
||||||
const menuItems = [
|
const menuItems = [
|
||||||
{
|
{
|
||||||
@ -270,7 +270,7 @@ export default function Pool() {
|
|||||||
<Trans>Pools</Trans>
|
<Trans>Pools</Trans>
|
||||||
</ThemedText.LargeHeader>
|
</ThemedText.LargeHeader>
|
||||||
<ButtonRow>
|
<ButtonRow>
|
||||||
{showV2Features && (
|
{networkSupportsV2 && (
|
||||||
<PoolMenu
|
<PoolMenu
|
||||||
menuItems={menuItems}
|
menuItems={menuItems}
|
||||||
flyoutAlignment={FlyoutAlignment.LEFT}
|
flyoutAlignment={FlyoutAlignment.LEFT}
|
||||||
|
|||||||
@ -3,7 +3,8 @@ import { InterfacePageName } from '@uniswap/analytics-events'
|
|||||||
import { Pair } from '@uniswap/v2-sdk'
|
import { Pair } from '@uniswap/v2-sdk'
|
||||||
import { useWeb3React } from '@web3-react/core'
|
import { useWeb3React } from '@web3-react/core'
|
||||||
import { Trace } from 'analytics'
|
import { Trace } from 'analytics'
|
||||||
import { UNSUPPORTED_V2POOL_CHAIN_IDS } from 'constants/chains'
|
import { V2Unsupported } from 'components/V2Unsupported'
|
||||||
|
import { useNetworkSupportsV2 } from 'hooks/useNetworkSupportsV2'
|
||||||
import JSBI from 'jsbi'
|
import JSBI from 'jsbi'
|
||||||
import { useMemo } from 'react'
|
import { useMemo } from 'react'
|
||||||
import { ChevronsRight } from 'react-feather'
|
import { ChevronsRight } from 'react-feather'
|
||||||
@ -35,8 +36,9 @@ const PageWrapper = styled(AutoColumn)`
|
|||||||
`};
|
`};
|
||||||
`
|
`
|
||||||
|
|
||||||
const VoteCard = styled(DataCard)`
|
const LPFeeExplainer = styled(DataCard)`
|
||||||
background: radial-gradient(76.02% 75.41% at 1.84% 0%, #27ae60 0%, #000000 100%);
|
background: radial-gradient(76.02% 75.41% at 1.84% 0%, #27ae60 0%, #000000 100%);
|
||||||
|
margin: 0 0 16px 0;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
`
|
`
|
||||||
|
|
||||||
@ -85,18 +87,14 @@ const EmptyProposals = styled.div`
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
`
|
`
|
||||||
|
|
||||||
const Layer2Prompt = styled(EmptyProposals)`
|
|
||||||
margin-top: 16px;
|
|
||||||
`
|
|
||||||
|
|
||||||
export default function Pool() {
|
export default function Pool() {
|
||||||
const theme = useTheme()
|
const theme = useTheme()
|
||||||
const { account, chainId } = useWeb3React()
|
const { account } = useWeb3React()
|
||||||
const unsupportedV2Network = chainId && UNSUPPORTED_V2POOL_CHAIN_IDS.includes(chainId)
|
const networkSupportsV2 = useNetworkSupportsV2()
|
||||||
|
|
||||||
// fetch the user's balances of all tracked V2 LP tokens
|
// fetch the user's balances of all tracked V2 LP tokens
|
||||||
let trackedTokenPairs = useTrackedTokenPairs()
|
let trackedTokenPairs = useTrackedTokenPairs()
|
||||||
if (unsupportedV2Network) trackedTokenPairs = []
|
if (!networkSupportsV2) trackedTokenPairs = []
|
||||||
const tokenPairsWithLiquidityTokens = useMemo(
|
const tokenPairsWithLiquidityTokens = useMemo(
|
||||||
() => trackedTokenPairs.map((tokens) => ({ liquidityToken: toV2LiquidityToken(tokens), tokens })),
|
() => trackedTokenPairs.map((tokens) => ({ liquidityToken: toV2LiquidityToken(tokens), tokens })),
|
||||||
[trackedTokenPairs]
|
[trackedTokenPairs]
|
||||||
@ -145,7 +143,7 @@ export default function Pool() {
|
|||||||
<Trace page={InterfacePageName.POOL_PAGE} shouldLogImpression>
|
<Trace page={InterfacePageName.POOL_PAGE} shouldLogImpression>
|
||||||
<>
|
<>
|
||||||
<PageWrapper>
|
<PageWrapper>
|
||||||
<VoteCard>
|
<LPFeeExplainer>
|
||||||
<CardBGImage />
|
<CardBGImage />
|
||||||
<CardNoise />
|
<CardNoise />
|
||||||
<CardSection>
|
<CardSection>
|
||||||
@ -176,18 +174,10 @@ export default function Pool() {
|
|||||||
</CardSection>
|
</CardSection>
|
||||||
<CardBGImage />
|
<CardBGImage />
|
||||||
<CardNoise />
|
<CardNoise />
|
||||||
</VoteCard>
|
</LPFeeExplainer>
|
||||||
|
|
||||||
{unsupportedV2Network ? (
|
{!networkSupportsV2 ? (
|
||||||
<AutoColumn gap="lg" justify="center">
|
<V2Unsupported />
|
||||||
<AutoColumn gap="md" style={{ width: '100%' }}>
|
|
||||||
<Layer2Prompt>
|
|
||||||
<ThemedText.DeprecatedBody color={theme.textTertiary} textAlign="center">
|
|
||||||
<Trans>Uniswap V2 is not available on this network.</Trans>
|
|
||||||
</ThemedText.DeprecatedBody>
|
|
||||||
</Layer2Prompt>
|
|
||||||
</AutoColumn>
|
|
||||||
</AutoColumn>
|
|
||||||
) : (
|
) : (
|
||||||
<AutoColumn gap="lg" justify="center">
|
<AutoColumn gap="lg" justify="center">
|
||||||
<AutoColumn gap="md" style={{ width: '100%' }}>
|
<AutoColumn gap="md" style={{ width: '100%' }}>
|
||||||
|
|||||||
@ -3,6 +3,8 @@ import { InterfacePageName } from '@uniswap/analytics-events'
|
|||||||
import { Currency, CurrencyAmount, Token } from '@uniswap/sdk-core'
|
import { Currency, CurrencyAmount, Token } from '@uniswap/sdk-core'
|
||||||
import { useWeb3React } from '@web3-react/core'
|
import { useWeb3React } from '@web3-react/core'
|
||||||
import { Trace } from 'analytics'
|
import { Trace } from 'analytics'
|
||||||
|
import { V2Unsupported } from 'components/V2Unsupported'
|
||||||
|
import { useNetworkSupportsV2 } from 'hooks/useNetworkSupportsV2'
|
||||||
import JSBI from 'jsbi'
|
import JSBI from 'jsbi'
|
||||||
import { useCallback, useEffect, useState } from 'react'
|
import { useCallback, useEffect, useState } from 'react'
|
||||||
import { Plus } from 'react-feather'
|
import { Plus } from 'react-feather'
|
||||||
@ -96,6 +98,9 @@ export default function PoolFinder() {
|
|||||||
</LightCard>
|
</LightCard>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const networkSupportsV2 = useNetworkSupportsV2()
|
||||||
|
if (!networkSupportsV2) return <V2Unsupported />
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Trace page={InterfacePageName.POOL_PAGE} shouldLogImpression>
|
<Trace page={InterfacePageName.POOL_PAGE} shouldLogImpression>
|
||||||
<>
|
<>
|
||||||
|
|||||||
@ -8,7 +8,9 @@ import { useWeb3React } from '@web3-react/core'
|
|||||||
import { TraceEvent } from 'analytics'
|
import { TraceEvent } from 'analytics'
|
||||||
import { useToggleAccountDrawer } from 'components/AccountDrawer'
|
import { useToggleAccountDrawer } from 'components/AccountDrawer'
|
||||||
import { sendEvent } from 'components/analytics'
|
import { sendEvent } from 'components/analytics'
|
||||||
|
import { V2Unsupported } from 'components/V2Unsupported'
|
||||||
import { isSupportedChain } from 'constants/chains'
|
import { isSupportedChain } from 'constants/chains'
|
||||||
|
import { useNetworkSupportsV2 } from 'hooks/useNetworkSupportsV2'
|
||||||
import { useV2LiquidityTokenPermit } from 'hooks/useV2LiquidityTokenPermit'
|
import { useV2LiquidityTokenPermit } from 'hooks/useV2LiquidityTokenPermit'
|
||||||
import { PositionPageUnsupportedContent } from 'pages/Pool/PositionPage'
|
import { PositionPageUnsupportedContent } from 'pages/Pool/PositionPage'
|
||||||
import { useCallback, useMemo, useState } from 'react'
|
import { useCallback, useMemo, useState } from 'react'
|
||||||
@ -157,8 +159,12 @@ function RemoveLiquidity() {
|
|||||||
// tx sending
|
// tx sending
|
||||||
const addTransaction = useTransactionAdder()
|
const addTransaction = useTransactionAdder()
|
||||||
|
|
||||||
|
const networkSupportsV2 = useNetworkSupportsV2()
|
||||||
|
|
||||||
async function onRemove() {
|
async function onRemove() {
|
||||||
if (!chainId || !provider || !account || !deadline || !router) throw new Error('missing dependencies')
|
if (!chainId || !provider || !account || !deadline || !router || !networkSupportsV2) {
|
||||||
|
throw new Error('missing dependencies')
|
||||||
|
}
|
||||||
const { [Field.CURRENCY_A]: currencyAmountA, [Field.CURRENCY_B]: currencyAmountB } = parsedAmounts
|
const { [Field.CURRENCY_A]: currencyAmountA, [Field.CURRENCY_B]: currencyAmountB } = parsedAmounts
|
||||||
if (!currencyAmountA || !currencyAmountB) {
|
if (!currencyAmountA || !currencyAmountB) {
|
||||||
throw new Error('missing currency amounts')
|
throw new Error('missing currency amounts')
|
||||||
@ -439,6 +445,8 @@ function RemoveLiquidity() {
|
|||||||
liquidityPercentChangeCallback
|
liquidityPercentChangeCallback
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (!networkSupportsV2) return <V2Unsupported />
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<AppBody>
|
<AppBody>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user