Skip to content

Commit a6bca43

Browse files
committed
refactor: move generate fns to mapTokenListToBridge script
1 parent 45271a8 commit a6bca43

File tree

2 files changed

+59
-59
lines changed

2 files changed

+59
-59
lines changed

src/scripts/generateBridgeList.ts

Lines changed: 2 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@ import { SupportedChainId } from '@cowprotocol/cow-sdk'
22
import { Contract, ContractInterface } from '@ethersproject/contracts'
33
import { JsonRpcProvider } from '@ethersproject/providers'
44
import type { TokenInfo, TokenList } from '@uniswap/token-lists'
5-
import { ARBITRUM_BRIDGE_ABI } from '../abi/abitrumBridgeAbi'
65
import { ERC20_ABI } from '../abi/erc20'
76
import { MULTICALL_ABI } from '../abi/multicallAbi'
8-
import { OMNIBRIDGE_CONTRACT_ABI } from '../abi/omnibridgeAbi'
97
import { getProvider } from '../permitInfo/utils/getProvider'
10-
import { ARBITRUM_BRIDGE_ADDRESS, MULTICALL_ADDRESS, OMNIBRIDGE_ADDRESS, ZERO_ADDRESS } from './const'
8+
import { MULTICALL_ADDRESS, ZERO_ADDRESS } from './const'
119
import { writeTokenListToSrc } from './tokenListUtils'
1210

1311
type Call = {
@@ -36,7 +34,7 @@ type Extensions = {
3634
* @param outputFilePath
3735
* @param tokensToReplace
3836
*/
39-
async function generateBridgedList(
37+
export async function generateBridgedList(
4038
chainId: SupportedChainId,
4139
tokenListSource: string | TokenList,
4240
bridgeContractAddress: string,
@@ -232,56 +230,3 @@ function parseTotalSupplyResponses(
232230
return acc
233231
}, [])
234232
}
235-
236-
// TODO: move to a different file
237-
export async function generateGnosisChainList(source: string | TokenList, resultFile: string) {
238-
console.log('*** Map tokens from Mainnet to Gnosis chain using Omnibridge ***')
239-
240-
generateBridgedList(
241-
SupportedChainId.GNOSIS_CHAIN,
242-
source,
243-
OMNIBRIDGE_ADDRESS,
244-
OMNIBRIDGE_CONTRACT_ABI,
245-
'bridgedTokenAddress',
246-
resultFile,
247-
)
248-
}
249-
250-
export async function generateArbitrumOneChainList(source: string | TokenList, resultFile: string) {
251-
console.log('*** Map tokens from Mainnet to Arbitrum One using Arbitrum bridge ***')
252-
253-
generateBridgedList(
254-
SupportedChainId.ARBITRUM_ONE,
255-
source,
256-
ARBITRUM_BRIDGE_ADDRESS,
257-
ARBITRUM_BRIDGE_ABI,
258-
'calculateL2TokenAddress',
259-
resultFile,
260-
{
261-
// USDC
262-
'0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48': '0xaf88d065e77c8cc2239327c5edb3a432268e5831',
263-
// WETH
264-
'0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2': '0x82af49447d8a07e3bd95bd0d56f35241523fbab1',
265-
// agEUR
266-
'0x1a7e4e63778b4f12a199c062f3efdd288afcbce8': '0xFA5Ed56A203466CbBC2430a43c66b9D8723528E7',
267-
// ARB
268-
'0xb50721bcf8d664c30412cfbc6cf7a15145234ad1': '0x912CE59144191C1204E64559FE8253a0e49E6548',
269-
// AXL
270-
'0x467719ad09025fcc6cf6f8311755809d45a5e5f3': '0x23ee2343B892b1BB63503a4FAbc840E0e2C6810f',
271-
// CELO
272-
'0x3294395e62f4eb6af3f1fcf89f5602d90fb3ef69': '0x4E51aC49bC5e2d87e0EF713E9e5AB2D71EF4F336',
273-
// DAI
274-
'0x6b175474e89094c44da98b954eedeac495271d0f': '0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1',
275-
// GRT
276-
'0xc944e90c64b2c07662a292be6244bdf05cda44a7': '0x9623063377AD1B27544C965cCd7342f7EA7e88C7',
277-
// GYEN
278-
'0xc08512927d12348f6620a698105e1baac6ecd911': '0x589d35656641d6aB57A545F08cf473eCD9B6D5F7',
279-
// LPT
280-
'0x58b6a8a3302369daec383334672404ee733ab239': '0x289ba1701C2F088cf0faf8B3705246331cB8A839',
281-
// POND
282-
'0x57b946008913b82e4df85f501cbaed910e58d26c': '0xdA0a57B710768ae17941a9Fa33f8B720c8bD9ddD',
283-
// USDT
284-
'0xdac17f958d2ee523a2206206994597c13d831ec7': '0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9',
285-
},
286-
)
287-
}

src/scripts/mapTokenListToBridge.ts

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import { SupportedChainId } from '@cowprotocol/cow-sdk'
2+
import type { TokenList } from '@uniswap/token-lists'
23
import { argv, exit } from 'node:process'
4+
import { ARBITRUM_BRIDGE_ABI } from '../abi/abitrumBridgeAbi'
5+
import { OMNIBRIDGE_CONTRACT_ABI } from '../abi/omnibridgeAbi'
36
import coingeckoList from '../public/CoinGecko.json' assert { type: 'json' }
4-
import { UNISWAP_TOKENS_LIST } from './const'
5-
import { generateArbitrumOneChainList, generateGnosisChainList } from './generateBridgeList'
7+
import { ARBITRUM_BRIDGE_ADDRESS, OMNIBRIDGE_ADDRESS, UNISWAP_TOKENS_LIST } from './const'
8+
import { generateBridgedList } from './generateBridgeList'
69

710
const [, , chainId, listSource = 'coingecko'] = argv
811

@@ -26,3 +29,55 @@ switch (+chainId) {
2629
console.error(`ChainId ${chainId} doesn't support bridge mapping`)
2730
exit(1)
2831
}
32+
33+
async function generateGnosisChainList(source: string | TokenList, resultFile: string) {
34+
console.log('*** Map tokens from Mainnet to Gnosis chain using Omnibridge ***')
35+
36+
generateBridgedList(
37+
SupportedChainId.GNOSIS_CHAIN,
38+
source,
39+
OMNIBRIDGE_ADDRESS,
40+
OMNIBRIDGE_CONTRACT_ABI,
41+
'bridgedTokenAddress',
42+
resultFile,
43+
)
44+
}
45+
46+
async function generateArbitrumOneChainList(source: string | TokenList, resultFile: string) {
47+
console.log('*** Map tokens from Mainnet to Arbitrum One using Arbitrum bridge ***')
48+
49+
generateBridgedList(
50+
SupportedChainId.ARBITRUM_ONE,
51+
source,
52+
ARBITRUM_BRIDGE_ADDRESS,
53+
ARBITRUM_BRIDGE_ABI,
54+
'calculateL2TokenAddress',
55+
resultFile,
56+
{
57+
// USDC
58+
'0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48': '0xaf88d065e77c8cc2239327c5edb3a432268e5831',
59+
// WETH
60+
'0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2': '0x82af49447d8a07e3bd95bd0d56f35241523fbab1',
61+
// agEUR
62+
'0x1a7e4e63778b4f12a199c062f3efdd288afcbce8': '0xFA5Ed56A203466CbBC2430a43c66b9D8723528E7',
63+
// ARB
64+
'0xb50721bcf8d664c30412cfbc6cf7a15145234ad1': '0x912CE59144191C1204E64559FE8253a0e49E6548',
65+
// AXL
66+
'0x467719ad09025fcc6cf6f8311755809d45a5e5f3': '0x23ee2343B892b1BB63503a4FAbc840E0e2C6810f',
67+
// CELO
68+
'0x3294395e62f4eb6af3f1fcf89f5602d90fb3ef69': '0x4E51aC49bC5e2d87e0EF713E9e5AB2D71EF4F336',
69+
// DAI
70+
'0x6b175474e89094c44da98b954eedeac495271d0f': '0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1',
71+
// GRT
72+
'0xc944e90c64b2c07662a292be6244bdf05cda44a7': '0x9623063377AD1B27544C965cCd7342f7EA7e88C7',
73+
// GYEN
74+
'0xc08512927d12348f6620a698105e1baac6ecd911': '0x589d35656641d6aB57A545F08cf473eCD9B6D5F7',
75+
// LPT
76+
'0x58b6a8a3302369daec383334672404ee733ab239': '0x289ba1701C2F088cf0faf8B3705246331cB8A839',
77+
// POND
78+
'0x57b946008913b82e4df85f501cbaed910e58d26c': '0xdA0a57B710768ae17941a9Fa33f8B720c8bD9ddD',
79+
// USDT
80+
'0xdac17f958d2ee523a2206206994597c13d831ec7': '0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9',
81+
},
82+
)
83+
}

0 commit comments

Comments
 (0)