feat: remove dead statsig flag (#7229)

* feat: remove dead statsig flag

* fix: e2e test
This commit is contained in:
eddie 2023-08-30 13:08:18 -07:00 committed by GitHub
parent 366f4d98ef
commit 406d7fe964
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 3 additions and 34 deletions

@ -1,9 +1,8 @@
import { FeatureFlag } from '../../../src/featureFlags'
import { getTestSelector } from '../../utils' import { getTestSelector } from '../../utils'
describe('Swap settings', () => { describe('Swap settings', () => {
it('Opens and closes the settings menu', () => { it('Opens and closes the settings menu', () => {
cy.visit('/swap', { featureFlags: [FeatureFlag.uniswapXEnabled] }) cy.visit('/swap')
cy.contains('Settings').should('not.exist') cy.contains('Settings').should('not.exist')
cy.get(getTestSelector('open-settings-dialog-button')).click() cy.get(getTestSelector('open-settings-dialog-button')).click()
cy.get(getTestSelector('mobile-settings-menu')).should('not.exist') cy.get(getTestSelector('mobile-settings-menu')).should('not.exist')
@ -17,7 +16,7 @@ describe('Swap settings', () => {
it('should open the mobile settings menu', () => { it('should open the mobile settings menu', () => {
cy.viewport('iphone-6') cy.viewport('iphone-6')
cy.visit('/swap', { featureFlags: [FeatureFlag.uniswapXEnabled] }) cy.visit('/swap')
cy.get(getTestSelector('open-settings-dialog-button')).click() cy.get(getTestSelector('open-settings-dialog-button')).click()
cy.get(getTestSelector('mobile-settings-menu')).should('exist') cy.get(getTestSelector('mobile-settings-menu')).should('exist')
cy.contains('Max slippage').should('exist') cy.contains('Max slippage').should('exist')

@ -8,7 +8,6 @@ import { useInfoPoolPageFlag } from 'featureFlags/flags/infoPoolPage'
import { useInfoTDPFlag } from 'featureFlags/flags/infoTDP' import { useInfoTDPFlag } from 'featureFlags/flags/infoTDP'
import { useMultichainUXFlag } from 'featureFlags/flags/multichainUx' import { useMultichainUXFlag } from 'featureFlags/flags/multichainUx'
import { TraceJsonRpcVariant, useTraceJsonRpcFlag } from 'featureFlags/flags/traceJsonRpc' import { TraceJsonRpcVariant, useTraceJsonRpcFlag } from 'featureFlags/flags/traceJsonRpc'
import { UniswapXVariant, useUniswapXFlag } from 'featureFlags/flags/uniswapx'
import { useUniswapXEthOutputFlag } from 'featureFlags/flags/uniswapXEthOutput' import { useUniswapXEthOutputFlag } from 'featureFlags/flags/uniswapXEthOutput'
import { useUniswapXExactOutputFlag } from 'featureFlags/flags/uniswapXExactOutput' import { useUniswapXExactOutputFlag } from 'featureFlags/flags/uniswapXExactOutput'
import { useUniswapXSyntheticQuoteFlag } from 'featureFlags/flags/uniswapXUseSyntheticQuote' import { useUniswapXSyntheticQuoteFlag } from 'featureFlags/flags/uniswapXUseSyntheticQuote'
@ -229,12 +228,6 @@ export default function FeatureFlagModal() {
<X size={24} /> <X size={24} />
</CloseButton> </CloseButton>
</Header> </Header>
<FeatureFlagOption
variant={UniswapXVariant}
value={useUniswapXFlag()}
featureFlag={FeatureFlag.uniswapXEnabled}
label="Enable UniswapX on interface"
/>
<FeatureFlagOption <FeatureFlagOption
variant={BaseVariant} variant={BaseVariant}
value={useUniswapXSyntheticQuoteFlag()} value={useUniswapXSyntheticQuoteFlag()}

@ -5,10 +5,6 @@ import { fireEvent, render, screen } from 'test-utils/render'
import RouterPreferenceSettings from '.' import RouterPreferenceSettings from '.'
jest.mock('featureFlags/flags/uniswapx', () => ({
useUniswapXEnabled: () => true,
}))
describe('RouterPreferenceSettings', () => { describe('RouterPreferenceSettings', () => {
// Restore to default router preference before each unit test // Restore to default router preference before each unit test
beforeEach(() => { beforeEach(() => {

@ -5,7 +5,6 @@ import UniswapXBrandMark from 'components/Logo/UniswapXBrandMark'
import { RowBetween, RowFixed } from 'components/Row' import { RowBetween, RowFixed } from 'components/Row'
import Toggle from 'components/Toggle' import Toggle from 'components/Toggle'
import { isUniswapXSupportedChain } from 'constants/chains' import { isUniswapXSupportedChain } from 'constants/chains'
import { useUniswapXEnabled } from 'featureFlags/flags/uniswapx'
import { useAppDispatch } from 'state/hooks' import { useAppDispatch } from 'state/hooks'
import { RouterPreference } from 'state/routing/types' import { RouterPreference } from 'state/routing/types'
import { useRouterPreference } from 'state/user/hooks' import { useRouterPreference } from 'state/user/hooks'
@ -25,7 +24,7 @@ const InlineLink = styled(ThemedText.BodySmall)`
export default function RouterPreferenceSettings() { export default function RouterPreferenceSettings() {
const { chainId } = useWeb3React() const { chainId } = useWeb3React()
const [routerPreference, setRouterPreference] = useRouterPreference() const [routerPreference, setRouterPreference] = useRouterPreference()
const uniswapXEnabled = useUniswapXEnabled() && chainId && isUniswapXSupportedChain(chainId) const uniswapXEnabled = chainId && isUniswapXSupportedChain(chainId)
const dispatch = useAppDispatch() const dispatch = useAppDispatch()
return ( return (

@ -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 }

@ -8,7 +8,6 @@ import { useGate } from 'statsig-react'
export enum FeatureFlag { export enum FeatureFlag {
traceJsonRpc = 'traceJsonRpc', traceJsonRpc = 'traceJsonRpc',
debounceSwapQuote = 'debounce_swap_quote', debounceSwapQuote = 'debounce_swap_quote',
uniswapXEnabled = 'uniswapx_enabled', // enables sending dutch_limit config to routing-api
uniswapXSyntheticQuote = 'uniswapx_synthetic_quote', uniswapXSyntheticQuote = 'uniswapx_synthetic_quote',
uniswapXEthOutputEnabled = 'uniswapx_eth_output_enabled', uniswapXEthOutputEnabled = 'uniswapx_eth_output_enabled',
uniswapXExactOutputEnabled = 'uniswapx_exact_output_enabled', uniswapXExactOutputEnabled = 'uniswapx_exact_output_enabled',

@ -1,7 +1,6 @@
import { SkipToken, skipToken } from '@reduxjs/toolkit/query/react' import { SkipToken, skipToken } from '@reduxjs/toolkit/query/react'
import { Currency, CurrencyAmount, TradeType } from '@uniswap/sdk-core' import { Currency, CurrencyAmount, TradeType } from '@uniswap/sdk-core'
import { useFotAdjustmentsEnabled } from 'featureFlags/flags/fotAdjustments' import { useFotAdjustmentsEnabled } from 'featureFlags/flags/fotAdjustments'
import { useUniswapXEnabled } from 'featureFlags/flags/uniswapx'
import { useUniswapXEthOutputEnabled } from 'featureFlags/flags/uniswapXEthOutput' import { useUniswapXEthOutputEnabled } from 'featureFlags/flags/uniswapXEthOutput'
import { useUniswapXExactOutputEnabled } from 'featureFlags/flags/uniswapXExactOutput' import { useUniswapXExactOutputEnabled } from 'featureFlags/flags/uniswapXExactOutput'
import { useUniswapXSyntheticQuoteEnabled } from 'featureFlags/flags/uniswapXUseSyntheticQuote' import { useUniswapXSyntheticQuoteEnabled } from 'featureFlags/flags/uniswapXUseSyntheticQuote'
@ -30,7 +29,6 @@ export function useRoutingAPIArguments({
tradeType: TradeType tradeType: TradeType
routerPreference: RouterPreference | typeof INTERNAL_ROUTER_PREFERENCE_PRICE routerPreference: RouterPreference | typeof INTERNAL_ROUTER_PREFERENCE_PRICE
}): GetQuoteArgs | SkipToken { }): GetQuoteArgs | SkipToken {
const uniswapXEnabled = useUniswapXEnabled()
const uniswapXForceSyntheticQuotes = useUniswapXSyntheticQuoteEnabled() const uniswapXForceSyntheticQuotes = useUniswapXSyntheticQuoteEnabled()
const userDisabledUniswapX = useUserDisabledUniswapX() const userDisabledUniswapX = useUserDisabledUniswapX()
const uniswapXEthOutputEnabled = useUniswapXEthOutputEnabled() const uniswapXEthOutputEnabled = useUniswapXEthOutputEnabled()
@ -55,7 +53,6 @@ export function useRoutingAPIArguments({
routerPreference, routerPreference,
tradeType, tradeType,
needsWrapIfUniswapX: tokenIn.isNative, needsWrapIfUniswapX: tokenIn.isNative,
uniswapXEnabled,
uniswapXForceSyntheticQuotes, uniswapXForceSyntheticQuotes,
userDisabledUniswapX, userDisabledUniswapX,
uniswapXEthOutputEnabled, uniswapXEthOutputEnabled,
@ -69,7 +66,6 @@ export function useRoutingAPIArguments({
tokenIn, tokenIn,
tokenOut, tokenOut,
tradeType, tradeType,
uniswapXEnabled,
uniswapXExactOutputEnabled, uniswapXExactOutputEnabled,
uniswapXForceSyntheticQuotes, uniswapXForceSyntheticQuotes,
userDisabledUniswapX, userDisabledUniswapX,

@ -74,7 +74,6 @@ function getRoutingAPIConfig(args: GetQuoteArgs): RoutingConfig {
// UniswapX doesn't support native out, exact-out, or non-mainnet trades (yet), // 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. // so even if the user has selected UniswapX as their router preference, force them to receive a Classic quote.
if ( if (
!args.uniswapXEnabled ||
(args.userDisabledUniswapX && routerPreference !== RouterPreference.X) || (args.userDisabledUniswapX && routerPreference !== RouterPreference.X) ||
(tokenOutIsNative && !uniswapXEthOutputEnabled) || (tokenOutIsNative && !uniswapXEthOutputEnabled) ||
(!uniswapXExactOutputEnabled && tradeType === TradeType.EXACT_OUTPUT) || (!uniswapXExactOutputEnabled && tradeType === TradeType.EXACT_OUTPUT) ||

@ -42,7 +42,6 @@ export interface GetQuoteArgs {
routerPreference: RouterPreference | typeof INTERNAL_ROUTER_PREFERENCE_PRICE routerPreference: RouterPreference | typeof INTERNAL_ROUTER_PREFERENCE_PRICE
tradeType: TradeType tradeType: TradeType
needsWrapIfUniswapX: boolean needsWrapIfUniswapX: boolean
uniswapXEnabled: boolean
uniswapXForceSyntheticQuotes: boolean uniswapXForceSyntheticQuotes: boolean
uniswapXEthOutputEnabled: boolean uniswapXEthOutputEnabled: boolean
uniswapXExactOutputEnabled: boolean uniswapXExactOutputEnabled: boolean