Skip to content

Commit

Permalink
remove base goerli mapper
Browse files Browse the repository at this point in the history
  • Loading branch information
matteenm committed Nov 4, 2024
1 parent fb8a716 commit c5e9c8b
Show file tree
Hide file tree
Showing 9 changed files with 2 additions and 154 deletions.
1 change: 0 additions & 1 deletion src/constants/chainId.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@ export enum ChainId {
AVALANCHE = 43114,

BASE = 8453,
BASE_GOERLI = 84531,
}
16 changes: 0 additions & 16 deletions src/constants/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down
36 changes: 0 additions & 36 deletions src/fixtures/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -55,12 +53,6 @@ export const Tokens: Partial<Record<ChainId, Record<string, TokenInfo>>> = {
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),
},
Expand Down Expand Up @@ -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',
Expand Down
49 changes: 0 additions & 49 deletions src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -27,7 +25,6 @@ import {
bnbedSampleTokenList_2,
avalanchedSampleTokenList,
sampleL1TokenList_3,
baseGoerliSampleTokenList_3,
baseSampleTokenList_3,
celoedSampleTokenList,
} from './fixtures'
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -321,9 +299,6 @@ describe(chainify, () => {
[ChainId.BASE]: {
tokenAddress: DAI_BASE.address,
},
[ChainId.BASE_GOERLI]: {
tokenAddress: DAI_BASE_GOERLI.address,
},
},
},
},
Expand Down Expand Up @@ -393,16 +368,6 @@ describe(chainify, () => {
},
},
},
{
...Tokens[ChainId.BASE_GOERLI]!.DAI,
extensions: {
bridgeInfo: {
[ChainId.MAINNET]: {
tokenAddress: DAI.address,
},
},
},
},
])
})

Expand All @@ -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,
},
Expand Down Expand Up @@ -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,
},
},
},
},
])
})
})
1 change: 0 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export async function chainify(
ChainId.BNB,
ChainId.AVALANCHE,
ChainId.BASE,
ChainId.BASE_GOERLI,
]

const chainified = await chainifyTokenList(l2Chains, l1TokenListOrPathOrUrl)
Expand Down
43 changes: 0 additions & 43 deletions src/providers/BaseGoerliMappingProvider.ts

This file was deleted.

4 changes: 2 additions & 2 deletions src/providers/BaseMappingProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand All @@ -15,7 +15,7 @@ export class BaseMappingProvider implements MappingProvider {
async provide(): Promise<GenericMappedTokenData> {
const tokens: { [key: string]: string | undefined } = {}

let allTokens = await getTokenList(baseGoerliTokenListURL)
let allTokens = await getTokenList(baseTokenListURL)

let opTokenId_baseAddressMap: Record<string, string> = {}
allTokens.tokens.forEach((token) => {
Expand Down
4 changes: 0 additions & 4 deletions src/providers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand All @@ -36,7 +35,6 @@ const CHAINS_WITH_MAPPING_PROVIDERS = [
ChainId.AVALANCHE,
ChainId.CELO,
ChainId.BASE,
ChainId.BASE_GOERLI,
]

export async function buildList(
Expand Down Expand Up @@ -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.`)
}
Expand Down
2 changes: 0 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit c5e9c8b

Please sign in to comment.