From 406d7fe964054eb2a1bbae36cb70bc54abac25d7 Mon Sep 17 00:00:00 2001
From: eddie <66155195+just-toby@users.noreply.github.com>
Date: Wed, 30 Aug 2023 13:08:18 -0700
Subject: [PATCH] feat: remove dead statsig flag (#7229)
* feat: remove dead statsig flag
* fix: e2e test
---
cypress/e2e/swap/settings.test.ts | 5 ++---
src/components/FeatureFlagModal/FeatureFlagModal.tsx | 7 -------
.../Settings/RouterPreferenceSettings/index.test.tsx | 4 ----
.../Settings/RouterPreferenceSettings/index.tsx | 3 +--
src/featureFlags/flags/uniswapx.ts | 11 -----------
src/featureFlags/index.tsx | 1 -
src/lib/hooks/routing/useRoutingAPIArguments.ts | 4 ----
src/state/routing/slice.ts | 1 -
src/state/routing/types.ts | 1 -
9 files changed, 3 insertions(+), 34 deletions(-)
delete mode 100644 src/featureFlags/flags/uniswapx.ts
diff --git a/cypress/e2e/swap/settings.test.ts b/cypress/e2e/swap/settings.test.ts
index 7360121e77..f470b64ff3 100644
--- a/cypress/e2e/swap/settings.test.ts
+++ b/cypress/e2e/swap/settings.test.ts
@@ -1,9 +1,8 @@
-import { FeatureFlag } from '../../../src/featureFlags'
import { getTestSelector } from '../../utils'
describe('Swap settings', () => {
it('Opens and closes the settings menu', () => {
- cy.visit('/swap', { featureFlags: [FeatureFlag.uniswapXEnabled] })
+ cy.visit('/swap')
cy.contains('Settings').should('not.exist')
cy.get(getTestSelector('open-settings-dialog-button')).click()
cy.get(getTestSelector('mobile-settings-menu')).should('not.exist')
@@ -17,7 +16,7 @@ describe('Swap settings', () => {
it('should open the mobile settings menu', () => {
cy.viewport('iphone-6')
- cy.visit('/swap', { featureFlags: [FeatureFlag.uniswapXEnabled] })
+ cy.visit('/swap')
cy.get(getTestSelector('open-settings-dialog-button')).click()
cy.get(getTestSelector('mobile-settings-menu')).should('exist')
cy.contains('Max slippage').should('exist')
diff --git a/src/components/FeatureFlagModal/FeatureFlagModal.tsx b/src/components/FeatureFlagModal/FeatureFlagModal.tsx
index 52e6b76540..0c770c617c 100644
--- a/src/components/FeatureFlagModal/FeatureFlagModal.tsx
+++ b/src/components/FeatureFlagModal/FeatureFlagModal.tsx
@@ -8,7 +8,6 @@ import { useInfoPoolPageFlag } from 'featureFlags/flags/infoPoolPage'
import { useInfoTDPFlag } from 'featureFlags/flags/infoTDP'
import { useMultichainUXFlag } from 'featureFlags/flags/multichainUx'
import { TraceJsonRpcVariant, useTraceJsonRpcFlag } from 'featureFlags/flags/traceJsonRpc'
-import { UniswapXVariant, useUniswapXFlag } from 'featureFlags/flags/uniswapx'
import { useUniswapXEthOutputFlag } from 'featureFlags/flags/uniswapXEthOutput'
import { useUniswapXExactOutputFlag } from 'featureFlags/flags/uniswapXExactOutput'
import { useUniswapXSyntheticQuoteFlag } from 'featureFlags/flags/uniswapXUseSyntheticQuote'
@@ -229,12 +228,6 @@ export default function FeatureFlagModal() {
-
({
- useUniswapXEnabled: () => true,
-}))
-
describe('RouterPreferenceSettings', () => {
// Restore to default router preference before each unit test
beforeEach(() => {
diff --git a/src/components/Settings/RouterPreferenceSettings/index.tsx b/src/components/Settings/RouterPreferenceSettings/index.tsx
index 3781f1386a..87fff8e750 100644
--- a/src/components/Settings/RouterPreferenceSettings/index.tsx
+++ b/src/components/Settings/RouterPreferenceSettings/index.tsx
@@ -5,7 +5,6 @@ import UniswapXBrandMark from 'components/Logo/UniswapXBrandMark'
import { RowBetween, RowFixed } from 'components/Row'
import Toggle from 'components/Toggle'
import { isUniswapXSupportedChain } from 'constants/chains'
-import { useUniswapXEnabled } from 'featureFlags/flags/uniswapx'
import { useAppDispatch } from 'state/hooks'
import { RouterPreference } from 'state/routing/types'
import { useRouterPreference } from 'state/user/hooks'
@@ -25,7 +24,7 @@ const InlineLink = styled(ThemedText.BodySmall)`
export default function RouterPreferenceSettings() {
const { chainId } = useWeb3React()
const [routerPreference, setRouterPreference] = useRouterPreference()
- const uniswapXEnabled = useUniswapXEnabled() && chainId && isUniswapXSupportedChain(chainId)
+ const uniswapXEnabled = chainId && isUniswapXSupportedChain(chainId)
const dispatch = useAppDispatch()
return (
diff --git a/src/featureFlags/flags/uniswapx.ts b/src/featureFlags/flags/uniswapx.ts
deleted file mode 100644
index 2bb3a27907..0000000000
--- a/src/featureFlags/flags/uniswapx.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-import { BaseVariant, FeatureFlag, useBaseFlag } from '../index'
-
-export function useUniswapXFlag(): BaseVariant {
- return useBaseFlag(FeatureFlag.uniswapXEnabled)
-}
-
-export function useUniswapXEnabled(): boolean {
- return useUniswapXFlag() === BaseVariant.Enabled
-}
-
-export { BaseVariant as UniswapXVariant }
diff --git a/src/featureFlags/index.tsx b/src/featureFlags/index.tsx
index 864976eb2c..b5220bfdac 100644
--- a/src/featureFlags/index.tsx
+++ b/src/featureFlags/index.tsx
@@ -8,7 +8,6 @@ import { useGate } from 'statsig-react'
export enum FeatureFlag {
traceJsonRpc = 'traceJsonRpc',
debounceSwapQuote = 'debounce_swap_quote',
- uniswapXEnabled = 'uniswapx_enabled', // enables sending dutch_limit config to routing-api
uniswapXSyntheticQuote = 'uniswapx_synthetic_quote',
uniswapXEthOutputEnabled = 'uniswapx_eth_output_enabled',
uniswapXExactOutputEnabled = 'uniswapx_exact_output_enabled',
diff --git a/src/lib/hooks/routing/useRoutingAPIArguments.ts b/src/lib/hooks/routing/useRoutingAPIArguments.ts
index 1b90ecb6d9..2a773139e0 100644
--- a/src/lib/hooks/routing/useRoutingAPIArguments.ts
+++ b/src/lib/hooks/routing/useRoutingAPIArguments.ts
@@ -1,7 +1,6 @@
import { SkipToken, skipToken } from '@reduxjs/toolkit/query/react'
import { Currency, CurrencyAmount, TradeType } from '@uniswap/sdk-core'
import { useFotAdjustmentsEnabled } from 'featureFlags/flags/fotAdjustments'
-import { useUniswapXEnabled } from 'featureFlags/flags/uniswapx'
import { useUniswapXEthOutputEnabled } from 'featureFlags/flags/uniswapXEthOutput'
import { useUniswapXExactOutputEnabled } from 'featureFlags/flags/uniswapXExactOutput'
import { useUniswapXSyntheticQuoteEnabled } from 'featureFlags/flags/uniswapXUseSyntheticQuote'
@@ -30,7 +29,6 @@ export function useRoutingAPIArguments({
tradeType: TradeType
routerPreference: RouterPreference | typeof INTERNAL_ROUTER_PREFERENCE_PRICE
}): GetQuoteArgs | SkipToken {
- const uniswapXEnabled = useUniswapXEnabled()
const uniswapXForceSyntheticQuotes = useUniswapXSyntheticQuoteEnabled()
const userDisabledUniswapX = useUserDisabledUniswapX()
const uniswapXEthOutputEnabled = useUniswapXEthOutputEnabled()
@@ -55,7 +53,6 @@ export function useRoutingAPIArguments({
routerPreference,
tradeType,
needsWrapIfUniswapX: tokenIn.isNative,
- uniswapXEnabled,
uniswapXForceSyntheticQuotes,
userDisabledUniswapX,
uniswapXEthOutputEnabled,
@@ -69,7 +66,6 @@ export function useRoutingAPIArguments({
tokenIn,
tokenOut,
tradeType,
- uniswapXEnabled,
uniswapXExactOutputEnabled,
uniswapXForceSyntheticQuotes,
userDisabledUniswapX,
diff --git a/src/state/routing/slice.ts b/src/state/routing/slice.ts
index c39f6cb12a..36b2926a65 100644
--- a/src/state/routing/slice.ts
+++ b/src/state/routing/slice.ts
@@ -74,7 +74,6 @@ function getRoutingAPIConfig(args: GetQuoteArgs): RoutingConfig {
// UniswapX doesn't support native out, exact-out, or non-mainnet trades (yet),
// so even if the user has selected UniswapX as their router preference, force them to receive a Classic quote.
if (
- !args.uniswapXEnabled ||
(args.userDisabledUniswapX && routerPreference !== RouterPreference.X) ||
(tokenOutIsNative && !uniswapXEthOutputEnabled) ||
(!uniswapXExactOutputEnabled && tradeType === TradeType.EXACT_OUTPUT) ||
diff --git a/src/state/routing/types.ts b/src/state/routing/types.ts
index e47f9c892c..071c649a99 100644
--- a/src/state/routing/types.ts
+++ b/src/state/routing/types.ts
@@ -42,7 +42,6 @@ export interface GetQuoteArgs {
routerPreference: RouterPreference | typeof INTERNAL_ROUTER_PREFERENCE_PRICE
tradeType: TradeType
needsWrapIfUniswapX: boolean
- uniswapXEnabled: boolean
uniswapXForceSyntheticQuotes: boolean
uniswapXEthOutputEnabled: boolean
uniswapXExactOutputEnabled: boolean