Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…Uniswap#5958)

* build: upgrade [email protected]

* fix: use namehash directly

* fix: TS7030

* build: upgrade widgets version and smart-order-router (Uniswap#6053)

* upgrade widgets

* build: dedup router packages

---------

Co-authored-by: Zach Pomerantz <[email protected]>

* chore: remove deprecated chains (Uniswap#6054)

* start

* more

* more

* more

* use SupportedChainId from sdk

* add support for arbitrum goerli

* add arbitrum_goerli to jsonrpc list

* local sdk-core

* Revert "add arbitrum_goerli to jsonrpc list"

This reverts commit 51b2976.

* add local chain ids

* Revert "add support for arbitrum goerli"

This reverts commit 46cdd15.

* rm arb goerli in supported chain ids

* autofix

* fix import

* fix import

* fix import

* move back down for sdk-core

* use the supportedchainid

* add-types

* comment

---------

Co-authored-by: Jordan Frankfurt <[email protected]>

* combine

---------

Co-authored-by: Vignesh Mohankumar <[email protected]>
Co-authored-by: Vignesh Mohankumar <[email protected]>
Co-authored-by: Jordan Frankfurt <[email protected]>
  • Loading branch information
4 people authored Mar 3, 2023
1 parent ef388e1 commit 513c907
Show file tree
Hide file tree
Showing 33 changed files with 413 additions and 655 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
"@uniswap/redux-multicall": "^1.1.8",
"@uniswap/router-sdk": "^1.3.0",
"@uniswap/sdk-core": "^3.0.1",
"@uniswap/smart-order-router": "^2.10.0",
"@uniswap/smart-order-router": "^3.6.0",
"@uniswap/token-lists": "^1.0.0-beta.30",
"@uniswap/universal-router-sdk": "^1.3.6",
"@uniswap/v2-core": "1.0.0",
Expand All @@ -152,7 +152,7 @@
"@uniswap/v3-core": "1.0.0",
"@uniswap/v3-periphery": "^1.1.1",
"@uniswap/v3-sdk": "^3.9.0",
"@uniswap/widgets": "^2.40.0",
"@uniswap/widgets": "^2.43.2",
"@vanilla-extract/css": "^1.7.2",
"@vanilla-extract/css-utils": "^0.1.2",
"@vanilla-extract/dynamic": "^2.0.2",
Expand Down Expand Up @@ -181,7 +181,7 @@
"clsx": "^1.1.1",
"copy-to-clipboard": "^3.2.0",
"d3": "^7.6.1",
"ethers": "^5.1.4",
"ethers": "^5.7.2",
"firebase": "^9.1.3",
"focus-visible": "^5.2.0",
"get-graphql-schema": "^2.1.2",
Expand Down
6 changes: 0 additions & 6 deletions src/components/NetworkAlert/NetworkAlert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ const SHOULD_SHOW_ALERT = {
[SupportedChainId.OPTIMISM]: true,
[SupportedChainId.OPTIMISM_GOERLI]: true,
[SupportedChainId.ARBITRUM_ONE]: true,
[SupportedChainId.ARBITRUM_RINKEBY]: true,
[SupportedChainId.POLYGON]: true,
[SupportedChainId.POLYGON_MUMBAI]: true,
[SupportedChainId.CELO]: true,
Expand All @@ -59,8 +58,6 @@ const BG_COLORS_BY_DARK_MODE_AND_CHAIN_ID: {
'radial-gradient(948% 292% at 42% 0%, rgba(255, 58, 212, 0.04) 0%, rgba(255, 255, 255, 0.04) 100%),radial-gradient(98% 96% at 2% 0%, rgba(255, 39, 39, 0.04) 0%, rgba(235, 0, 255, 0.01 96%)',
[SupportedChainId.ARBITRUM_ONE]:
'radial-gradient(285% 8200% at 30% 50%, rgba(40, 160, 240, 0.01) 0%, rgba(219, 255, 0, 0) 100%),radial-gradient(75% 75% at 0% 0%, rgba(150, 190, 220, 0.05) 0%, rgba(33, 114, 229, 0.05) 100%), hsla(0, 0%, 100%, 0.05)',
[SupportedChainId.ARBITRUM_RINKEBY]:
'radial-gradient(285% 8200% at 30% 50%, rgba(40, 160, 240, 0.05) 0%, rgba(219, 255, 0, 0) 100%),radial-gradient(75% 75% at 0% 0%, rgba(150, 190, 220, 0.05) 0%, rgba(33, 114, 229, 0.1) 100%), hsla(0, 0%, 100%, 0.05)',
},
light: {
[SupportedChainId.POLYGON]:
Expand All @@ -77,8 +74,6 @@ const BG_COLORS_BY_DARK_MODE_AND_CHAIN_ID: {
'radial-gradient(92% 105% at 50% 7%, rgba(255, 58, 212, 0.04) 0%, rgba(255, 255, 255, 0.03) 100%),radial-gradient(100% 97% at 0% 12%, rgba(235, 0, 255, 0.1) 0%, rgba(243, 19, 19, 0.1) 100%), hsla(0, 0%, 100%, 0.1)',
[SupportedChainId.ARBITRUM_ONE]:
'radial-gradient(285% 8200% at 30% 50%, rgba(40, 160, 240, 0.1) 0%, rgba(219, 255, 0, 0) 100%),radial-gradient(circle at top left, hsla(206, 50%, 75%, 0.01), hsla(215, 79%, 51%, 0.12)), hsla(0, 0%, 100%, 0.1)',
[SupportedChainId.ARBITRUM_RINKEBY]:
'radial-gradient(285% 8200% at 30% 50%, rgba(40, 160, 240, 0.1) 0%, rgba(219, 255, 0, 0) 100%),radial-gradient(circle at top left, hsla(206, 50%, 75%, 0.01), hsla(215, 79%, 51%, 0.12)), hsla(0, 0%, 100%, 0.1)',
},
}

Expand Down Expand Up @@ -137,7 +132,6 @@ const TEXT_COLORS: { [chainId in NetworkAlertChains]: string } = {
[SupportedChainId.OPTIMISM]: '#ff3856',
[SupportedChainId.OPTIMISM_GOERLI]: '#ff3856',
[SupportedChainId.ARBITRUM_ONE]: '#0490ed',
[SupportedChainId.ARBITRUM_RINKEBY]: '#0490ed',
}

function shouldShowAlert(chainId: number | undefined): chainId is NetworkAlertChains {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Tokens/TokenDetails/About.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Trans } from '@lingui/macro'
import { SupportedChainId } from '@uniswap/sdk-core'
import { getChainInfo } from 'constants/chainInfo'
import { SupportedChainId } from 'constants/chains'
import { darken } from 'polished'
import { useState } from 'react'
import styled from 'styled-components/macro'
Expand Down
3 changes: 2 additions & 1 deletion src/components/Tokens/TokenDetails/BalanceSummary.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { Trans } from '@lingui/macro'
import { formatCurrencyAmount, NumberType } from '@uniswap/conedison/format'
import { Currency, SupportedChainId } from '@uniswap/sdk-core'
import { Currency } from '@uniswap/sdk-core'
import { useWeb3React } from '@web3-react/core'
import CurrencyLogo from 'components/Logo/CurrencyLogo'
import { getChainInfo } from 'constants/chainInfo'
import { SupportedChainId } from 'constants/chains'
import { isSupportedChain } from 'constants/chains'
import { useStablecoinValue } from 'hooks/useStablecoinPrice'
import useCurrencyBalance from 'lib/hooks/useCurrencyBalance'
Expand Down
11 changes: 1 addition & 10 deletions src/constants/addresses.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { FACTORY_ADDRESS as V2_FACTORY_ADDRESS } from '@uniswap/v2-sdk'
import { FACTORY_ADDRESS as V3_FACTORY_ADDRESS } from '@uniswap/v3-sdk'
import { SupportedChainId } from 'constants/chains'

import { constructSameAddressMap } from '../utils/constructSameAddressMap'
import { SupportedChainId } from './chains'

type AddressMap = { [chainId: number]: string }

Expand All @@ -28,7 +28,6 @@ export const V3_CORE_FACTORY_ADDRESSES: AddressMap = {
SupportedChainId.OPTIMISM,
SupportedChainId.OPTIMISM_GOERLI,
SupportedChainId.ARBITRUM_ONE,
SupportedChainId.ARBITRUM_RINKEBY,
SupportedChainId.POLYGON_MUMBAI,
SupportedChainId.POLYGON,
]),
Expand All @@ -39,7 +38,6 @@ export const V3_CORE_FACTORY_ADDRESSES: AddressMap = {
export const V3_MIGRATOR_ADDRESSES: AddressMap = {
...constructSameAddressMap('0xA5644E29708357803b5A882D272c41cC0dF92B34', [
SupportedChainId.ARBITRUM_ONE,
SupportedChainId.ARBITRUM_RINKEBY,
SupportedChainId.POLYGON_MUMBAI,
SupportedChainId.POLYGON,
]),
Expand All @@ -55,7 +53,6 @@ export const MULTICALL_ADDRESS: AddressMap = {
SupportedChainId.POLYGON,
]),
[SupportedChainId.ARBITRUM_ONE]: '0xadF885960B47eA2CD9B55E6DAc6B42b7Cb2806dB',
[SupportedChainId.ARBITRUM_RINKEBY]: '0xa501c031958F579dB7676fF1CE78AD305794d579',
[SupportedChainId.CELO]: CELO_MULTICALL_ADDRESS,
[SupportedChainId.CELO_ALFAJORES]: CELO_MULTICALL_ADDRESS,
}
Expand All @@ -65,7 +62,6 @@ export const SWAP_ROUTER_ADDRESSES: AddressMap = {
SupportedChainId.OPTIMISM,
SupportedChainId.OPTIMISM_GOERLI,
SupportedChainId.ARBITRUM_ONE,
SupportedChainId.ARBITRUM_RINKEBY,
SupportedChainId.POLYGON,
SupportedChainId.POLYGON_MUMBAI,
]),
Expand Down Expand Up @@ -107,7 +103,6 @@ export const QUOTER_ADDRESSES: AddressMap = {
SupportedChainId.OPTIMISM,
SupportedChainId.OPTIMISM_GOERLI,
SupportedChainId.ARBITRUM_ONE,
SupportedChainId.ARBITRUM_RINKEBY,
SupportedChainId.POLYGON_MUMBAI,
SupportedChainId.POLYGON,
]),
Expand All @@ -120,7 +115,6 @@ export const NONFUNGIBLE_POSITION_MANAGER_ADDRESSES: AddressMap = {
SupportedChainId.OPTIMISM,
SupportedChainId.OPTIMISM_GOERLI,
SupportedChainId.ARBITRUM_ONE,
SupportedChainId.ARBITRUM_RINKEBY,
SupportedChainId.POLYGON_MUMBAI,
SupportedChainId.POLYGON,
]),
Expand All @@ -130,9 +124,7 @@ export const NONFUNGIBLE_POSITION_MANAGER_ADDRESSES: AddressMap = {

export const ENS_REGISTRAR_ADDRESSES: AddressMap = {
[SupportedChainId.MAINNET]: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e',
[SupportedChainId.ROPSTEN]: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e',
[SupportedChainId.GOERLI]: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e',
[SupportedChainId.RINKEBY]: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e',
}

export const SOCKS_CONTROLLER_ADDRESSES: AddressMap = {
Expand All @@ -141,7 +133,6 @@ export const SOCKS_CONTROLLER_ADDRESSES: AddressMap = {

export const TICK_LENS_ADDRESSES: AddressMap = {
[SupportedChainId.ARBITRUM_ONE]: '0xbfd8137f7d1516D3ea5cA83523914859ec47F573',
[SupportedChainId.ARBITRUM_RINKEBY]: '0xbfd8137f7d1516D3ea5cA83523914859ec47F573',
[SupportedChainId.CELO]: CELO_TICK_LENS_ADDRESSES,
[SupportedChainId.CELO_ALFAJORES]: CELO_TICK_LENS_ADDRESSES,
}
47 changes: 2 additions & 45 deletions src/constants/chainInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import { default as arbitrumCircleLogoUrl, default as arbitrumLogoUrl } from 'as
import celoLogo from 'assets/svg/celo_logo.svg'
import optimismLogoUrl from 'assets/svg/optimistic_ethereum.svg'
import polygonMaticLogo from 'assets/svg/polygon-matic-logo.svg'
import { SupportedChainId } from 'constants/chains'
import ms from 'ms.macro'
import { darkTheme } from 'theme/colors'

import { SupportedChainId, SupportedL1ChainId, SupportedL2ChainId } from './chains'
import { SupportedL1ChainId, SupportedL2ChainId } from './chains'
import { ARBITRUM_LIST, CELO_LIST, OPTIMISM_LIST } from './lists'

export const AVERAGE_L1_BLOCK_TIME = ms`12s`
Expand Down Expand Up @@ -64,36 +65,6 @@ const CHAIN_INFO: ChainInfoMap = {
nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },
color: darkTheme.chain_1,
},
[SupportedChainId.RINKEBY]: {
networkType: NetworkType.L1,
docs: 'https://docs.uniswap.org/',
explorer: 'https://rinkeby.etherscan.io/',
infoLink: 'https://info.uniswap.org/#/',
label: 'Rinkeby',
logoUrl: ethereumLogoUrl,
nativeCurrency: { name: 'Rinkeby Ether', symbol: 'rETH', decimals: 18 },
color: darkTheme.chain_4,
},
[SupportedChainId.ROPSTEN]: {
networkType: NetworkType.L1,
docs: 'https://docs.uniswap.org/',
explorer: 'https://ropsten.etherscan.io/',
infoLink: 'https://info.uniswap.org/#/',
label: 'Ropsten',
logoUrl: ethereumLogoUrl,
nativeCurrency: { name: 'Ropsten Ether', symbol: 'ropETH', decimals: 18 },
color: darkTheme.chain_3,
},
[SupportedChainId.KOVAN]: {
networkType: NetworkType.L1,
docs: 'https://docs.uniswap.org/',
explorer: 'https://kovan.etherscan.io/',
infoLink: 'https://info.uniswap.org/#/',
label: 'Kovan',
logoUrl: ethereumLogoUrl,
nativeCurrency: { name: 'Kovan Ether', symbol: 'kovETH', decimals: 18 },
color: darkTheme.chain_420,
},
[SupportedChainId.GOERLI]: {
networkType: NetworkType.L1,
docs: 'https://docs.uniswap.org/',
Expand Down Expand Up @@ -153,20 +124,6 @@ const CHAIN_INFO: ChainInfoMap = {
color: darkTheme.chain_42,
backgroundColor: darkTheme.chain_42161_background,
},
[SupportedChainId.ARBITRUM_RINKEBY]: {
networkType: NetworkType.L2,
blockWaitMsBeforeWarning: ms`10m`,
bridge: 'https://bridge.arbitrum.io/',
docs: 'https://offchainlabs.com/',
explorer: 'https://rinkeby-explorer.arbitrum.io/',
infoLink: 'https://info.uniswap.org/#/arbitrum/',
label: 'Arbitrum Rinkeby',
logoUrl: arbitrumLogoUrl,
defaultListUrl: ARBITRUM_LIST,
helpCenterUrl: 'https://help.uniswap.org/en/collections/3137787-uniswap-on-arbitrum',
nativeCurrency: { name: 'Rinkeby Arbitrum Ether', symbol: 'rinkArbETH', decimals: 18 },
color: darkTheme.chain_421611,
},
[SupportedChainId.POLYGON]: {
networkType: NetworkType.L1,
blockWaitMsBeforeWarning: ms`10m`,
Expand Down
17 changes: 1 addition & 16 deletions src/constants/chains.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
/**
* List of all the networks supported by the Uniswap Interface
* TODO(INFRA-90): Eventually this may be derived from sdk-core.
*/
export enum SupportedChainId {
MAINNET = 1,
ROPSTEN = 3,
RINKEBY = 4,
GOERLI = 5,
KOVAN = 42,

ARBITRUM_ONE = 42161,
ARBITRUM_RINKEBY = 421611,

OPTIMISM = 10,
OPTIMISM_GOERLI = 420,
Expand All @@ -23,16 +20,12 @@ export enum SupportedChainId {

export const CHAIN_IDS_TO_NAMES = {
[SupportedChainId.MAINNET]: 'mainnet',
[SupportedChainId.ROPSTEN]: 'ropsten',
[SupportedChainId.RINKEBY]: 'rinkeby',
[SupportedChainId.GOERLI]: 'goerli',
[SupportedChainId.KOVAN]: 'kovan',
[SupportedChainId.POLYGON]: 'polygon',
[SupportedChainId.POLYGON_MUMBAI]: 'polygon_mumbai',
[SupportedChainId.CELO]: 'celo',
[SupportedChainId.CELO_ALFAJORES]: 'celo_alfajores',
[SupportedChainId.ARBITRUM_ONE]: 'arbitrum',
[SupportedChainId.ARBITRUM_RINKEBY]: 'arbitrum_rinkeby',
[SupportedChainId.OPTIMISM]: 'optimism',
[SupportedChainId.OPTIMISM_GOERLI]: 'optimism_goerli',
}
Expand Down Expand Up @@ -66,12 +59,8 @@ export const UNSUPPORTED_V2POOL_CHAIN_IDS = [
]

export const TESTNET_CHAIN_IDS = [
SupportedChainId.ROPSTEN,
SupportedChainId.RINKEBY,
SupportedChainId.GOERLI,
SupportedChainId.KOVAN,
SupportedChainId.POLYGON_MUMBAI,
SupportedChainId.ARBITRUM_RINKEBY,
SupportedChainId.OPTIMISM_GOERLI,
] as const

Expand All @@ -82,10 +71,7 @@ export type SupportedTestnetChainId = typeof TESTNET_CHAIN_IDS[number]
*/
export const L1_CHAIN_IDS = [
SupportedChainId.MAINNET,
SupportedChainId.ROPSTEN,
SupportedChainId.RINKEBY,
SupportedChainId.GOERLI,
SupportedChainId.KOVAN,
SupportedChainId.POLYGON,
SupportedChainId.POLYGON_MUMBAI,
SupportedChainId.CELO,
Expand All @@ -100,7 +86,6 @@ export type SupportedL1ChainId = typeof L1_CHAIN_IDS[number]
*/
export const L2_CHAIN_IDS = [
SupportedChainId.ARBITRUM_ONE,
SupportedChainId.ARBITRUM_RINKEBY,
SupportedChainId.OPTIMISM,
SupportedChainId.OPTIMISM_GOERLI,
] as const
Expand Down
3 changes: 2 additions & 1 deletion src/constants/governance.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { SupportedChainId } from 'constants/chains'

import {
GOVERNANCE_ALPHA_V0_ADDRESSES,
GOVERNANCE_ALPHA_V1_ADDRESSES,
GOVERNANCE_BRAVO_ADDRESSES,
TIMELOCK_ADDRESS,
UNI_ADDRESS,
} from './addresses'
import { SupportedChainId } from './chains'

export const COMMON_CONTRACT_NAMES: Record<number, { [address: string]: string }> = {
[SupportedChainId.MAINNET]: {
Expand Down
33 changes: 1 addition & 32 deletions src/constants/networks.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SupportedChainId } from './chains'
import { SupportedChainId } from 'constants/chains'

const INFURA_KEY = process.env.REACT_APP_INFURA_KEY
if (typeof INFURA_KEY === 'undefined') {
Expand All @@ -24,26 +24,12 @@ export const FALLBACK_URLS: { [key in SupportedChainId]: string[] } = {
'https://rpc.ankr.com/eth',
'https://eth-mainnet.public.blastapi.io',
],
[SupportedChainId.ROPSTEN]: [
// "Fallback" URLs
'https://rpc.ankr.com/eth_ropsten',
],
[SupportedChainId.RINKEBY]: [
// "Fallback" URLs
'https://rinkeby-light.eth.linkpool.io/',
],
[SupportedChainId.GOERLI]: [
// "Safe" URLs
'https://rpc.goerli.mudit.blog/',
// "Fallback" URLs
'https://rpc.ankr.com/eth_goerli',
],
[SupportedChainId.KOVAN]: [
// "Safe" URLs
'https://kovan.poa.network',
// "Fallback" URLs
'https://eth-kovan.public.blastapi.io',
],
[SupportedChainId.POLYGON]: [
// "Safe" URLs
'https://polygon-rpc.com/',
Expand All @@ -65,10 +51,6 @@ export const FALLBACK_URLS: { [key in SupportedChainId]: string[] } = {
// "Fallback" URLs
'https://arbitrum.public-rpc.com',
],
[SupportedChainId.ARBITRUM_RINKEBY]: [
// "Safe" URLs
'https://rinkeby.arbitrum.io/rpc',
],
[SupportedChainId.OPTIMISM]: [
// "Safe" URLs
'https://mainnet.optimism.io/',
Expand Down Expand Up @@ -98,16 +80,7 @@ export const RPC_URLS: { [key in SupportedChainId]: string[] } = {
`https://mainnet.infura.io/v3/${INFURA_KEY}`,
...FALLBACK_URLS[SupportedChainId.MAINNET],
],
[SupportedChainId.RINKEBY]: [
`https://rinkeby.infura.io/v3/${INFURA_KEY}`,
...FALLBACK_URLS[SupportedChainId.RINKEBY],
],
[SupportedChainId.ROPSTEN]: [
`https://ropsten.infura.io/v3/${INFURA_KEY}`,
...FALLBACK_URLS[SupportedChainId.ROPSTEN],
],
[SupportedChainId.GOERLI]: [`https://goerli.infura.io/v3/${INFURA_KEY}`, ...FALLBACK_URLS[SupportedChainId.GOERLI]],
[SupportedChainId.KOVAN]: [`https://kovan.infura.io/v3/${INFURA_KEY}`, ...FALLBACK_URLS[SupportedChainId.KOVAN]],
[SupportedChainId.OPTIMISM]: [
`https://optimism-mainnet.infura.io/v3/${INFURA_KEY}`,
...FALLBACK_URLS[SupportedChainId.OPTIMISM],
Expand All @@ -120,10 +93,6 @@ export const RPC_URLS: { [key in SupportedChainId]: string[] } = {
`https://arbitrum-mainnet.infura.io/v3/${INFURA_KEY}`,
...FALLBACK_URLS[SupportedChainId.ARBITRUM_ONE],
],
[SupportedChainId.ARBITRUM_RINKEBY]: [
`https://arbitrum-rinkeby.infura.io/v3/${INFURA_KEY}`,
...FALLBACK_URLS[SupportedChainId.ARBITRUM_RINKEBY],
],
[SupportedChainId.POLYGON]: [
`https://polygon-mainnet.infura.io/v3/${INFURA_KEY}`,
...FALLBACK_URLS[SupportedChainId.POLYGON],
Expand Down
Loading

0 comments on commit 513c907

Please sign in to comment.