feat: base flag cleanup (#7134)

feat: remove base feature flag
This commit is contained in:
eddie 2023-08-10 11:05:48 -07:00 committed by GitHub
parent e04be0711f
commit 9fbdc3cab1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 10 additions and 64 deletions

@ -11,7 +11,6 @@ import { useWeb3React } from '@web3-react/core'
import { isSupportedChain } from 'constants/chains' import { isSupportedChain } from 'constants/chains'
import { RPC_PROVIDERS } from 'constants/providers' import { RPC_PROVIDERS } from 'constants/providers'
import { BaseContract } from 'ethers/lib/ethers' import { BaseContract } from 'ethers/lib/ethers'
import { useBaseEnabledChains } from 'featureFlags/flags/baseEnabled'
import { ContractInput, useUniswapPricesQuery } from 'graphql/data/__generated__/types-and-hooks' import { ContractInput, useUniswapPricesQuery } from 'graphql/data/__generated__/types-and-hooks'
import { toContractInput } from 'graphql/data/util' import { toContractInput } from 'graphql/data/util'
import useStablecoinPrice from 'hooks/useStablecoinPrice' import useStablecoinPrice from 'hooks/useStablecoinPrice'
@ -31,14 +30,13 @@ function useContractMultichain<T extends BaseContract>(
chainIds?: ChainId[] chainIds?: ChainId[]
): ContractMap<T> { ): ContractMap<T> {
const { chainId: walletChainId, provider: walletProvider } = useWeb3React() const { chainId: walletChainId, provider: walletProvider } = useWeb3React()
const baseEnabledChains = useBaseEnabledChains()
return useMemo(() => { return useMemo(() => {
const relevantChains = const relevantChains =
chainIds ?? chainIds ??
Object.keys(addressMap) Object.keys(addressMap)
.map((chainId) => parseInt(chainId)) .map((chainId) => parseInt(chainId))
.filter((chainId) => isSupportedChain(chainId, baseEnabledChains)) .filter((chainId) => isSupportedChain(chainId))
return relevantChains.reduce((acc: ContractMap<T>, chainId) => { return relevantChains.reduce((acc: ContractMap<T>, chainId) => {
const provider = const provider =
@ -52,7 +50,7 @@ function useContractMultichain<T extends BaseContract>(
} }
return acc return acc
}, {}) }, {})
}, [ABI, addressMap, baseEnabledChains, chainIds, walletChainId, walletProvider]) }, [ABI, addressMap, chainIds, walletChainId, walletProvider])
} }
export function useV3ManagerContracts(chainIds: ChainId[]): ContractMap<NonfungiblePositionManager> { export function useV3ManagerContracts(chainIds: ChainId[]): ContractMap<NonfungiblePositionManager> {

@ -5,7 +5,6 @@ import { MissingImageLogo } from 'components/Logo/AssetLogo'
import CurrencyLogo from 'components/Logo/CurrencyLogo' import CurrencyLogo from 'components/Logo/CurrencyLogo'
import { Unicon } from 'components/Unicon' import { Unicon } from 'components/Unicon'
import { getChainInfo } from 'constants/chainInfo' import { getChainInfo } from 'constants/chainInfo'
import { useBaseEnabledChains } from 'featureFlags/flags/baseEnabled'
import useTokenLogoSource from 'hooks/useAssetLogoSource' import useTokenLogoSource from 'hooks/useAssetLogoSource'
import useENSAvatar from 'hooks/useENSAvatar' import useENSAvatar from 'hooks/useENSAvatar'
import React from 'react' import React from 'react'
@ -99,8 +98,7 @@ export function PortfolioLogo({
size = '40px', size = '40px',
style, style,
}: MultiLogoProps) { }: MultiLogoProps) {
const baseEnabledChains = useBaseEnabledChains() const chainInfo = getChainInfo(chainId)
const chainInfo = getChainInfo(chainId, baseEnabledChains)
const squareLogoUrl = chainInfo?.squareLogoUrl const squareLogoUrl = chainInfo?.squareLogoUrl
const logoUrl = chainInfo?.logoUrl const logoUrl = chainInfo?.logoUrl
const chainLogo = squareLogoUrl ?? logoUrl const chainLogo = squareLogoUrl ?? logoUrl

@ -1,5 +1,4 @@
import { BaseVariant, FeatureFlag, featureFlagSettings, useUpdateFlag } from 'featureFlags' import { BaseVariant, FeatureFlag, featureFlagSettings, useUpdateFlag } from 'featureFlags'
import { useBaseEnabledFlag } from 'featureFlags/flags/baseEnabled'
import { useForceUniswapXOnFlag } from 'featureFlags/flags/forceUniswapXOn' import { useForceUniswapXOnFlag } from 'featureFlags/flags/forceUniswapXOn'
import { useMultichainUXFlag } from 'featureFlags/flags/multichainUx' import { useMultichainUXFlag } from 'featureFlags/flags/multichainUx'
import { useRoutingAPIForPriceFlag } from 'featureFlags/flags/priceRoutingApi' import { useRoutingAPIForPriceFlag } from 'featureFlags/flags/priceRoutingApi'
@ -237,12 +236,6 @@ export default function FeatureFlagModal() {
featureFlag={FeatureFlag.routingAPIPrice} featureFlag={FeatureFlag.routingAPIPrice}
label="Use the routing-api v2 for price fetches" label="Use the routing-api v2 for price fetches"
/> />
<FeatureFlagOption
variant={BaseVariant}
value={useBaseEnabledFlag()}
featureFlag={FeatureFlag.baseEnabled}
label="Enable Base"
/>
<FeatureFlagOption <FeatureFlagOption
variant={BaseVariant} variant={BaseVariant}
value={useMultichainUXFlag()} value={useMultichainUXFlag()}

@ -14,7 +14,6 @@ import {
TESTNET_CHAIN_IDS, TESTNET_CHAIN_IDS,
UniWalletSupportedChains, UniWalletSupportedChains,
} from 'constants/chains' } from 'constants/chains'
import { useBaseEnabled, useBaseEnabledChains } from 'featureFlags/flags/baseEnabled'
import { useOnClickOutside } from 'hooks/useOnClickOutside' import { useOnClickOutside } from 'hooks/useOnClickOutside'
import useSelectChain from 'hooks/useSelectChain' import useSelectChain from 'hooks/useSelectChain'
import useSyncChainQuery from 'hooks/useSyncChainQuery' import useSyncChainQuery from 'hooks/useSyncChainQuery'
@ -60,18 +59,11 @@ export const ChainSelector = ({ leftAlign }: ChainSelectorProps) => {
const theme = useTheme() const theme = useTheme()
const baseEnabled = useBaseEnabled()
const showTestnets = useAtomValue(showTestnetsAtom) const showTestnets = useAtomValue(showTestnetsAtom)
const walletSupportsChain = useWalletSupportedChains() const walletSupportsChain = useWalletSupportedChains()
const [supportedChains, unsupportedChains] = useMemo(() => { const [supportedChains, unsupportedChains] = useMemo(() => {
const { supported, unsupported } = NETWORK_SELECTOR_CHAINS.filter((chain: number) => { const { supported, unsupported } = NETWORK_SELECTOR_CHAINS.filter((chain: number) => {
if (chain === ChainId.BASE) {
return baseEnabled
}
if (chain === ChainId.BASE_GOERLI) {
return showTestnets && baseEnabled
}
return showTestnets || !TESTNET_CHAIN_IDS.includes(chain) return showTestnets || !TESTNET_CHAIN_IDS.includes(chain)
}) })
.sort((a, b) => getChainPriority(a) - getChainPriority(b)) .sort((a, b) => getChainPriority(a) - getChainPriority(b))
@ -87,14 +79,13 @@ export const ChainSelector = ({ leftAlign }: ChainSelectorProps) => {
{ supported: [], unsupported: [] } as Record<string, ChainId[]> { supported: [], unsupported: [] } as Record<string, ChainId[]>
) )
return [supported, unsupported] return [supported, unsupported]
}, [baseEnabled, showTestnets, walletSupportsChain]) }, [showTestnets, walletSupportsChain])
const ref = useRef<HTMLDivElement>(null) const ref = useRef<HTMLDivElement>(null)
const modalRef = useRef<HTMLDivElement>(null) const modalRef = useRef<HTMLDivElement>(null)
useOnClickOutside(ref, () => setIsOpen(false), [modalRef]) useOnClickOutside(ref, () => setIsOpen(false), [modalRef])
const baseEnabledChains = useBaseEnabledChains() const info = getChainInfo(chainId)
const info = getChainInfo(chainId, baseEnabledChains)
const selectChain = useSelectChain() const selectChain = useSelectChain()
useSyncChainQuery() useSyncChainQuery()

@ -3,7 +3,6 @@ import { ChainId } from '@uniswap/sdk-core'
import { useWeb3React } from '@web3-react/core' import { useWeb3React } from '@web3-react/core'
import Loader from 'components/Icons/LoadingSpinner' import Loader from 'components/Icons/LoadingSpinner'
import { getChainInfo } from 'constants/chainInfo' import { getChainInfo } from 'constants/chainInfo'
import { useBaseEnabledChains } from 'featureFlags/flags/baseEnabled'
import { CheckMarkIcon } from 'nft/components/icons' import { CheckMarkIcon } from 'nft/components/icons'
import styled, { useTheme } from 'styled-components' import styled, { useTheme } from 'styled-components'
@ -71,8 +70,7 @@ interface ChainSelectorRowProps {
export default function ChainSelectorRow({ disabled, targetChain, onSelectChain, isPending }: ChainSelectorRowProps) { export default function ChainSelectorRow({ disabled, targetChain, onSelectChain, isPending }: ChainSelectorRowProps) {
const { chainId } = useWeb3React() const { chainId } = useWeb3React()
const active = chainId === targetChain const active = chainId === targetChain
const baseEnabledChains = useBaseEnabledChains() const chainInfo = getChainInfo(targetChain)
const chainInfo = getChainInfo(targetChain, baseEnabledChains)
const label = chainInfo?.label const label = chainInfo?.label
const logoUrl = chainInfo?.logoUrl const logoUrl = chainInfo?.logoUrl

@ -2,7 +2,6 @@ import { Trans } from '@lingui/macro'
import { ChainId } from '@uniswap/sdk-core' import { ChainId } from '@uniswap/sdk-core'
import { useWeb3React } from '@web3-react/core' import { useWeb3React } from '@web3-react/core'
import { getChainInfo } from 'constants/chainInfo' import { getChainInfo } from 'constants/chainInfo'
import { useBaseEnabledChains } from 'featureFlags/flags/baseEnabled'
import { ArrowUpRight } from 'react-feather' import { ArrowUpRight } from 'react-feather'
import styled from 'styled-components' import styled from 'styled-components'
import { ExternalLink, HideSmall } from 'theme' import { ExternalLink, HideSmall } from 'theme'
@ -171,13 +170,12 @@ function shouldShowAlert(chainId: number | undefined): chainId is NetworkAlertCh
export function NetworkAlert() { export function NetworkAlert() {
const { chainId } = useWeb3React() const { chainId } = useWeb3React()
const [darkMode] = useDarkModeManager() const [darkMode] = useDarkModeManager()
const baseEnabledChains = useBaseEnabledChains()
if (!shouldShowAlert(chainId)) { if (!shouldShowAlert(chainId)) {
return null return null
} }
const chainInfo = getChainInfo(chainId, baseEnabledChains) const chainInfo = getChainInfo(chainId)
if (!chainInfo) return null if (!chainInfo) return null

@ -1,19 +0,0 @@
import { ChainId } from '@uniswap/sdk-core'
import { BaseVariant, FeatureFlag, useBaseFlag } from '../index'
export function useBaseEnabledFlag(): BaseVariant {
return useBaseFlag(FeatureFlag.baseEnabled)
}
export function useBaseEnabled(): boolean {
return useBaseEnabledFlag() === BaseVariant.Enabled
}
export function useBaseEnabledChains(): Record<number, boolean> {
const baseEnabled = useBaseEnabled()
return {
[ChainId.BASE]: baseEnabled,
[ChainId.BASE_GOERLI]: baseEnabled,
}
}

@ -15,7 +15,6 @@ export enum FeatureFlag {
routingAPIPrice = 'routing_api_price', routingAPIPrice = 'routing_api_price',
forceUniswapXOn = 'uniswapx_force_on', // forces routing-api's feature flag for uniswapx to turn on as well forceUniswapXOn = 'uniswapx_force_on', // forces routing-api's feature flag for uniswapx to turn on as well
uniswapXEthOutputEnabled = 'uniswapx_eth_output_enabled', uniswapXEthOutputEnabled = 'uniswapx_eth_output_enabled',
baseEnabled = 'base_enabled',
multichainUX = 'multichain_ux', multichainUX = 'multichain_ux',
} }

@ -10,7 +10,6 @@ import PositionList from 'components/PositionList'
import { RowBetween, RowFixed } from 'components/Row' 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 { useBaseEnabledChains } from 'featureFlags/flags/baseEnabled'
import { useFilterPossiblyMaliciousPositions } from 'hooks/useFilterPossiblyMaliciousPositions' import { useFilterPossiblyMaliciousPositions } from 'hooks/useFilterPossiblyMaliciousPositions'
import { useNetworkSupportsV2 } from 'hooks/useNetworkSupportsV2' import { useNetworkSupportsV2 } from 'hooks/useNetworkSupportsV2'
import { useV3Positions } from 'hooks/useV3Positions' import { useV3Positions } from 'hooks/useV3Positions'
@ -213,9 +212,8 @@ export default function Pool() {
) )
const filteredPositions = useFilterPossiblyMaliciousPositions(userSelectedPositionSet) const filteredPositions = useFilterPossiblyMaliciousPositions(userSelectedPositionSet)
const baseEnabledChains = useBaseEnabledChains()
if (!isSupportedChain(chainId, baseEnabledChains)) { if (!isSupportedChain(chainId)) {
return <WrongNetworkCard /> return <WrongNetworkCard />
} }

@ -32,7 +32,6 @@ import TokenSafetyModal from 'components/TokenSafety/TokenSafetyModal'
import { getChainInfo } from 'constants/chainInfo' import { getChainInfo } from 'constants/chainInfo'
import { asSupportedChain, isSupportedChain } from 'constants/chains' import { asSupportedChain, isSupportedChain } from 'constants/chains'
import { getSwapCurrencyId, TOKEN_SHORTHANDS } from 'constants/tokens' import { getSwapCurrencyId, TOKEN_SHORTHANDS } from 'constants/tokens'
import { useBaseEnabledChains } from 'featureFlags/flags/baseEnabled'
import { useCurrency, useDefaultActiveTokens } from 'hooks/Tokens' import { useCurrency, useDefaultActiveTokens } from 'hooks/Tokens'
import { useIsSwapUnsupported } from 'hooks/useIsSwapUnsupported' import { useIsSwapUnsupported } from 'hooks/useIsSwapUnsupported'
import { useMaxAmountIn } from 'hooks/useMaxAmountIn' import { useMaxAmountIn } from 'hooks/useMaxAmountIn'
@ -136,11 +135,10 @@ function largerPercentValue(a?: Percent, b?: Percent) {
export default function SwapPage({ className }: { className?: string }) { export default function SwapPage({ className }: { className?: string }) {
const { chainId: connectedChainId } = useWeb3React() const { chainId: connectedChainId } = useWeb3React()
const loadedUrlParams = useDefaultsFromURLSearch() const loadedUrlParams = useDefaultsFromURLSearch()
const baseEnabledChains = useBaseEnabledChains()
const location = useLocation() const location = useLocation()
const supportedChainId = asSupportedChain(connectedChainId, baseEnabledChains) const supportedChainId = asSupportedChain(connectedChainId)
return ( return (
<Trace page={InterfacePageName.SWAP_PAGE} shouldLogImpression> <Trace page={InterfacePageName.SWAP_PAGE} shouldLogImpression>

@ -1,6 +1,5 @@
import { ChainId } from '@uniswap/sdk-core' import { ChainId } from '@uniswap/sdk-core'
import { useWeb3React } from '@web3-react/core' import { useWeb3React } from '@web3-react/core'
import { useBaseEnabled } from 'featureFlags/flags/baseEnabled'
import { useIsNftPage } from 'hooks/useIsNftPage' import { useIsNftPage } from 'hooks/useIsNftPage'
import { useEffect } from 'react' import { useEffect } from 'react'
import { useDarkModeManager } from 'theme/components/ThemeToggle' import { useDarkModeManager } from 'theme/components/ThemeToggle'
@ -40,7 +39,6 @@ export default function RadialGradientByChainUpdater(): null {
const { chainId } = useWeb3React() const { chainId } = useWeb3React()
const [darkMode] = useDarkModeManager() const [darkMode] = useDarkModeManager()
const isNftPage = useIsNftPage() const isNftPage = useIsNftPage()
const baseEnabled = useBaseEnabled()
// manage background color // manage background color
useEffect(() => { useEffect(() => {
@ -117,10 +115,6 @@ export default function RadialGradientByChainUpdater(): null {
} }
case ChainId.BASE: case ChainId.BASE:
case ChainId.BASE_GOERLI: { case ChainId.BASE_GOERLI: {
if (!baseEnabled) {
setDefaultBackground(backgroundRadialGradientElement, darkMode)
return
}
setBackground(backgroundResetStyles) setBackground(backgroundResetStyles)
const baseLightGradient = const baseLightGradient =
'radial-gradient(100% 100% at 50% 0%, rgba(0, 82, 255, 0.20) 0%, rgba(0, 82, 255, 0.08) 40.0%, rgba(252, 255, 82, 0.00) 100%), rgb(255, 255, 255)' 'radial-gradient(100% 100% at 50% 0%, rgba(0, 82, 255, 0.20) 0%, rgba(0, 82, 255, 0.08) 40.0%, rgba(252, 255, 82, 0.00) 100%), rgb(255, 255, 255)'
@ -133,6 +127,6 @@ export default function RadialGradientByChainUpdater(): null {
setDefaultBackground(backgroundRadialGradientElement, darkMode) setDefaultBackground(backgroundRadialGradientElement, darkMode)
} }
} }
}, [darkMode, chainId, isNftPage, baseEnabled]) }, [darkMode, chainId, isNftPage])
return null return null
} }