From 51dd425e5a272ddced13a098ee153cf7f15f12c7 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 23 Apr 2024 11:45:06 -1000 Subject: [PATCH] fix: backport legacy changes to generation script (#15) --- src/generate-token-list-from-data.ts | 32 ++++++++++++++++++++++------ superchain.tokenlist.json | 30 +++++++++++++++++++++++++- 2 files changed, 55 insertions(+), 7 deletions(-) diff --git a/src/generate-token-list-from-data.ts b/src/generate-token-list-from-data.ts index 7689893..79c250f 100644 --- a/src/generate-token-list-from-data.ts +++ b/src/generate-token-list-from-data.ts @@ -6,6 +6,7 @@ import * as viemChains from "viem/chains"; import { OptimismMintableERC20Abi } from "./abis/OptimismMintableERC20"; import { StandardBridgeAbi } from "./abis/StandardBridge"; +import { L2StandardERC20Abi } from "./abis/L2StandardERC20"; interface SuperchainToken { chainId: number; @@ -52,6 +53,8 @@ async function main() { readFileSync(join(__dirname, "..", "data", path, "data.json")).toString() ); + console.log(path); + const tokens: SuperchainToken[] = []; function addToken({ @@ -118,7 +121,7 @@ async function main() { transport: http(), }); - const [BRIDGE, REMOTE_TOKEN] = await Promise.all([ + const [BRIDGE, REMOTE_TOKEN, l2Bridge, l1Token] = await Promise.all([ client .readContract({ abi: OptimismMintableERC20Abi, @@ -133,12 +136,29 @@ async function main() { address: address as Address, }) .catch(() => null), + client + .readContract({ + abi: L2StandardERC20Abi, + functionName: "l2Bridge", + address: address as Address, + }) + .catch(() => null), + client + .readContract({ + abi: L2StandardERC20Abi, + functionName: "l1Token", + address: address as Address, + }) + .catch(() => null), ]); + const localBridge = BRIDGE || l2Bridge; + const remoteToken = REMOTE_TOKEN || l1Token; + // mintable - if (BRIDGE && REMOTE_TOKEN) { + if (localBridge && remoteToken) { const baseChainId = Object.entries(data.addresses).find( - ([_, address]) => isAddressEqual(address as Address, REMOTE_TOKEN) + ([_, address]) => isAddressEqual(address as Address, remoteToken) ); if (!baseChainId) { throw new Error(`No baseChainId found for ${data.symbol}:${chainId}`); @@ -149,7 +169,7 @@ async function main() { .readContract({ abi: StandardBridgeAbi, functionName: "OTHER_BRIDGE", - address: BRIDGE, + address: localBridge, }) .catch(() => null), ]); @@ -158,13 +178,13 @@ async function main() { } addToken({ - baseAddress: REMOTE_TOKEN, + baseAddress: remoteToken, baseBridgeAddress: OTHER_BRIDGE, baseChainId: parseInt(baseChainId[0]), mintableChainId: parseInt(chainId), mintableAddress: address, - mintableBridgeAddress: BRIDGE, + mintableBridgeAddress: localBridge, }); } } diff --git a/superchain.tokenlist.json b/superchain.tokenlist.json index 27fad19..5a4bac3 100644 --- a/superchain.tokenlist.json +++ b/superchain.tokenlist.json @@ -6,7 +6,7 @@ "layer2", "infrastructure" ], - "timestamp": "2024-04-23T21:26:10.211Z", + "timestamp": "2024-04-23T21:44:09.345Z", "tokens": [ { "name": "Wrapped MistCoin", @@ -316,6 +316,34 @@ } } }, + { + "name": "Tether USD", + "symbol": "USDT", + "decimals": 6, + "logoURI": "https://raw.githubusercontent.com/ethereum-optimism/ethereum-optimism.github.io/01d7d6bf2ff3735b412da924d1df746ddd8a77a8/data/USDT/logo.png", + "address": "0xdAC17F958D2ee523a2206206994597C13D831ec7", + "chainId": 1, + "extensions": { + "opTokenId": "USDT", + "standardBridgeAddresses": { + "8453": "0x3154Cf16ccdb4C6d922629664174b904d80F2C35" + } + } + }, + { + "name": "Tether USD", + "symbol": "USDT", + "decimals": 6, + "logoURI": "https://raw.githubusercontent.com/ethereum-optimism/ethereum-optimism.github.io/01d7d6bf2ff3735b412da924d1df746ddd8a77a8/data/USDT/logo.png", + "address": "0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2", + "chainId": 8453, + "extensions": { + "opTokenId": "USDT", + "standardBridgeAddresses": { + "1": "0x4200000000000000000000000000000000000010" + } + } + }, { "name": "ZynCoin", "symbol": "ZYN",