feat: add arbitrum goerli (#5457)

* chore: add ARBITRUM_GOERLI

* chore: add arb goerli custom deployment

* fix: typo

* chore: add arbitrum goerli rpc

* fix: add rpc url for arb goerli

* chore: update providers.ts

* fix: arb goerli everywhere

* fix: declare ARBITRUM_GOERLI as testnet

* chore: add ARBITRUM_GOERLI to theme

* Merge remote-tracking branch 'upstream/main'

* chore: add todos

* fix: patch router

* fix: use bridged goerli usdc

* chore: remove patch

* feat: add usdc to arb goerli default

* chore: bump smart-order-router to 3.4.0

* fix: yarn-deduplicate

* chore: bump sdk-core to 3.1.1

* revert: smart-order-router 2.10.0

* Revert "chore: remove patch"

This reverts commit 84311c182809cc6df22de5f51fc6505a5f593e99.

* fix: remove debug log in patch file

* fix: use bridged official Goerli USDC in patch

* fix: revert unnecessary change to yarn.lock

* fix: yarn yarn-deduplicate

* docs: fix comments

* remove patch

* rm rink

* link

---------

Co-authored-by: Vignesh Mohankumar <me@vig.xyz>
This commit is contained in:
gzeon 2023-03-04 09:29:49 +08:00 committed by GitHub
parent 79ad611e79
commit 2ddf3fe6bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 94 additions and 5 deletions

@ -32,6 +32,7 @@ const SHOULD_SHOW_ALERT = {
[SupportedChainId.OPTIMISM]: true,
[SupportedChainId.OPTIMISM_GOERLI]: true,
[SupportedChainId.ARBITRUM_ONE]: true,
[SupportedChainId.ARBITRUM_GOERLI]: true,
[SupportedChainId.POLYGON]: true,
[SupportedChainId.POLYGON_MUMBAI]: true,
[SupportedChainId.CELO]: true,
@ -58,6 +59,8 @@ 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_GOERLI]:
'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]:
@ -74,6 +77,8 @@ 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_GOERLI]:
'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)',
},
}
@ -132,6 +137,7 @@ const TEXT_COLORS: { [chainId in NetworkAlertChains]: string } = {
[SupportedChainId.OPTIMISM]: '#ff3856',
[SupportedChainId.OPTIMISM_GOERLI]: '#ff3856',
[SupportedChainId.ARBITRUM_ONE]: '#0490ed',
[SupportedChainId.ARBITRUM_GOERLI]: '#0490ed',
}
function shouldShowAlert(chainId: number | undefined): chainId is NetworkAlertChains {

@ -22,6 +22,15 @@ const CELO_QUOTER_ADDRESSES = '0x82825d0554fA07f7FC52Ab63c961F330fdEFa8E8'
const CELO_NONFUNGIBLE_POSITION_MANAGER_ADDRESSES = '0x3d79EdAaBC0EaB6F08ED885C05Fc0B014290D95A'
const CELO_TICK_LENS_ADDRESSES = '0x5f115D9113F88e0a0Db1b5033D90D4a9690AcD3D'
// arbitrum goerli v3 addresses
const ARBITRUM_GOERLI_V3_CORE_FACTORY_ADDRESSES = '0x4893376342d5D7b3e31d4184c08b265e5aB2A3f6'
const ARBITRUM_GOERLI_ROUTER_ADDRESS = '0xab7664500b19a7a2362Ab26081e6DfB971B6F1B0'
const ARBITRUM_GOERLI_V3_MIGRATOR_ADDRESSES = '0xA815919D2584Ac3F76ea9CB62E6Fd40a43BCe0C3'
const ARBITRUM_GOERLI_MULTICALL_ADDRESS = '0x8260CB40247290317a4c062F3542622367F206Ee'
const ARBITRUM_GOERLI_QUOTER_ADDRESSES = '0x1dd92b83591781D0C6d98d07391eea4b9a6008FA'
const ARBITRUM_GOERLI_NONFUNGIBLE_POSITION_MANAGER_ADDRESSES = '0x622e4726a167799826d1E1D150b076A7725f5D81'
const ARBITRUM_GOERLI_TICK_LENS_ADDRESSES = '0xb52429333da969a0C79a60930a4Bf0020E5D1DE8'
/* V3 Contract Addresses */
export const V3_CORE_FACTORY_ADDRESSES: AddressMap = {
...constructSameAddressMap(V3_FACTORY_ADDRESS, [
@ -33,6 +42,7 @@ export const V3_CORE_FACTORY_ADDRESSES: AddressMap = {
]),
[SupportedChainId.CELO]: CELO_V3_CORE_FACTORY_ADDRESSES,
[SupportedChainId.CELO_ALFAJORES]: CELO_V3_CORE_FACTORY_ADDRESSES,
[SupportedChainId.ARBITRUM_GOERLI]: ARBITRUM_GOERLI_V3_CORE_FACTORY_ADDRESSES,
}
export const V3_MIGRATOR_ADDRESSES: AddressMap = {
@ -43,6 +53,7 @@ export const V3_MIGRATOR_ADDRESSES: AddressMap = {
]),
[SupportedChainId.CELO]: CELO_V3_MIGRATOR_ADDRESSES,
[SupportedChainId.CELO_ALFAJORES]: CELO_V3_MIGRATOR_ADDRESSES,
[SupportedChainId.ARBITRUM_GOERLI]: ARBITRUM_GOERLI_V3_MIGRATOR_ADDRESSES,
}
export const MULTICALL_ADDRESS: AddressMap = {
@ -55,6 +66,7 @@ export const MULTICALL_ADDRESS: AddressMap = {
[SupportedChainId.ARBITRUM_ONE]: '0xadF885960B47eA2CD9B55E6DAc6B42b7Cb2806dB',
[SupportedChainId.CELO]: CELO_MULTICALL_ADDRESS,
[SupportedChainId.CELO_ALFAJORES]: CELO_MULTICALL_ADDRESS,
[SupportedChainId.ARBITRUM_GOERLI]: ARBITRUM_GOERLI_MULTICALL_ADDRESS,
}
export const SWAP_ROUTER_ADDRESSES: AddressMap = {
@ -67,6 +79,7 @@ export const SWAP_ROUTER_ADDRESSES: AddressMap = {
]),
[SupportedChainId.CELO]: CELO_ROUTER_ADDRESS,
[SupportedChainId.CELO_ALFAJORES]: CELO_ROUTER_ADDRESS,
[SupportedChainId.ARBITRUM_GOERLI]: ARBITRUM_GOERLI_ROUTER_ADDRESS,
}
/**
@ -108,6 +121,7 @@ export const QUOTER_ADDRESSES: AddressMap = {
]),
[SupportedChainId.CELO]: CELO_QUOTER_ADDRESSES,
[SupportedChainId.CELO_ALFAJORES]: CELO_QUOTER_ADDRESSES,
[SupportedChainId.ARBITRUM_GOERLI]: ARBITRUM_GOERLI_QUOTER_ADDRESSES,
}
export const NONFUNGIBLE_POSITION_MANAGER_ADDRESSES: AddressMap = {
@ -120,6 +134,7 @@ export const NONFUNGIBLE_POSITION_MANAGER_ADDRESSES: AddressMap = {
]),
[SupportedChainId.CELO]: CELO_NONFUNGIBLE_POSITION_MANAGER_ADDRESSES,
[SupportedChainId.CELO_ALFAJORES]: CELO_NONFUNGIBLE_POSITION_MANAGER_ADDRESSES,
[SupportedChainId.ARBITRUM_GOERLI]: ARBITRUM_GOERLI_NONFUNGIBLE_POSITION_MANAGER_ADDRESSES,
}
export const ENS_REGISTRAR_ADDRESSES: AddressMap = {
@ -133,6 +148,7 @@ export const SOCKS_CONTROLLER_ADDRESSES: AddressMap = {
export const TICK_LENS_ADDRESSES: AddressMap = {
[SupportedChainId.ARBITRUM_ONE]: '0xbfd8137f7d1516D3ea5cA83523914859ec47F573',
[SupportedChainId.ARBITRUM_GOERLI]: ARBITRUM_GOERLI_TICK_LENS_ADDRESSES,
[SupportedChainId.CELO]: CELO_TICK_LENS_ADDRESSES,
[SupportedChainId.CELO_ALFAJORES]: CELO_TICK_LENS_ADDRESSES,
}

@ -124,6 +124,20 @@ const CHAIN_INFO: ChainInfoMap = {
color: darkTheme.chain_42,
backgroundColor: darkTheme.chain_42161_background,
},
[SupportedChainId.ARBITRUM_GOERLI]: {
networkType: NetworkType.L2,
blockWaitMsBeforeWarning: ms`10m`,
bridge: 'https://bridge.arbitrum.io/',
docs: 'https://offchainlabs.com/',
explorer: 'https://goerli.arbiscan.io/',
infoLink: 'https://info.uniswap.org/#/arbitrum/',
label: 'Arbitrum Goerli',
logoUrl: arbitrumLogoUrl,
defaultListUrl: ARBITRUM_LIST, // TODO: use arbitrum goerli token list
helpCenterUrl: 'https://help.uniswap.org/en/collections/3137787-uniswap-on-arbitrum',
nativeCurrency: { name: 'Goerli Arbitrum Ether', symbol: 'goerliArbETH', decimals: 18 },
color: darkTheme.chain_421613,
},
[SupportedChainId.POLYGON]: {
networkType: NetworkType.L1,
blockWaitMsBeforeWarning: ms`10m`,

@ -7,6 +7,7 @@ export enum SupportedChainId {
GOERLI = 5,
ARBITRUM_ONE = 42161,
ARBITRUM_GOERLI = 421613,
OPTIMISM = 10,
OPTIMISM_GOERLI = 420,
@ -26,6 +27,7 @@ export const CHAIN_IDS_TO_NAMES = {
[SupportedChainId.CELO]: 'celo',
[SupportedChainId.CELO_ALFAJORES]: 'celo_alfajores',
[SupportedChainId.ARBITRUM_ONE]: 'arbitrum',
[SupportedChainId.ARBITRUM_GOERLI]: 'arbitrum_goerli',
[SupportedChainId.OPTIMISM]: 'optimism',
[SupportedChainId.OPTIMISM_GOERLI]: 'optimism_goerli',
}
@ -56,11 +58,13 @@ export const UNSUPPORTED_V2POOL_CHAIN_IDS = [
SupportedChainId.POLYGON,
SupportedChainId.OPTIMISM,
SupportedChainId.ARBITRUM_ONE,
SupportedChainId.ARBITRUM_GOERLI,
]
export const TESTNET_CHAIN_IDS = [
SupportedChainId.GOERLI,
SupportedChainId.POLYGON_MUMBAI,
SupportedChainId.ARBITRUM_GOERLI,
SupportedChainId.OPTIMISM_GOERLI,
] as const
@ -86,6 +90,7 @@ export type SupportedL1ChainId = typeof L1_CHAIN_IDS[number]
*/
export const L2_CHAIN_IDS = [
SupportedChainId.ARBITRUM_ONE,
SupportedChainId.ARBITRUM_GOERLI,
SupportedChainId.OPTIMISM,
SupportedChainId.OPTIMISM_GOERLI,
] as const

@ -51,6 +51,10 @@ export const FALLBACK_URLS: { [key in SupportedChainId]: string[] } = {
// "Fallback" URLs
'https://arbitrum.public-rpc.com',
],
[SupportedChainId.ARBITRUM_GOERLI]: [
// "Safe" URLs
'https://goerli-rollup.arbitrum.io/rpc',
],
[SupportedChainId.OPTIMISM]: [
// "Safe" URLs
'https://mainnet.optimism.io/',
@ -93,6 +97,10 @@ export const RPC_URLS: { [key in SupportedChainId]: string[] } = {
`https://arbitrum-mainnet.infura.io/v3/${INFURA_KEY}`,
...FALLBACK_URLS[SupportedChainId.ARBITRUM_ONE],
],
[SupportedChainId.ARBITRUM_GOERLI]: [
`https://arbitrum-goerli.infura.io/v3/${INFURA_KEY}`,
...FALLBACK_URLS[SupportedChainId.ARBITRUM_GOERLI],
],
[SupportedChainId.POLYGON]: [
`https://polygon-mainnet.infura.io/v3/${INFURA_KEY}`,
...FALLBACK_URLS[SupportedChainId.POLYGON],

@ -63,6 +63,7 @@ export const RPC_PROVIDERS: { [key in SupportedChainId]: StaticJsonRpcProvider }
[SupportedChainId.OPTIMISM]: new AppJsonRpcProvider(SupportedChainId.OPTIMISM),
[SupportedChainId.OPTIMISM_GOERLI]: new AppJsonRpcProvider(SupportedChainId.OPTIMISM_GOERLI),
[SupportedChainId.ARBITRUM_ONE]: new AppJsonRpcProvider(SupportedChainId.ARBITRUM_ONE),
[SupportedChainId.ARBITRUM_GOERLI]: new AppJsonRpcProvider(SupportedChainId.ARBITRUM_GOERLI),
[SupportedChainId.POLYGON]: new AppJsonRpcProvider(SupportedChainId.POLYGON),
[SupportedChainId.POLYGON_MUMBAI]: new AppJsonRpcProvider(SupportedChainId.POLYGON_MUMBAI),
[SupportedChainId.CELO]: new AppJsonRpcProvider(SupportedChainId.CELO),

@ -26,6 +26,7 @@ import {
SWISE,
TRIBE,
USDC_ARBITRUM,
USDC_ARBITRUM_GOERLI,
USDC_MAINNET,
USDC_OPTIMISM,
USDC_POLYGON,
@ -134,6 +135,11 @@ export const COMMON_BASES: ChainCurrencyList = {
WBTC_ARBITRUM_ONE,
WRAPPED_NATIVE_CURRENCY[SupportedChainId.ARBITRUM_ONE] as Token,
],
[SupportedChainId.ARBITRUM_GOERLI]: [
nativeOnChain(SupportedChainId.ARBITRUM_GOERLI),
WRAPPED_NATIVE_CURRENCY[SupportedChainId.ARBITRUM_GOERLI] as Token,
USDC_ARBITRUM_GOERLI,
],
[SupportedChainId.OPTIMISM]: [
nativeOnChain(SupportedChainId.OPTIMISM),
DAI_OPTIMISM,

@ -46,6 +46,13 @@ export const USDC_ARBITRUM = new Token(
'USDC',
'USD//C'
)
export const USDC_ARBITRUM_GOERLI = new Token(
SupportedChainId.ARBITRUM_GOERLI,
'0x8FB1E3fC51F3b789dED7557E680551d93Ea9d892',
6,
'USDC',
'USD//C'
)
export const USDC_POLYGON = new Token(
SupportedChainId.POLYGON,
'0x2791bca1f2de4661ed88a30c99a7a9449aa84174',
@ -315,6 +322,13 @@ export const WRAPPED_NATIVE_CURRENCY: { [chainId: number]: Token | undefined } =
'WETH',
'Wrapped Ether'
),
[SupportedChainId.ARBITRUM_GOERLI]: new Token(
SupportedChainId.ARBITRUM_GOERLI,
'0xe39Ab88f8A4777030A534146A9Ca3B52bd5D43A3',
18,
'WETH',
'Wrapped Ether'
),
[SupportedChainId.POLYGON]: new Token(
SupportedChainId.POLYGON,
'0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270',
@ -414,6 +428,7 @@ export const TOKEN_SHORTHANDS: { [shorthand: string]: { [chainId in SupportedCha
USDC: {
[SupportedChainId.MAINNET]: USDC_MAINNET.address,
[SupportedChainId.ARBITRUM_ONE]: USDC_ARBITRUM.address,
[SupportedChainId.ARBITRUM_GOERLI]: USDC_ARBITRUM_GOERLI.address,
[SupportedChainId.OPTIMISM]: USDC_OPTIMISM.address,
[SupportedChainId.OPTIMISM_GOERLI]: USDC_OPTIMISM_GOERLI.address,
[SupportedChainId.POLYGON]: USDC_POLYGON.address,

@ -62,6 +62,7 @@ export const CHAIN_ID_TO_BACKEND_NAME: { [key: number]: Chain } = {
[SupportedChainId.CELO]: Chain.Celo,
[SupportedChainId.CELO_ALFAJORES]: Chain.Celo,
[SupportedChainId.ARBITRUM_ONE]: Chain.Arbitrum,
[SupportedChainId.ARBITRUM_GOERLI]: Chain.Arbitrum,
[SupportedChainId.OPTIMISM]: Chain.Optimism,
[SupportedChainId.OPTIMISM_GOERLI]: Chain.Optimism,
}

@ -13,6 +13,7 @@ import { useQuoter } from './useContract'
const QUOTE_GAS_OVERRIDES: { [chainId: number]: number } = {
[SupportedChainId.ARBITRUM_ONE]: 25_000_000,
[SupportedChainId.ARBITRUM_GOERLI]: 25_000_000,
[SupportedChainId.CELO]: 50_000_000,
[SupportedChainId.CELO_ALFAJORES]: 50_000_000,
[SupportedChainId.POLYGON]: 40_000_000,

@ -15,7 +15,7 @@ import { useTickLens } from './useContract'
import { PoolState, usePool } from './usePools'
const PRICE_FIXED_DIGITS = 8
const CHAIN_IDS_MISSING_SUBGRAPH_DATA = [SupportedChainId.ARBITRUM_ONE]
const CHAIN_IDS_MISSING_SUBGRAPH_DATA = [SupportedChainId.ARBITRUM_ONE, SupportedChainId.ARBITRUM_GOERLI]
// Tick with fields parsed to JSBIs, and active liquidity computed.
export interface TickProcessed {

@ -32,8 +32,9 @@ export function shouldCheck(lastBlockNumber: number, tx: Transaction): boolean {
const RETRY_OPTIONS_BY_CHAIN_ID: { [chainId: number]: RetryOptions } = {
[SupportedChainId.ARBITRUM_ONE]: { n: 10, minWait: 250, maxWait: 1000 },
[SupportedChainId.OPTIMISM_GOERLI]: { n: 10, minWait: 250, maxWait: 1000 },
[SupportedChainId.ARBITRUM_GOERLI]: { n: 10, minWait: 250, maxWait: 1000 },
[SupportedChainId.OPTIMISM]: { n: 10, minWait: 250, maxWait: 1000 },
[SupportedChainId.OPTIMISM_GOERLI]: { n: 10, minWait: 250, maxWait: 1000 },
}
const DEFAULT_RETRY_OPTIONS: RetryOptions = { n: 1, minWait: 0, maxWait: 0 }

@ -109,8 +109,8 @@ const commonTheme = {
chain_137: colors.networkPolygon,
chain_42: colors.networkArbitrum,
chain_420: colors.networkOptimism,
chain_42161: colors.networkEthereum,
chain_421611: colors.networkEthereum,
chain_42161: colors.networkArbitrum,
chain_421613: colors.networkArbitrum,
chain_80001: colors.networkPolygon,
chain_137_background: colors.purple900,
chain_10_background: colors.red900,

@ -47,7 +47,8 @@ export default function RadialGradientByChainUpdater(): null {
}
switch (chainId) {
case SupportedChainId.ARBITRUM_ONE: {
case SupportedChainId.ARBITRUM_ONE:
case SupportedChainId.ARBITRUM_GOERLI: {
setBackground(backgroundResetStyles)
const arbitrumLightGradient =
'radial-gradient(100% 100% at 50% 0%, rgba(205, 232, 251, 0.7) 0%, rgba(252, 243, 249, 0.6536) 49.48%, rgba(255, 255, 255, 0) 100%), #FFFFFF'

@ -39,6 +39,20 @@ export function getExplorerLink(chainId: number, data: string, type: ExplorerDat
}
}
if (chainId === SupportedChainId.ARBITRUM_GOERLI) {
switch (type) {
case ExplorerDataType.TRANSACTION:
return `https://goerli.arbiscan.io/tx/${data}`
case ExplorerDataType.ADDRESS:
case ExplorerDataType.TOKEN:
return `https://goerli.arbiscan.io/address/${data}`
case ExplorerDataType.BLOCK:
return `https://goerli.arbiscan.io/block/${data}`
default:
return `https://goerli.arbiscan.io/`
}
}
const prefix = BLOCK_EXPLORER_PREFIXES[chainId] ?? 'https://etherscan.io'
switch (type) {