diff --git a/src/constants/chainId.ts b/src/constants/chainId.ts index 96d15f2..5e58661 100644 --- a/src/constants/chainId.ts +++ b/src/constants/chainId.ts @@ -19,5 +19,4 @@ export enum ChainId { AVALANCHE = 43114, BASE = 8453, - BASE_GOERLI = 84531, } diff --git a/src/constants/tokens.ts b/src/constants/tokens.ts index d916f5a..8fe713a 100644 --- a/src/constants/tokens.ts +++ b/src/constants/tokens.ts @@ -9,14 +9,6 @@ export const COINBASE_WRAPPED_STAKED_ETH = new Token( 'Coinbase Wrapped Staked ETH' ) -export const COINBASE_WRAPPED_STAKED_ETH_BASE_GOERLI = new Token( - ChainId.BASE_GOERLI, - '0x4fC531f8Ae7A7808E0dccCA08F1e3c7694582950', - 18, - 'cbETH', - 'Coinbase Wrapped Staked ETH' -) - export const COINBASE_WRAPPED_STAKED_ETH_BASE = new Token( ChainId.BASE, '0x2Ae3F1Ec7F1F5012CFEab0185bfc7aa3cf0DEc22', @@ -94,14 +86,6 @@ export const DAI_BASE = new Token( 'Dai Stablecoin' ) -export const DAI_BASE_GOERLI = new Token( - ChainId.BASE_GOERLI, - '0x174956bDfbCEb6e53089297cce4fE2825E58d92C', - 18, - 'DAI', - 'Dai Stablecoin' -) - export const USDT = new Token( ChainId.MAINNET, '0xdAC17F958D2ee523a2206206994597C13D831ec7', diff --git a/src/fixtures/index.ts b/src/fixtures/index.ts index 5c6ef43..9f273be 100644 --- a/src/fixtures/index.ts +++ b/src/fixtures/index.ts @@ -11,10 +11,8 @@ import { USDT, USDT_BNB, COINBASE_WRAPPED_STAKED_ETH, - COINBASE_WRAPPED_STAKED_ETH_BASE_GOERLI, COINBASE_WRAPPED_STAKED_ETH_ARBITRUM_ONE, COINBASE_WRAPPED_STAKED_ETH_BASE, - DAI_BASE_GOERLI, COINBASE_WRAPPED_STAKED_ETH_OPTIMISM, DAI_BASE, USDT_CELO, @@ -55,12 +53,6 @@ export const Tokens: Partial>> = { COINBASE_WRAPPED_STAKED_ETH_BASE ), }, - [ChainId.BASE_GOERLI]: { - DAI: tokenToTokenInfo(DAI_BASE_GOERLI), - COINBASE_WRAPPED_STAKED_ETH: tokenToTokenInfo( - COINBASE_WRAPPED_STAKED_ETH_BASE_GOERLI - ), - }, [ChainId.CELO]: { USDT: tokenToTokenInfo(USDT_CELO), }, @@ -267,34 +259,6 @@ export const celoedSampleTokenList = { ].sort(compareTokenInfos), } -export const baseGoerliSampleTokenList_3 = { - ...sampleL1TokenList_3, - name: 'Base Goerli Sample_3', - tokens: [ - { - ...Tokens[ChainId.BASE_GOERLI]!.COINBASE_WRAPPED_STAKED_ETH, - extensions: { - bridgeInfo: { - [ChainId.MAINNET]: { - tokenAddress: COINBASE_WRAPPED_STAKED_ETH.address, - }, - }, - }, - } as unknown as TokenInfo, - { - ...(Tokens[ChainId.MAINNET]! - .COINBASE_WRAPPED_STAKED_ETH as unknown as TokenInfo), - extensions: { - bridgeInfo: { - [ChainId.BASE_GOERLI]: { - tokenAddress: COINBASE_WRAPPED_STAKED_ETH_BASE_GOERLI.address, - }, - }, - }, - } as unknown as TokenInfo, - ].sort(compareTokenInfos), -} - export const baseSampleTokenList_3 = { ...sampleL1TokenList_3, name: 'Base Sample_3', diff --git a/src/index.test.ts b/src/index.test.ts index 67150e9..f6914c4 100644 --- a/src/index.test.ts +++ b/src/index.test.ts @@ -5,13 +5,11 @@ import { COINBASE_WRAPPED_STAKED_ETH, COINBASE_WRAPPED_STAKED_ETH_ARBITRUM_ONE, COINBASE_WRAPPED_STAKED_ETH_BASE, - COINBASE_WRAPPED_STAKED_ETH_BASE_GOERLI, COINBASE_WRAPPED_STAKED_ETH_OPTIMISM, DAI, DAI_ARBITRUM_ONE, DAI_AVALANCHE, DAI_BASE, - DAI_BASE_GOERLI, DAI_BNB, DAI_OPTIMISM, DAI_POLYGON, @@ -27,7 +25,6 @@ import { bnbedSampleTokenList_2, avalanchedSampleTokenList, sampleL1TokenList_3, - baseGoerliSampleTokenList_3, baseSampleTokenList_3, celoedSampleTokenList, } from './fixtures' @@ -163,25 +160,6 @@ it('outputs bnb list correctly with different decimals', async () => { ) }) -it('outputs base goerli list correctly', async () => { - const tokenList = await chainifyTokenList( - [ChainId.BASE_GOERLI], - sampleL1TokenList_3 - ) - expect(tokenList).toBeDefined() - expect(tokenList?.version).toEqual(baseGoerliSampleTokenList_3.version) - expect( - tokenList?.tokens.map((t) => [t.address, t.chainId, t.extensions]) - ).toEqual( - // ignores other metadata - baseGoerliSampleTokenList_3.tokens.map((t) => [ - t.address, - t.chainId, - t.extensions, - ]) - ) -}) - it('outputs base list correctly', async () => { const tokenList = await chainifyTokenList([ChainId.BASE], sampleL1TokenList_3) expect(tokenList).toBeDefined() @@ -321,9 +299,6 @@ describe(chainify, () => { [ChainId.BASE]: { tokenAddress: DAI_BASE.address, }, - [ChainId.BASE_GOERLI]: { - tokenAddress: DAI_BASE_GOERLI.address, - }, }, }, }, @@ -393,16 +368,6 @@ describe(chainify, () => { }, }, }, - { - ...Tokens[ChainId.BASE_GOERLI]!.DAI, - extensions: { - bridgeInfo: { - [ChainId.MAINNET]: { - tokenAddress: DAI.address, - }, - }, - }, - }, ]) }) @@ -420,9 +385,6 @@ describe(chainify, () => { [ChainId.BASE]: { tokenAddress: COINBASE_WRAPPED_STAKED_ETH_BASE.address, }, - [ChainId.BASE_GOERLI]: { - tokenAddress: COINBASE_WRAPPED_STAKED_ETH_BASE_GOERLI.address, - }, [ChainId.ARBITRUM_ONE]: { tokenAddress: COINBASE_WRAPPED_STAKED_ETH_ARBITRUM_ONE.address, }, @@ -462,17 +424,6 @@ describe(chainify, () => { }, }, }, - { - ...Tokens[ChainId.BASE_GOERLI]!.COINBASE_WRAPPED_STAKED_ETH, - name: 'Coinbase Wrapped Staked ETH', - extensions: { - bridgeInfo: { - [ChainId.MAINNET]: { - tokenAddress: COINBASE_WRAPPED_STAKED_ETH.address, - }, - }, - }, - }, ]) }) }) diff --git a/src/index.ts b/src/index.ts index a0acda5..ef8819a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -26,7 +26,6 @@ export async function chainify( ChainId.BNB, ChainId.AVALANCHE, ChainId.BASE, - ChainId.BASE_GOERLI, ] const chainified = await chainifyTokenList(l2Chains, l1TokenListOrPathOrUrl) diff --git a/src/providers/BaseGoerliMappingProvider.ts b/src/providers/BaseGoerliMappingProvider.ts deleted file mode 100644 index eb1128e..0000000 --- a/src/providers/BaseGoerliMappingProvider.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { MappingProvider } from './MappingProvider' -import { ChainId } from '../constants/chainId' -import { getTokenList } from '../utils' -import { GenericMappedTokenData } from '../constants/types' - -const baseGoerliTokenListURL = - 'https://raw.githubusercontent.com/' + - 'ethereum-optimism/ethereum-optimism.github.io/master/optimism.tokenlist.json' - -/** - * The Base Goerli mapping (linked above) is manually maintained by the Coinbase team - * in this repository: https://github.com/ethereum-optimism/ethereum-optimism.github.io. - */ -export class BaseGoerliMappingProvider implements MappingProvider { - async provide(): Promise { - const tokens: { [key: string]: string | undefined } = {} - - let allTokens = await getTokenList(baseGoerliTokenListURL) - - let opTokenId_baseGoerliAddressMap: Record = {} - allTokens.tokens.forEach((token) => { - if (token.chainId === ChainId.BASE_GOERLI) { - if (typeof token.extensions?.opTokenId === 'string') { - opTokenId_baseGoerliAddressMap[token.extensions.opTokenId] = - token.address - } - } - }) - - allTokens.tokens.forEach((token) => { - if ( - token.chainId === ChainId.MAINNET && - typeof token.extensions?.opTokenId === 'string' && - token.extensions!.opTokenId in opTokenId_baseGoerliAddressMap - ) { - tokens[token.address.toLowerCase()] = - opTokenId_baseGoerliAddressMap[token.extensions!.opTokenId] - } - }) - - return tokens - } -} diff --git a/src/providers/BaseMappingProvider.ts b/src/providers/BaseMappingProvider.ts index d73c7fe..14feb92 100644 --- a/src/providers/BaseMappingProvider.ts +++ b/src/providers/BaseMappingProvider.ts @@ -3,7 +3,7 @@ import { ChainId } from '../constants/chainId' import { getTokenList } from '../utils' import { GenericMappedTokenData } from '../constants/types' -const baseGoerliTokenListURL = +const baseTokenListURL = 'https://raw.githubusercontent.com/' + 'ethereum-optimism/ethereum-optimism.github.io/master/optimism.tokenlist.json' @@ -15,7 +15,7 @@ export class BaseMappingProvider implements MappingProvider { async provide(): Promise { const tokens: { [key: string]: string | undefined } = {} - let allTokens = await getTokenList(baseGoerliTokenListURL) + let allTokens = await getTokenList(baseTokenListURL) let opTokenId_baseAddressMap: Record = {} allTokens.tokens.forEach((token) => { diff --git a/src/providers/index.ts b/src/providers/index.ts index fc8eced..cff7a50 100644 --- a/src/providers/index.ts +++ b/src/providers/index.ts @@ -21,7 +21,6 @@ import { MappedToken, } from '../constants/types' import { AvalancheMappingProvider } from './AvalancheMappingProvider' -import { BaseGoerliMappingProvider } from './BaseGoerliMappingProvider' import { BaseMappingProvider } from './BaseMappingProvider' import { CeloMappingProvider } from './CeloMappingProvider' @@ -36,7 +35,6 @@ const CHAINS_WITH_MAPPING_PROVIDERS = [ ChainId.AVALANCHE, ChainId.CELO, ChainId.BASE, - ChainId.BASE_GOERLI, ] export async function buildList( @@ -160,8 +158,6 @@ function getMappingProvider(chainId: ChainId, l1TokenList: TokenList) { return new CeloMappingProvider() case ChainId.BASE: return new BaseMappingProvider() - case ChainId.BASE_GOERLI: - return new BaseGoerliMappingProvider() default: throw new Error(`Chain ${chainId} not supported for fetching mappings.`) } diff --git a/src/utils.ts b/src/utils.ts index 0a25ace..c03bfff 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -118,8 +118,6 @@ export function getRpcUrl(chainId: ChainId): string { return 'https://alfajores-forno.celo-testnet.org/' case ChainId.BASE: return 'https://mainnet.base.org' - case ChainId.BASE_GOERLI: - return 'https://goerli.base.org' default: } throw new Error('Unsupported ChainId')