Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for arb sepolia #7717

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion apps/web/scripts/compile-ajv-validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ const tokenListAjv = new Ajv({ code: { source: true, esm: true } })
addFormats(tokenListAjv)
const validateTokenList = tokenListAjv.compile(schema)
let tokenListModuleCode = standaloneCode(tokenListAjv, validateTokenList)
fs.writeFileSync(path.join(__dirname, '../src/utils/__generated__/validateTokenList.js'), tokenListModuleCode)
const dirToWrite = path.join(__dirname, '../src/utils/__generated__')
if(!fs.existsSync(dirToWrite)) {
fs.mkdirSync(dirToWrite)
}
fs.writeFileSync(path.join(dirToWrite, './validateTokenList.js'), tokenListModuleCode)

const tokensAjv = new Ajv({ code: { source: true, esm: true } })
addFormats(tokensAjv)
Expand Down
1 change: 1 addition & 0 deletions apps/web/src/components/Logo/ChainLogo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export function getChainUI(chainId: ChainId, darkMode: boolean): ChainUI | undef
}
case ChainId.ARBITRUM_ONE:
case ChainId.ARBITRUM_GOERLI:
case ChainId.ARBITRUM_SEPOLIA:
return {
Symbol: arbitrum,
bgColor: '#00A3FF33',
Expand Down
2 changes: 2 additions & 0 deletions apps/web/src/components/Web3Provider/wagmi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { connect } from 'wagmi/actions'
import {
arbitrum,
arbitrumGoerli,
arbitrumSepolia,
avalanche,
base,
blast,
Expand Down Expand Up @@ -36,6 +37,7 @@ const CHAIN_ID_TO_VIEM_CHAIN: Record<SupportedInterfaceChainId, Chain> = {
[ChainId.CELO_ALFAJORES]: celoAlfajores,
[ChainId.ARBITRUM_ONE]: arbitrum,
[ChainId.ARBITRUM_GOERLI]: arbitrumGoerli,
[ChainId.ARBITRUM_SEPOLIA]: arbitrumSepolia,
[ChainId.OPTIMISM]: optimism,
[ChainId.OPTIMISM_GOERLI]: optimismGoerli,
[ChainId.BNB]: bsc,
Expand Down
6 changes: 6 additions & 0 deletions apps/web/src/constants/chains.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const chainPriorityTestCases: [ChainId, number][] = [
[ChainId.SEPOLIA, 0],
[ChainId.ARBITRUM_ONE, 1],
[ChainId.ARBITRUM_GOERLI, 1],
[ChainId.ARBITRUM_SEPOLIA, 1],
[ChainId.OPTIMISM, 2],
[ChainId.OPTIMISM_GOERLI, 2],
[ChainId.POLYGON, 3],
Expand Down Expand Up @@ -60,6 +61,7 @@ const chainIdNames: { [chainId in SupportedInterfaceChainId]: string } = {
[ChainId.CELO_ALFAJORES]: 'celo_alfajores',
[ChainId.ARBITRUM_ONE]: 'arbitrum',
[ChainId.ARBITRUM_GOERLI]: 'arbitrum_goerli',
[ChainId.ARBITRUM_SEPOLIA]: 'arbitrum_sepolia',
[ChainId.OPTIMISM]: 'optimism',
[ChainId.OPTIMISM_GOERLI]: 'optimism_goerli',
[ChainId.BNB]: 'bnb',
Expand Down Expand Up @@ -101,6 +103,7 @@ const testnetChainIds = [
ChainId.SEPOLIA,
ChainId.POLYGON_MUMBAI,
ChainId.ARBITRUM_GOERLI,
ChainId.ARBITRUM_SEPOLIA,
ChainId.OPTIMISM_GOERLI,
ChainId.CELO_ALFAJORES,
] as const
Expand Down Expand Up @@ -130,6 +133,7 @@ test.each(l1ChainIds)('L1_CHAIN_IDS generates the correct chainIds', (chainId: S
const l2ChainIds = [
ChainId.ARBITRUM_ONE,
ChainId.ARBITRUM_GOERLI,
ChainId.ARBITRUM_SEPOLIA,
ChainId.OPTIMISM,
ChainId.OPTIMISM_GOERLI,
ChainId.BASE,
Expand Down Expand Up @@ -176,6 +180,7 @@ const chainIdToBackendName: { [key: number]: InterfaceGqlChain } = {
[ChainId.CELO_ALFAJORES]: Chain.Celo,
[ChainId.ARBITRUM_ONE]: Chain.Arbitrum,
[ChainId.ARBITRUM_GOERLI]: Chain.Arbitrum,
[ChainId.ARBITRUM_SEPOLIA]: Chain.Arbitrum,
[ChainId.OPTIMISM]: Chain.Optimism,
[ChainId.OPTIMISM_GOERLI]: Chain.Optimism,
[ChainId.BNB]: Chain.Bnb,
Expand Down Expand Up @@ -251,6 +256,7 @@ const infuraPrefixToChainId: { [prefix: string]: SupportedInterfaceChainId } = {
'optimism-goerli': ChainId.OPTIMISM_GOERLI,
'arbitrum-mainnet': ChainId.ARBITRUM_ONE,
'arbitrum-goerli': ChainId.ARBITRUM_GOERLI,
'arbitrum-sepolia': ChainId.ARBITRUM_SEPOLIA,
'polygon-mainnet': ChainId.POLYGON,
'polygon-mumbai': ChainId.POLYGON_MUMBAI,
'avalanche-mainnet': ChainId.AVALANCHE,
Expand Down
35 changes: 35 additions & 0 deletions apps/web/src/constants/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
USDB_BLAST,
USDC_ARBITRUM,
USDC_ARBITRUM_GOERLI,
USDC_ARBITRUM_SEPOLIA,
USDC_AVALANCHE,
USDC_BASE,
USDC_BSC,
Expand Down Expand Up @@ -63,6 +64,7 @@ export const SUPPORTED_INTERFACE_CHAIN_IDS = [
ChainId.CELO_ALFAJORES,
ChainId.ARBITRUM_ONE,
ChainId.ARBITRUM_GOERLI,
ChainId.ARBITRUM_SEPOLIA,
ChainId.OPTIMISM,
ChainId.OPTIMISM_GOERLI,
ChainId.BNB,
Expand Down Expand Up @@ -120,6 +122,7 @@ export function useSupportedChainId(chainId?: number): SupportedInterfaceChainId
*/
const CHAIN_URL_PARAMS = [
'arbitrum_goerli',
'arbitrum_sepolia',
'arbitrum',
'avalanche',
'base',
Expand Down Expand Up @@ -473,6 +476,38 @@ export const CHAIN_INFO: ChainInfoMap = {
spotPriceStablecoinAmount: CurrencyAmount.fromRawAmount(USDC_ARBITRUM_GOERLI, 10_000e6),
stablecoins: [USDC_ARBITRUM_GOERLI],
},
[ChainId.ARBITRUM_SEPOLIA]: {
id: ChainId.ARBITRUM_SEPOLIA,
name: 'arbitrum_sepolia',
urlParam: 'arbitrum_sepolia',
blockPerMainnetEpochForChainId: 1,
networkLayer: NetworkLayer.L2,
blockWaitMsBeforeWarning: ms(`10m`),
pendingTransactionsRetryOptions: DEFAULT_RETRY_OPTIONS,
bridge: 'https://bridge.arbitrum.io/',
docs: 'https://offchainlabs.com/',
explorer: 'https://sepolia.arbiscan.io/',
infoLink: 'https://info.uniswap.org/#/arbitrum/',
label: 'Arbitrum Sepolia',
helpCenterUrl: 'https://help.uniswap.org/en/collections/3137787-uniswap-on-arbitrum',
nativeCurrency: { name: 'Sepolia Arbitrum Ether', symbol: 'sepoliaArbETH', decimals: 18 },
color: darkTheme.chain_421613,
chainPriority: 1,
supportsClientSideRouting: true,
isTestnetChain: true,
backendChain: {
chain: Chain.Arbitrum,
isSecondaryChain: true,
backendSupported: true,
},
rpcUrls: {
safe: ['https://sepolia-rollup.arbitrum.io/rpc'],
appOnly: [`https://arbitrum-sepolia.infura.io/v3/${INFURA_KEY}`],
infuraPrefix: 'arbitrum-sepolia',
},
spotPriceStablecoinAmount: CurrencyAmount.fromRawAmount(USDC_ARBITRUM_SEPOLIA, 10_000e6),
stablecoins: [USDC_ARBITRUM_SEPOLIA],
},
[ChainId.POLYGON]: {
id: ChainId.POLYGON,
name: 'polygon',
Expand Down
7 changes: 7 additions & 0 deletions apps/web/src/constants/routing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
PORTAL_ETH_CELO,
USDC_ARBITRUM,
USDC_ARBITRUM_GOERLI,
USDC_ARBITRUM_SEPOLIA,
USDC_AVALANCHE,
USDC_BASE,
USDC_BSC,
Expand Down Expand Up @@ -92,6 +93,7 @@ export const COMMON_BASES: ChainCurrencyList = {
[ChainId.SEPOLIA]: [nativeOnChain(ChainId.SEPOLIA), WRAPPED_NATIVE_CURRENCY[ChainId.SEPOLIA] as Token].map(
buildCurrencyInfo
),

[ChainId.ARBITRUM_ONE]: [
nativeOnChain(ChainId.ARBITRUM_ONE),
ARB,
Expand All @@ -106,6 +108,11 @@ export const COMMON_BASES: ChainCurrencyList = {
WRAPPED_NATIVE_CURRENCY[ChainId.ARBITRUM_GOERLI] as Token,
USDC_ARBITRUM_GOERLI,
].map(buildCurrencyInfo),
[ChainId.ARBITRUM_SEPOLIA]: [
nativeOnChain(ChainId.ARBITRUM_SEPOLIA),
WRAPPED_NATIVE_CURRENCY[ChainId.ARBITRUM_SEPOLIA] as Token,
USDC_ARBITRUM_SEPOLIA,
].map(buildCurrencyInfo),

[ChainId.OPTIMISM]: [
nativeOnChain(ChainId.OPTIMISM),
Expand Down
14 changes: 14 additions & 0 deletions apps/web/src/constants/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ export const USDC_ARBITRUM_GOERLI = new Token(
'USDC',
'USD//C'
)
export const USDC_ARBITRUM_SEPOLIA = new Token(
ChainId.ARBITRUM_SEPOLIA,
'0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d',
6,
'USDC',
'USD//C'
)
export const USDC_POLYGON = new Token(
ChainId.POLYGON,
'0x3c499c542cef5e3811e1192ce70d8cc03d5c3359',
Expand Down Expand Up @@ -300,6 +307,13 @@ export const WRAPPED_NATIVE_CURRENCY: { [chainId: number]: Token | undefined } =
'WETH',
'Wrapped Ether'
),
[ChainId.ARBITRUM_SEPOLIA]: new Token(
ChainId.ARBITRUM_SEPOLIA,
'0x980B62Da83eFf3D4576C647993b0c1D7faf17c73',
18,
'WETH',
'Wrapped Ether'
),
[ChainId.SEPOLIA]: new Token(
ChainId.SEPOLIA,
'0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14',
Expand Down
1 change: 1 addition & 0 deletions apps/web/src/state/migrations/3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const migration3 = (state: PersistAppStateV3 | undefined) => {
[ChainId.OPTIMISM_GOERLI]: '0x7E07E15D2a87A24492740D16f5bdF58c16db0c4E',
[ChainId.ARBITRUM_ONE]: '0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8',
[ChainId.ARBITRUM_GOERLI]: '0x8FB1E3fC51F3b789dED7557E680551d93Ea9d892',
[ChainId.ARBITRUM_SEPOLIA]: '0x119f0E6303BEc7021B295EcaB27A4a1A5b37ECf0',
[ChainId.AVALANCHE]: '0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664',
[ChainId.POLYGON]: '0x2791bca1f2de4661ed88a30c99a7a9449aa84174',
[ChainId.POLYGON_MUMBAI]: '0xe11a86849d99f524cac3e7a0ec1241828e332c62',
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/state/routing/gas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export async function getApproveInfo(

// routing-api under estimates gas for Arbitrum swaps so it inflates cost per gas by a lot
// so disable showing approves for Arbitrum until routing-api gives more accurate gas estimates
if (currency.chainId === ChainId.ARBITRUM_ONE || currency.chainId === ChainId.ARBITRUM_GOERLI) {
if (currency.chainId === ChainId.ARBITRUM_ONE || currency.chainId === ChainId.ARBITRUM_GOERLI || currency.chainId === ChainId.ARBITRUM_SEPOLIA) {
return { needsApprove: false }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ export default function RadialGradientByChainUpdater(): null {

switch (chainId) {
case ChainId.ARBITRUM_ONE:
case ChainId.ARBITRUM_GOERLI: {
case ChainId.ARBITRUM_GOERLI:
case ChainId.ARBITRUM_SEPOLIA:{
setBackground(backgroundResetStyles)
const arbitrumLightGradient =
'radial-gradient(100% 100% at 50% 0%, rgba(205, 232, 251, 0) 0%, rgba(252, 243, 249, 0) 49.48%, rgba(255, 255, 255, 0) 100%), #FFFFFF'
Expand Down
1 change: 1 addition & 0 deletions apps/web/src/utils/getExplorerLink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const BLOCK_EXPLORER_PREFIXES: { [chainId: number]: string } = {
[ChainId.SEPOLIA]: 'https://sepolia.etherscan.io',
[ChainId.ARBITRUM_ONE]: 'https://arbiscan.io',
[ChainId.ARBITRUM_GOERLI]: 'https://goerli.arbiscan.io',
[ChainId.ARBITRUM_SEPOLIA]: 'https://sepolia.arbiscan.io',
[ChainId.OPTIMISM]: 'https://optimistic.etherscan.io',
[ChainId.OPTIMISM_GOERLI]: 'https://goerli-optimism.etherscan.io',
[ChainId.POLYGON]: 'https://polygonscan.com',
Expand Down