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
9fbdc3ca
Unverified
Commit
9fbdc3ca
authored
Aug 10, 2023
by
eddie
Committed by
GitHub
Aug 10, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: base flag cleanup (#7134)
feat: remove base feature flag
parent
e04be071
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
10 additions
and
64 deletions
+10
-64
hooks.ts
src/components/AccountDrawer/MiniPortfolio/Pools/hooks.ts
+2
-4
PortfolioLogo.tsx
src/components/AccountDrawer/MiniPortfolio/PortfolioLogo.tsx
+1
-3
FeatureFlagModal.tsx
src/components/FeatureFlagModal/FeatureFlagModal.tsx
+0
-7
ChainSelector.tsx
src/components/NavBar/ChainSelector.tsx
+2
-11
ChainSelectorRow.tsx
src/components/NavBar/ChainSelectorRow.tsx
+1
-3
NetworkAlert.tsx
src/components/NetworkAlert/NetworkAlert.tsx
+1
-3
baseEnabled.ts
src/featureFlags/flags/baseEnabled.ts
+0
-19
index.tsx
src/featureFlags/index.tsx
+0
-1
index.tsx
src/pages/Pool/index.tsx
+1
-3
index.tsx
src/pages/Swap/index.tsx
+1
-3
RadialGradientByChainUpdater.ts
src/theme/components/RadialGradientByChainUpdater.ts
+1
-7
No files found.
src/components/AccountDrawer/MiniPortfolio/Pools/hooks.ts
View file @
9fbdc3ca
...
...
@@ -11,7 +11,6 @@ import { useWeb3React } from '@web3-react/core'
import
{
isSupportedChain
}
from
'
constants/chains
'
import
{
RPC_PROVIDERS
}
from
'
constants/providers
'
import
{
BaseContract
}
from
'
ethers/lib/ethers
'
import
{
useBaseEnabledChains
}
from
'
featureFlags/flags/baseEnabled
'
import
{
ContractInput
,
useUniswapPricesQuery
}
from
'
graphql/data/__generated__/types-and-hooks
'
import
{
toContractInput
}
from
'
graphql/data/util
'
import
useStablecoinPrice
from
'
hooks/useStablecoinPrice
'
...
...
@@ -31,14 +30,13 @@ function useContractMultichain<T extends BaseContract>(
chainIds
?:
ChainId
[]
):
ContractMap
<
T
>
{
const
{
chainId
:
walletChainId
,
provider
:
walletProvider
}
=
useWeb3React
()
const
baseEnabledChains
=
useBaseEnabledChains
()
return
useMemo
(()
=>
{
const
relevantChains
=
chainIds
??
Object
.
keys
(
addressMap
)
.
map
((
chainId
)
=>
parseInt
(
chainId
))
.
filter
((
chainId
)
=>
isSupportedChain
(
chainId
,
baseEnabledChains
))
.
filter
((
chainId
)
=>
isSupportedChain
(
chainId
))
return
relevantChains
.
reduce
((
acc
:
ContractMap
<
T
>
,
chainId
)
=>
{
const
provider
=
...
...
@@ -52,7 +50,7 @@ function useContractMultichain<T extends BaseContract>(
}
return
acc
},
{})
},
[
ABI
,
addressMap
,
baseEnabledChains
,
chainIds
,
walletChainId
,
walletProvider
])
},
[
ABI
,
addressMap
,
chainIds
,
walletChainId
,
walletProvider
])
}
export
function
useV3ManagerContracts
(
chainIds
:
ChainId
[]):
ContractMap
<
NonfungiblePositionManager
>
{
...
...
src/components/AccountDrawer/MiniPortfolio/PortfolioLogo.tsx
View file @
9fbdc3ca
...
...
@@ -5,7 +5,6 @@ import { MissingImageLogo } from 'components/Logo/AssetLogo'
import
CurrencyLogo
from
'
components/Logo/CurrencyLogo
'
import
{
Unicon
}
from
'
components/Unicon
'
import
{
getChainInfo
}
from
'
constants/chainInfo
'
import
{
useBaseEnabledChains
}
from
'
featureFlags/flags/baseEnabled
'
import
useTokenLogoSource
from
'
hooks/useAssetLogoSource
'
import
useENSAvatar
from
'
hooks/useENSAvatar
'
import
React
from
'
react
'
...
...
@@ -99,8 +98,7 @@ export function PortfolioLogo({
size
=
'
40px
'
,
style
,
}:
MultiLogoProps
)
{
const
baseEnabledChains
=
useBaseEnabledChains
()
const
chainInfo
=
getChainInfo
(
chainId
,
baseEnabledChains
)
const
chainInfo
=
getChainInfo
(
chainId
)
const
squareLogoUrl
=
chainInfo
?.
squareLogoUrl
const
logoUrl
=
chainInfo
?.
logoUrl
const
chainLogo
=
squareLogoUrl
??
logoUrl
...
...
src/components/FeatureFlagModal/FeatureFlagModal.tsx
View file @
9fbdc3ca
import
{
BaseVariant
,
FeatureFlag
,
featureFlagSettings
,
useUpdateFlag
}
from
'
featureFlags
'
import
{
useBaseEnabledFlag
}
from
'
featureFlags/flags/baseEnabled
'
import
{
useForceUniswapXOnFlag
}
from
'
featureFlags/flags/forceUniswapXOn
'
import
{
useMultichainUXFlag
}
from
'
featureFlags/flags/multichainUx
'
import
{
useRoutingAPIForPriceFlag
}
from
'
featureFlags/flags/priceRoutingApi
'
...
...
@@ -237,12 +236,6 @@ export default function FeatureFlagModal() {
featureFlag=
{
FeatureFlag
.
routingAPIPrice
}
label=
"Use the routing-api v2 for price fetches"
/>
<
FeatureFlagOption
variant=
{
BaseVariant
}
value=
{
useBaseEnabledFlag
()
}
featureFlag=
{
FeatureFlag
.
baseEnabled
}
label=
"Enable Base"
/>
<
FeatureFlagOption
variant=
{
BaseVariant
}
value=
{
useMultichainUXFlag
()
}
...
...
src/components/NavBar/ChainSelector.tsx
View file @
9fbdc3ca
...
...
@@ -14,7 +14,6 @@ import {
TESTNET_CHAIN_IDS
,
UniWalletSupportedChains
,
}
from
'
constants/chains
'
import
{
useBaseEnabled
,
useBaseEnabledChains
}
from
'
featureFlags/flags/baseEnabled
'
import
{
useOnClickOutside
}
from
'
hooks/useOnClickOutside
'
import
useSelectChain
from
'
hooks/useSelectChain
'
import
useSyncChainQuery
from
'
hooks/useSyncChainQuery
'
...
...
@@ -60,18 +59,11 @@ export const ChainSelector = ({ leftAlign }: ChainSelectorProps) => {
const
theme
=
useTheme
()
const
baseEnabled
=
useBaseEnabled
()
const
showTestnets
=
useAtomValue
(
showTestnetsAtom
)
const
walletSupportsChain
=
useWalletSupportedChains
()
const
[
supportedChains
,
unsupportedChains
]
=
useMemo
(()
=>
{
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
)
})
.
sort
((
a
,
b
)
=>
getChainPriority
(
a
)
-
getChainPriority
(
b
))
...
...
@@ -87,14 +79,13 @@ export const ChainSelector = ({ leftAlign }: ChainSelectorProps) => {
{
supported
:
[],
unsupported
:
[]
}
as
Record
<
string
,
ChainId
[]
>
)
return
[
supported
,
unsupported
]
},
[
baseEnabled
,
showTestnets
,
walletSupportsChain
])
},
[
showTestnets
,
walletSupportsChain
])
const
ref
=
useRef
<
HTMLDivElement
>
(
null
)
const
modalRef
=
useRef
<
HTMLDivElement
>
(
null
)
useOnClickOutside
(
ref
,
()
=>
setIsOpen
(
false
),
[
modalRef
])
const
baseEnabledChains
=
useBaseEnabledChains
()
const
info
=
getChainInfo
(
chainId
,
baseEnabledChains
)
const
info
=
getChainInfo
(
chainId
)
const
selectChain
=
useSelectChain
()
useSyncChainQuery
()
...
...
src/components/NavBar/ChainSelectorRow.tsx
View file @
9fbdc3ca
...
...
@@ -3,7 +3,6 @@ import { ChainId } from '@uniswap/sdk-core'
import
{
useWeb3React
}
from
'
@web3-react/core
'
import
Loader
from
'
components/Icons/LoadingSpinner
'
import
{
getChainInfo
}
from
'
constants/chainInfo
'
import
{
useBaseEnabledChains
}
from
'
featureFlags/flags/baseEnabled
'
import
{
CheckMarkIcon
}
from
'
nft/components/icons
'
import
styled
,
{
useTheme
}
from
'
styled-components
'
...
...
@@ -71,8 +70,7 @@ interface ChainSelectorRowProps {
export
default
function
ChainSelectorRow
({
disabled
,
targetChain
,
onSelectChain
,
isPending
}:
ChainSelectorRowProps
)
{
const
{
chainId
}
=
useWeb3React
()
const
active
=
chainId
===
targetChain
const
baseEnabledChains
=
useBaseEnabledChains
()
const
chainInfo
=
getChainInfo
(
targetChain
,
baseEnabledChains
)
const
chainInfo
=
getChainInfo
(
targetChain
)
const
label
=
chainInfo
?.
label
const
logoUrl
=
chainInfo
?.
logoUrl
...
...
src/components/NetworkAlert/NetworkAlert.tsx
View file @
9fbdc3ca
...
...
@@ -2,7 +2,6 @@ import { Trans } from '@lingui/macro'
import
{
ChainId
}
from
'
@uniswap/sdk-core
'
import
{
useWeb3React
}
from
'
@web3-react/core
'
import
{
getChainInfo
}
from
'
constants/chainInfo
'
import
{
useBaseEnabledChains
}
from
'
featureFlags/flags/baseEnabled
'
import
{
ArrowUpRight
}
from
'
react-feather
'
import
styled
from
'
styled-components
'
import
{
ExternalLink
,
HideSmall
}
from
'
theme
'
...
...
@@ -171,13 +170,12 @@ function shouldShowAlert(chainId: number | undefined): chainId is NetworkAlertCh
export
function
NetworkAlert
()
{
const
{
chainId
}
=
useWeb3React
()
const
[
darkMode
]
=
useDarkModeManager
()
const
baseEnabledChains
=
useBaseEnabledChains
()
if
(
!
shouldShowAlert
(
chainId
))
{
return
null
}
const
chainInfo
=
getChainInfo
(
chainId
,
baseEnabledChains
)
const
chainInfo
=
getChainInfo
(
chainId
)
if
(
!
chainInfo
)
return
null
...
...
src/featureFlags/flags/baseEnabled.ts
deleted
100644 → 0
View file @
e04be071
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
,
}
}
src/featureFlags/index.tsx
View file @
9fbdc3ca
...
...
@@ -15,7 +15,6 @@ export enum FeatureFlag {
routingAPIPrice
=
'
routing_api_price
'
,
forceUniswapXOn
=
'
uniswapx_force_on
'
,
// forces routing-api's feature flag for uniswapx to turn on as well
uniswapXEthOutputEnabled
=
'
uniswapx_eth_output_enabled
'
,
baseEnabled
=
'
base_enabled
'
,
multichainUX
=
'
multichain_ux
'
,
}
...
...
src/pages/Pool/index.tsx
View file @
9fbdc3ca
...
...
@@ -10,7 +10,6 @@ import PositionList from 'components/PositionList'
import
{
RowBetween
,
RowFixed
}
from
'
components/Row
'
import
{
SwitchLocaleLink
}
from
'
components/SwitchLocaleLink
'
import
{
isSupportedChain
}
from
'
constants/chains
'
import
{
useBaseEnabledChains
}
from
'
featureFlags/flags/baseEnabled
'
import
{
useFilterPossiblyMaliciousPositions
}
from
'
hooks/useFilterPossiblyMaliciousPositions
'
import
{
useNetworkSupportsV2
}
from
'
hooks/useNetworkSupportsV2
'
import
{
useV3Positions
}
from
'
hooks/useV3Positions
'
...
...
@@ -213,9 +212,8 @@ export default function Pool() {
)
const
filteredPositions
=
useFilterPossiblyMaliciousPositions
(
userSelectedPositionSet
)
const
baseEnabledChains
=
useBaseEnabledChains
()
if
(
!
isSupportedChain
(
chainId
,
baseEnabledChains
))
{
if
(
!
isSupportedChain
(
chainId
))
{
return
<
WrongNetworkCard
/>
}
...
...
src/pages/Swap/index.tsx
View file @
9fbdc3ca
...
...
@@ -32,7 +32,6 @@ import TokenSafetyModal from 'components/TokenSafety/TokenSafetyModal'
import
{
getChainInfo
}
from
'
constants/chainInfo
'
import
{
asSupportedChain
,
isSupportedChain
}
from
'
constants/chains
'
import
{
getSwapCurrencyId
,
TOKEN_SHORTHANDS
}
from
'
constants/tokens
'
import
{
useBaseEnabledChains
}
from
'
featureFlags/flags/baseEnabled
'
import
{
useCurrency
,
useDefaultActiveTokens
}
from
'
hooks/Tokens
'
import
{
useIsSwapUnsupported
}
from
'
hooks/useIsSwapUnsupported
'
import
{
useMaxAmountIn
}
from
'
hooks/useMaxAmountIn
'
...
...
@@ -136,11 +135,10 @@ function largerPercentValue(a?: Percent, b?: Percent) {
export
default
function
SwapPage
({
className
}:
{
className
?:
string
})
{
const
{
chainId
:
connectedChainId
}
=
useWeb3React
()
const
loadedUrlParams
=
useDefaultsFromURLSearch
()
const
baseEnabledChains
=
useBaseEnabledChains
()
const
location
=
useLocation
()
const
supportedChainId
=
asSupportedChain
(
connectedChainId
,
baseEnabledChains
)
const
supportedChainId
=
asSupportedChain
(
connectedChainId
)
return
(
<
Trace
page=
{
InterfacePageName
.
SWAP_PAGE
}
shouldLogImpression
>
...
...
src/theme/components/RadialGradientByChainUpdater.ts
View file @
9fbdc3ca
import
{
ChainId
}
from
'
@uniswap/sdk-core
'
import
{
useWeb3React
}
from
'
@web3-react/core
'
import
{
useBaseEnabled
}
from
'
featureFlags/flags/baseEnabled
'
import
{
useIsNftPage
}
from
'
hooks/useIsNftPage
'
import
{
useEffect
}
from
'
react
'
import
{
useDarkModeManager
}
from
'
theme/components/ThemeToggle
'
...
...
@@ -40,7 +39,6 @@ export default function RadialGradientByChainUpdater(): null {
const
{
chainId
}
=
useWeb3React
()
const
[
darkMode
]
=
useDarkModeManager
()
const
isNftPage
=
useIsNftPage
()
const
baseEnabled
=
useBaseEnabled
()
// manage background color
useEffect
(()
=>
{
...
...
@@ -117,10 +115,6 @@ export default function RadialGradientByChainUpdater(): null {
}
case
ChainId
.
BASE
:
case
ChainId
.
BASE_GOERLI
:
{
if
(
!
baseEnabled
)
{
setDefaultBackground
(
backgroundRadialGradientElement
,
darkMode
)
return
}
setBackground
(
backgroundResetStyles
)
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)
'
...
...
@@ -133,6 +127,6 @@ export default function RadialGradientByChainUpdater(): null {
setDefaultBackground
(
backgroundRadialGradientElement
,
darkMode
)
}
}
},
[
darkMode
,
chainId
,
isNftPage
,
baseEnabled
])
},
[
darkMode
,
chainId
,
isNftPage
])
return
null
}
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