From c63b6ab77ff3416cd70bec9d3dc8d7bbc26b3fb3 Mon Sep 17 00:00:00 2001 From: Lukas Date: Mon, 25 Nov 2024 12:09:05 +0100 Subject: [PATCH] feat: gho libraries (#713) --- package-lock.json | 67 +++++++++++-------------- package.json | 4 +- safe.csv | 27 +++++----- scripts/clients.ts | 65 ++---------------------- scripts/configs/gho/arbitrum.ts | 10 ++++ scripts/configs/gho/ethereum.ts | 23 +++++++++ scripts/configs/governance/arbitrum.ts | 2 +- scripts/configs/governance/avalanche.ts | 2 +- scripts/configs/networks/arbitrum.ts | 3 +- scripts/configs/networks/avalanche.ts | 2 +- scripts/configs/networks/ethereum.ts | 16 ------ scripts/configs/pools/arbitrum.ts | 2 +- scripts/configs/pools/avalanche.ts | 4 +- scripts/configs/types.ts | 18 +++---- scripts/generateAddresses.ts | 11 ++-- scripts/generateSafeCSV.ts | 4 +- scripts/generator/generateTokenList.ts | 5 +- scripts/generator/ghoGenerator.ts | 36 +++++++++++++ scripts/generator/utils.ts | 4 +- src/AaveAddressBook.sol | 67 ------------------------- src/GhoArbitrum.sol | 8 +++ src/GhoEthereum.sol | 47 +++++++++++++++++ src/MiscArbitrum.sol | 3 -- src/MiscEthereum.sol | 39 -------------- src/test/AaveV2Ethereum.t.sol | 2 +- src/test/AaveV2Misfits.t.sol | 4 +- src/test/AaveV3Avalanche.t.sol | 2 +- src/ts/AaveAddressBook.ts | 2 + src/ts/GhoArbitrum.ts | 5 ++ src/ts/GhoEthereum.ts | 41 +++++++++++++++ src/ts/MiscArbitrum.ts | 3 -- src/ts/MiscEthereum.ts | 36 ------------- tests/verification.spec.ts | 5 +- tokenlist.json | 12 ++--- ui/package.json | 5 +- ui/src/app/page.tsx | 8 +-- 36 files changed, 268 insertions(+), 326 deletions(-) create mode 100644 scripts/configs/gho/arbitrum.ts create mode 100644 scripts/configs/gho/ethereum.ts create mode 100644 scripts/generator/ghoGenerator.ts delete mode 100644 src/AaveAddressBook.sol create mode 100644 src/GhoArbitrum.sol create mode 100644 src/GhoEthereum.sol create mode 100644 src/ts/GhoArbitrum.ts create mode 100644 src/ts/GhoEthereum.ts diff --git a/package-lock.json b/package-lock.json index b58bde49..ccd33a53 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,8 +12,8 @@ "ui" ], "devDependencies": { - "@bgd-labs/react-web3-icons": "^1.5.3", - "@bgd-labs/rpc-env": "^1.0.3", + "@bgd-labs/react-web3-icons": "^1.7.2", + "@bgd-labs/rpc-env": "^2.1.2", "@types/node": "^22.4.1", "@uniswap/token-lists": "^1.0.0-beta.33", "ajv": "^8.12.0", @@ -68,25 +68,28 @@ } }, "node_modules/@bgd-labs/react-web3-icons": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@bgd-labs/react-web3-icons/-/react-web3-icons-1.6.0.tgz", - "integrity": "sha512-Cro+TVP1Z9tpsyIo5Q8fpcxPlCQm5WIIw7fKtSNoT2XLodJ4EPBRkPx1Nrb0FMUNiwhGNf8gdEFrCUrSGzT0Cg==", - "license": "MIT", + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/@bgd-labs/react-web3-icons/-/react-web3-icons-1.7.2.tgz", + "integrity": "sha512-y7U0Z9I2UnHfdJgX9YPCA5NSnkJE8cmOm8Lqd5plLv6eVvgvXcg9W5YY8h6RPmEyPqQhl4JHrK6lMFP6uOCDSQ==", "dependencies": { "@loadable/component": "5.16.4", - "react": "18.3.1", - "react-dom": "18.3.1", - "react-inlinesvg": "^4.1.3" + "to-words": "4.1.0" }, "engines": { "node": ">=18" + }, + "peerDependencies": { + "react": ">=18.3.1", + "react-dom": ">=18.3.1" } }, "node_modules/@bgd-labs/rpc-env": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@bgd-labs/rpc-env/-/rpc-env-1.0.3.tgz", - "integrity": "sha512-9Irh5zOra0UBeFNvtTuweIeb4Y9lTgHvLJnORJ/iLGqPjuTJZpjD1bPqjHyLZb9mhC5sqbaVUqM8WAt5SsKNsg==", - "dev": true + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@bgd-labs/rpc-env/-/rpc-env-2.1.2.tgz", + "integrity": "sha512-xY6cjC55ZUhsAGt4LynzG7DT8MWSeDZJ3opCK2AIkPn2dQrqvMPTkeodbyaUyV59AK3Qy8aiFmNCeHqF+aPnvQ==", + "bin": { + "rpc-env": "dist/cli.js" + } }, "node_modules/@esbuild/aix-ppc64": { "version": "0.23.0", @@ -678,9 +681,9 @@ } }, "node_modules/@leeoniya/ufuzzy": { - "version": "1.0.14", - "resolved": "https://registry.npmjs.org/@leeoniya/ufuzzy/-/ufuzzy-1.0.14.tgz", - "integrity": "sha512-/xF4baYuCQMo+L/fMSUrZnibcu0BquEGnbxfVPiZhs/NbJeKj4c/UmFpQzW9Us0w45ui/yYW3vyaqawhNYsTzA==" + "version": "1.0.16", + "resolved": "https://registry.npmjs.org/@leeoniya/ufuzzy/-/ufuzzy-1.0.16.tgz", + "integrity": "sha512-HdCTRhJ/TOIraA8aXR6XBaknR2wXv1ycb4E9laBjkAXyuEZ2ln5umf6IlMqnafVjj+pgLcbPduArCbtzQzr68Q==" }, "node_modules/@loadable/component": { "version": "5.16.4", @@ -4959,25 +4962,6 @@ "react": "^18.3.1" } }, - "node_modules/react-from-dom": { - "version": "0.7.3", - "resolved": "https://registry.npmjs.org/react-from-dom/-/react-from-dom-0.7.3.tgz", - "integrity": "sha512-9IK6R7+eD1wOAMC2ZCrENev0eK1625cb7vX+cnnOR9LBRNbjKiaJk4ij2zQbcefEXTWjXFhA7CTO1cd8wMONnw==", - "peerDependencies": { - "react": "^16.8.0 || ^17.0.0 || ^18.0.0" - } - }, - "node_modules/react-inlinesvg": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/react-inlinesvg/-/react-inlinesvg-4.1.3.tgz", - "integrity": "sha512-p1+wkr1UQZyLw/3bdpnHO3v3tMNVWyxWnAEY6ML/Ql9ldDYTBTy6HqAyNl7u3au925XPffLMiXKnQrqZeJAldw==", - "dependencies": { - "react-from-dom": "^0.7.2" - }, - "peerDependencies": { - "react": "16.8 - 18" - } - }, "node_modules/react-is": { "version": "16.13.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", @@ -5826,6 +5810,14 @@ "node": ">=8.0" } }, + "node_modules/to-words": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/to-words/-/to-words-4.1.0.tgz", + "integrity": "sha512-42GLFZQr/7i3sNiXJ7J83Kkw3hj8pWdTtj5kPjSWnyr1lkxmCnC2Dkx8JMttMAnQxj76ktyGpuDRsrxU5UeXpw==", + "engines": { + "node": ">=12.0.0" + } + }, "node_modules/tr46": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/tr46/-/tr46-1.0.1.tgz", @@ -7548,8 +7540,9 @@ "ui": { "version": "0.1.0", "dependencies": { - "@bgd-labs/react-web3-icons": "^1.4.7", - "@leeoniya/ufuzzy": "^1.0.14", + "@bgd-labs/react-web3-icons": "^1.7.2", + "@bgd-labs/rpc-env": "^2.1.2", + "@leeoniya/ufuzzy": "^1.0.16", "clsx": "^2.1.1", "next": "14.2.7", "react": "^18", diff --git a/package.json b/package.json index cd81f5d0..9fb4c5bd 100644 --- a/package.json +++ b/package.json @@ -78,8 +78,8 @@ }, "homepage": "https://github.com/bgd-labs/aave-address-book#readme", "devDependencies": { - "@bgd-labs/react-web3-icons": "^1.5.3", - "@bgd-labs/rpc-env": "^1.0.3", + "@bgd-labs/react-web3-icons": "^1.7.2", + "@bgd-labs/rpc-env": "^2.1.2", "@types/node": "^22.4.1", "@uniswap/token-lists": "^1.0.0-beta.33", "ajv": "^8.12.0", diff --git a/safe.csv b/safe.csv index 91445cc5..0a14ff95 100644 --- a/safe.csv +++ b/safe.csv @@ -738,6 +738,19 @@ address,name,chainId 0xC7be5307ba715ce89b152f3Df0658295b3dbA8E2,AaveV3EthereumLido WALLET_BALANCE_PROVIDER,1 0x0B8C700917a6991FEa7198dDFC80bc8962b5055D,AaveV3EthereumLido WETH_GATEWAY,1 0x43eDB797834151D041619EEF833Edc784B509dAE,AaveV3EthereumLido WITHDRAW_SWAP_ADAPTER,1 +0x5756880B6a1EAba0175227bf02a7E87c1e02B28C,GhoEthereum GHO_CCIP_TOKEN_POOL,1 +0xb639D208Bcf0589D54FaC24E655C79EC529762B8,GhoEthereum GHO_FLASHMINTER_FACILITATOR,1 +0xA1c93D2687f7014Aaf588c764E3Ce80aF016229b,GhoEthereum GHO_LIQUIDITY_COMMITTEE,1 +0x40D16FC0246aD3160Ccc09B8D0D3A2cD28aE6C2f,GhoEthereum GHO_TOKEN,1 +0x167527DB01325408696326e3580cd8e55D99Dc1A,GhoEthereum GSM_REGISTRY,1 +0x0d8eFfC11dF3F229AA1EA0509BC9DFa632A13578,GhoEthereum GSM_USDC,1 +0xD4478A76aCeA81D3768A0ACB6e38f25eEB6Eb1B5,GhoEthereum GSM_USDC_FEE_STRATEGY,1 +0xef6beCa8D9543eC007bceA835aF768B58F730C1f,GhoEthereum GSM_USDC_ORACLE_SWAP_FREEZER,1 +0x430BEdcA5DfA6f94d1205Cb33AB4f008D0d9942a,GhoEthereum GSM_USDC_PRICE_STRATEGY,1 +0x686F8D21520f4ecEc7ba577be08354F4d1EB8262,GhoEthereum GSM_USDT,1 +0xD4478A76aCeA81D3768A0ACB6e38f25eEB6Eb1B5,GhoEthereum GSM_USDT_FEE_STRATEGY,1 +0x71381e6718b37C12155CB961Ca3D374A8BfFa0e5,GhoEthereum GSM_USDT_ORACLE_SWAP_FREEZER,1 +0x4c707764cbFB4FFa078e169e6b8A6AdbE7526a2c,GhoEthereum GSM_USDT_PRICE_STRATEGY,1 0xEd42a7D8559a463722Ca4beD50E0Cc05a386b0e1,GovernanceV3Ethereum CROSS_CHAIN_CONTROLLER,1 0x1699FE9CaDC8a0b6c93E06B62Ab4592a0fFEcF61,GovernanceV3Ethereum DATA_WAREHOUSE,1 0x73C6Fb358dDA8e84D50e98A98F7c0dF32e15C7e9,GovernanceV3Ethereum EMERGENCY_REGISTRY,1 @@ -765,18 +778,6 @@ address,name,chainId 0xcc3C54B95f3f1867A43009B80ed4DD930E3cE2F7,MiscEthereum CREATE_3_FACTORY,1 0x25F2226B597E8F9514B3F68F00f494cF4f286491,MiscEthereum ECOSYSTEM_RESERVE,1 0xb49f677943BC038e9857d61E7d053CaA2C1734C1,MiscEthereum EUR_USD_AGGREGATOR,1 -0x5756880B6a1EAba0175227bf02a7E87c1e02B28C,MiscEthereum GHO_CCIP_TOKEN_POOL,1 -0xb639D208Bcf0589D54FaC24E655C79EC529762B8,MiscEthereum GHO_FLASHMINTER_FACILITATOR,1 -0x40D16FC0246aD3160Ccc09B8D0D3A2cD28aE6C2f,MiscEthereum GHO_TOKEN,1 -0x167527DB01325408696326e3580cd8e55D99Dc1A,MiscEthereum GSM_REGISTRY,1 -0x0d8eFfC11dF3F229AA1EA0509BC9DFa632A13578,MiscEthereum GSM_USDC,1 -0xD4478A76aCeA81D3768A0ACB6e38f25eEB6Eb1B5,MiscEthereum GSM_USDC_FEE_STRATEGY,1 -0xef6beCa8D9543eC007bceA835aF768B58F730C1f,MiscEthereum GSM_USDC_ORACLE_SWAP_FREEZER,1 -0x430BEdcA5DfA6f94d1205Cb33AB4f008D0d9942a,MiscEthereum GSM_USDC_PRICE_STRATEGY,1 -0x686F8D21520f4ecEc7ba577be08354F4d1EB8262,MiscEthereum GSM_USDT,1 -0xD4478A76aCeA81D3768A0ACB6e38f25eEB6Eb1B5,MiscEthereum GSM_USDT_FEE_STRATEGY,1 -0x71381e6718b37C12155CB961Ca3D374A8BfFa0e5,MiscEthereum GSM_USDT_ORACLE_SWAP_FREEZER,1 -0x4c707764cbFB4FFa078e169e6b8A6AdbE7526a2c,MiscEthereum GSM_USDT_PRICE_STRATEGY,1 0x9abf798f5314BFd793A9E57A654BEd35af4A1D60,MiscEthereum PARASWAP_FEE_CLAIMER,1 0x2CFe3ec4d5a6811f4B8067F0DE7e47DfA938Aa30,MiscEthereum PROTOCOL_GUARDIAN,1 0xD3cF979e676265e4f6379749DECe4708B9A22476,MiscEthereum PROXY_ADMIN,1 @@ -1781,6 +1782,7 @@ address,name,chainId 0xBc790382B3686abffE4be14A030A96aC6154023a,AaveV3Arbitrum WALLET_BALANCE_PROVIDER,42161 0x5760E34c4003752329bC77790B1De44C2799F8C3,AaveV3Arbitrum WETH_GATEWAY,42161 0x5598BbFA2f4fE8151f45bBA0a3edE1b54B51a0a9,AaveV3Arbitrum WITHDRAW_SWAP_ADAPTER,42161 +0xF168B83598516A532a85995b52504a2Fa058C068,GhoArbitrum GHO_CCIP_TOKEN_POOL,42161 0xCbFB78a3Eeaa611b826E37c80E4126c8787D29f0,GovernanceV3Arbitrum CROSS_CHAIN_CONTROLLER,42161 0xFF1137243698CaA18EE364Cc966CF0e02A4e6327,GovernanceV3Arbitrum EXECUTOR_LVL_1,42161 0x1A0581dd5C7C3DA4Ba1CDa7e0BcA7286afc4973b,GovernanceV3Arbitrum GOVERNANCE_GUARDIAN,42161 @@ -1789,7 +1791,6 @@ address,name,chainId 0xE3B770Dc4ae3f8bECaB3Ed12dE692c741603e16A,GovernanceV3Arbitrum PC_DATA_HELPER,42161 0xaa944aD95e51CB83C1f35FAEEDfC7d2c31B0BB4d,MiscArbitrum AAVE_CL_ROBOT_OPERATOR,42161 0x3b56998Ec06477704622ca8e2eA1b4db134cec32,MiscArbitrum CREATE_3_FACTORY,42161 -0xF168B83598516A532a85995b52504a2Fa058C068,MiscArbitrum GHO_CCIP_TOKEN_POOL,42161 0x7d9103572bE58FfE99dc390E8246f02dcAe6f611,MiscArbitrum LEGACY_BRIDGE_EXECUTOR,42161 0x9abf798f5314BFd793A9E57A654BEd35af4A1D60,MiscArbitrum PARASWAP_FEE_CLAIMER,42161 0xCb45E82419baeBCC9bA8b1e5c7858e48A3B26Ea6,MiscArbitrum PROTOCOL_GUARDIAN,42161 diff --git a/scripts/clients.ts b/scripts/clients.ts index 6825f666..c36bb40f 100644 --- a/scripts/clients.ts +++ b/scripts/clients.ts @@ -1,73 +1,18 @@ -import {Chain, HttpTransportConfig, createClient, http} from 'viem'; -import { - mainnet, - arbitrum, - polygon, - optimism, - metis, - base, - baseSepolia, - sepolia, - bsc, - avalanche, - gnosis, - polygonZkEvm, - scroll, - celo, - avalancheFuji, - optimismSepolia, - scrollSepolia, - arbitrumSepolia, - // deprecated - harmonyOne, - fantomTestnet, - fantom, - zksync, -} from 'viem/chains'; +import {HttpTransportConfig, createClient, http} from 'viem'; import {Client} from 'viem'; -import {ChainId, getRPCUrl} from '@bgd-labs/rpc-env'; +import {ChainList, getRPCUrl} from '@bgd-labs/rpc-env'; const commonConfig: HttpTransportConfig = {timeout: 30_000, batch: true}; const batchConfig = {batch: {multicall: true}}; -export const CHAIN_ID_CHAIN_MAP: Record = { - [ChainId.mainnet]: mainnet, - [ChainId.sepolia]: sepolia, - [ChainId.optimism]: optimism, - [ChainId.optimism_sepolia]: optimismSepolia, - [ChainId.bnb]: bsc, - [ChainId.gnosis]: gnosis, - [ChainId.polygon]: polygon, - [ChainId.fantom]: fantom, - [ChainId.fantom_testnet]: fantomTestnet, - [ChainId.zksync]: zksync, - [ChainId.metis]: metis, - [ChainId.base]: base, - [ChainId.base_sepolia]: baseSepolia, - [ChainId.arbitrum_one]: arbitrum, - [ChainId.arbitrum_sepolia]: arbitrumSepolia, - [ChainId.avalanche]: avalanche, - [ChainId.fuji]: avalancheFuji, - [ChainId.scroll]: scroll, - [ChainId.scroll_sepolia]: scrollSepolia, - [ChainId.harmony]: harmonyOne, - [ChainId.zkEVM]: polygonZkEvm, - [ChainId.celo]: celo, -}; - const clientCache: Record = {}; export function getClient(chainId: number) { if (!clientCache[chainId]) { - let rpcURL; - try { - rpcURL = getRPCUrl(chainId as any, process.env.ALCHEMY_API_KEY); - } catch (e) { - // if we cannot find an rpc in env we'll pass undefined - // which will select the most reliable public rpc - } + const rpcURL = getRPCUrl(chainId as any, {alchemyKey: process.env.ALCHEMY_API_KEY}); + clientCache[chainId] = createClient({ - chain: CHAIN_ID_CHAIN_MAP[chainId], + chain: ChainList[chainId], transport: http(rpcURL, commonConfig), ...batchConfig, }); diff --git a/scripts/configs/gho/arbitrum.ts b/scripts/configs/gho/arbitrum.ts new file mode 100644 index 00000000..30c03738 --- /dev/null +++ b/scripts/configs/gho/arbitrum.ts @@ -0,0 +1,10 @@ +import {ChainId} from '@bgd-labs/rpc-env'; +import {GhoAddresses} from '../types'; + +export const ghoArbitrum: GhoAddresses = { + name: 'Arbitrum', + chainId: ChainId.arbitrum, + addresses: { + GHO_CCIP_TOKEN_POOL: '0xF168B83598516A532a85995b52504a2Fa058C068', + }, +}; diff --git a/scripts/configs/gho/ethereum.ts b/scripts/configs/gho/ethereum.ts new file mode 100644 index 00000000..fcc3ffe0 --- /dev/null +++ b/scripts/configs/gho/ethereum.ts @@ -0,0 +1,23 @@ +import {ChainId} from '@bgd-labs/rpc-env'; +import {GhoAddresses} from '../types'; + +export const ghoEthereum: GhoAddresses = { + name: 'Ethereum', + chainId: ChainId.mainnet, + addresses: { + GHO_TOKEN: '0x40D16FC0246aD3160Ccc09B8D0D3A2cD28aE6C2f', + GHO_CCIP_TOKEN_POOL: '0x5756880B6a1EAba0175227bf02a7E87c1e02B28C', + GHO_FLASHMINTER_FACILITATOR: '0xb639D208Bcf0589D54FaC24E655C79EC529762B8', + GHO_LIQUIDITY_COMMITTEE: '0xA1c93D2687f7014Aaf588c764E3Ce80aF016229b', + // TODO: perhaps makes sense to create a generator for GSM to automatically pull GSMs, for now let's see how this evolves + GSM_REGISTRY: '0x167527DB01325408696326e3580cd8e55D99Dc1A', + GSM_USDC: '0x0d8eFfC11dF3F229AA1EA0509BC9DFa632A13578', + GSM_USDT: '0x686F8D21520f4ecEc7ba577be08354F4d1EB8262', + GSM_USDC_FEE_STRATEGY: '0xD4478A76aCeA81D3768A0ACB6e38f25eEB6Eb1B5', + GSM_USDT_FEE_STRATEGY: '0xD4478A76aCeA81D3768A0ACB6e38f25eEB6Eb1B5', + GSM_USDC_PRICE_STRATEGY: '0x430BEdcA5DfA6f94d1205Cb33AB4f008D0d9942a', + GSM_USDT_PRICE_STRATEGY: '0x4c707764cbFB4FFa078e169e6b8A6AdbE7526a2c', + GSM_USDC_ORACLE_SWAP_FREEZER: '0xef6beCa8D9543eC007bceA835aF768B58F730C1f', + GSM_USDT_ORACLE_SWAP_FREEZER: '0x71381e6718b37C12155CB961Ca3D374A8BfFa0e5', + }, +}; diff --git a/scripts/configs/governance/arbitrum.ts b/scripts/configs/governance/arbitrum.ts index 1ca94c92..620f3731 100644 --- a/scripts/configs/governance/arbitrum.ts +++ b/scripts/configs/governance/arbitrum.ts @@ -3,7 +3,7 @@ import {GovernanceConfig} from '../types'; export const governanceConfigArbitrum: GovernanceConfig = { name: 'Arbitrum', - CHAIN_ID: ChainId.arbitrum_one, + CHAIN_ID: ChainId.arbitrum, ADDRESSES: { CROSS_CHAIN_CONTROLLER: '0xCbFB78a3Eeaa611b826E37c80E4126c8787D29f0', PAYLOADS_CONTROLLER: '0x89644CA1bB8064760312AE4F03ea41b05dA3637C', diff --git a/scripts/configs/governance/avalanche.ts b/scripts/configs/governance/avalanche.ts index 0c5249e0..1eb2d06a 100644 --- a/scripts/configs/governance/avalanche.ts +++ b/scripts/configs/governance/avalanche.ts @@ -3,7 +3,7 @@ import {GovernanceConfig} from '../types'; export const governanceConfigFuji: GovernanceConfig = { name: 'Fuji', - CHAIN_ID: ChainId.fuji, + CHAIN_ID: ChainId.avalanche_fuji, ADDRESSES: { CROSS_CHAIN_CONTROLLER: '0x5488A48E5C22175548E8d68622211F5928cBbf23', VOTING_MACHINE: '0x79Edd77c76F95b6b69907CaD1d8241F9DB0e3FD0', diff --git a/scripts/configs/networks/arbitrum.ts b/scripts/configs/networks/arbitrum.ts index 2c76c03b..0d286374 100644 --- a/scripts/configs/networks/arbitrum.ts +++ b/scripts/configs/networks/arbitrum.ts @@ -8,7 +8,7 @@ export const arbitrumAddresses: NetworkAddresses<{ LEGACY_BRIDGE_EXECUTOR: Hex; }> = { name: 'Arbitrum', - chainId: ChainId.arbitrum_one, + chainId: ChainId.arbitrum, addresses: { PARASWAP_FEE_CLAIMER: '0x9abf798f5314BFd793A9E57A654BEd35af4A1D60', TRANSPARENT_PROXY_FACTORY: '0x9b643d4ac937bee8bfb1ec76401c22e18c318429', @@ -18,7 +18,6 @@ export const arbitrumAddresses: NetworkAddresses<{ PROTOCOL_GUARDIAN: '0xCb45E82419baeBCC9bA8b1e5c7858e48A3B26Ea6', wstETH_stETH_AGGREGATOR: '0xB1552C5e96B312d0Bf8b554186F846C40614a540', rETH_ETH_AGGREGATOR: '0xF3272CAfe65b190e76caAF483db13424a3e23dD2', - GHO_CCIP_TOKEN_POOL: '0xF168B83598516A532a85995b52504a2Fa058C068', LEGACY_BRIDGE_EXECUTOR: '0x7d9103572bE58FfE99dc390E8246f02dcAe6f611', }, }; diff --git a/scripts/configs/networks/avalanche.ts b/scripts/configs/networks/avalanche.ts index f3ac0779..e1bb4cf8 100644 --- a/scripts/configs/networks/avalanche.ts +++ b/scripts/configs/networks/avalanche.ts @@ -17,7 +17,7 @@ export const avalancheAddresses: NetworkAddresses = { export const avalancheFujiAddresses: NetworkAddresses = { name: 'Fuji', - chainId: ChainId.fuji, + chainId: ChainId.avalanche_fuji, addresses: { GHO_TOKEN: '0x9c04928Cc678776eC1C1C0E46ecC03a5F47A7723', TRANSPARENT_PROXY_FACTORY: '0x5f4d15d761528c57a5C30c43c1DAb26Fc5452731', diff --git a/scripts/configs/networks/ethereum.ts b/scripts/configs/networks/ethereum.ts index 15905919..a990f2cd 100644 --- a/scripts/configs/networks/ethereum.ts +++ b/scripts/configs/networks/ethereum.ts @@ -8,9 +8,6 @@ export const ethereumAddresses: NetworkAddresses<{ PROXY_ADMIN_LONG: Hex; AAVE_SWAPPER: Hex; AAVE_POL_ETH_BRIDGE: Hex; - GSM_REGISTRY: Hex; - GSM_USDC: Hex; - GSM_USDT: Hex; sDAI_POT: Hex; stEUR: Hex; agEUR_EUR_AGGREGATOR: Hex; @@ -35,19 +32,6 @@ export const ethereumAddresses: NetworkAddresses<{ AAVE_CL_ROBOT_OPERATOR: '0x1cDF8879eC8bE012bA959EB515b11008E0cb6323', PROTOCOL_GUARDIAN: '0x2CFe3ec4d5a6811f4B8067F0DE7e47DfA938Aa30', AAVE_MERKLE_DISTRIBUTOR: '0xa88c6D90eAe942291325f9ae3c66f3563B93FE10', - GHO_TOKEN: '0x40D16FC0246aD3160Ccc09B8D0D3A2cD28aE6C2f', - GHO_FLASHMINTER_FACILITATOR: '0xb639D208Bcf0589D54FaC24E655C79EC529762B8', - GHO_CCIP_TOKEN_POOL: '0x5756880B6a1EAba0175227bf02a7E87c1e02B28C', - // TODO: perhaps makes sense to create a generator for GSM to automatically pull GSMs, for now let's see how this evolves - GSM_REGISTRY: '0x167527DB01325408696326e3580cd8e55D99Dc1A', - GSM_USDC: '0x0d8eFfC11dF3F229AA1EA0509BC9DFa632A13578', - GSM_USDT: '0x686F8D21520f4ecEc7ba577be08354F4d1EB8262', - GSM_USDC_FEE_STRATEGY: '0xD4478A76aCeA81D3768A0ACB6e38f25eEB6Eb1B5', - GSM_USDT_FEE_STRATEGY: '0xD4478A76aCeA81D3768A0ACB6e38f25eEB6Eb1B5', - GSM_USDC_PRICE_STRATEGY: '0x430BEdcA5DfA6f94d1205Cb33AB4f008D0d9942a', - GSM_USDT_PRICE_STRATEGY: '0x4c707764cbFB4FFa078e169e6b8A6AdbE7526a2c', - GSM_USDC_ORACLE_SWAP_FREEZER: '0xef6beCa8D9543eC007bceA835aF768B58F730C1f', - GSM_USDT_ORACLE_SWAP_FREEZER: '0x71381e6718b37C12155CB961Ca3D374A8BfFa0e5', sDAI_POT: '0x197E90f9FAD81970bA7976f33CbD77088E5D7cf7', stEUR: '0x004626A008B1aCdC4c74ab51644093b155e59A23', agEUR_EUR_AGGREGATOR: '0xb4d5289C58CE36080b0748B47F859D8F50dFAACb', diff --git a/scripts/configs/pools/arbitrum.ts b/scripts/configs/pools/arbitrum.ts index c6143c4e..362a2c5b 100644 --- a/scripts/configs/pools/arbitrum.ts +++ b/scripts/configs/pools/arbitrum.ts @@ -3,7 +3,7 @@ import {PoolConfig} from '../types'; export const arbitrumProtoV3: PoolConfig = { name: 'Arbitrum', - chainId: ChainId.arbitrum_one, + chainId: ChainId.arbitrum, POOL_ADDRESSES_PROVIDER: '0xa97684ead0e402dC232d5A977953DF7ECBaB3CDb', additionalAddresses: { CAPS_PLUS_RISK_STEWARD: '0xADf86b537eF08591c2777E144322E8b0Ca7E82a7', diff --git a/scripts/configs/pools/avalanche.ts b/scripts/configs/pools/avalanche.ts index 424824d0..1a9c4ec3 100644 --- a/scripts/configs/pools/avalanche.ts +++ b/scripts/configs/pools/avalanche.ts @@ -3,7 +3,7 @@ import {PoolConfig} from '../types'; export const fujiProtoV2: PoolConfig = { name: 'Fuji', - chainId: ChainId.fuji, + chainId: ChainId.avalanche_fuji, POOL_ADDRESSES_PROVIDER: '0x7fdC1FdF79BE3309bf82f4abdAD9f111A6590C0f', additionalAddresses: { FAUCET: '0x90E5BAc5A98fff59617080848959f44eACB4Cd7B', @@ -17,7 +17,7 @@ export const fujiProtoV2: PoolConfig = { export const fujiProtoV3: PoolConfig = { name: 'Fuji', - chainId: ChainId.fuji, + chainId: ChainId.avalanche_fuji, POOL_ADDRESSES_PROVIDER: '0x07D04EfAAA0Ac69D19d107795aF247C42Eb50F1C', additionalAddresses: { CONFIG_ENGINE: '0x4058FE01Aa090E0841F4E08f79D2607C4861142E', diff --git a/scripts/configs/types.ts b/scripts/configs/types.ts index 78923cae..61b32fe5 100644 --- a/scripts/configs/types.ts +++ b/scripts/configs/types.ts @@ -114,17 +114,11 @@ export interface NetworkAddresses = {}> { PROTOCOL_GUARDIAN?: Hex; AAVE_MERKLE_DISTRIBUTOR?: Hex; AAVE_CL_ROBOT_OPERATOR?: Hex; - GHO_TOKEN?: Hex; - GHO_FLASHMINTER_FACILITATOR?: Hex; - GHO_CCIP_TOKEN_POOL?: Hex; - GSM_REGISTRY?: Hex; - GSM_USDC?: Hex; - GSM_USDT?: Hex; - GSM_USDC_FEE_STRATEGY?: Hex; - GSM_USDT_FEE_STRATEGY?: Hex; - GSM_USDC_PRICE_STRATEGY?: Hex; - GSM_USDT_PRICE_STRATEGY?: Hex; - GSM_USDC_ORACLE_SWAP_FREEZER?: Hex; - GSM_USDT_ORACLE_SWAP_FREEZER?: Hex; } & T; } + +export interface GhoAddresses = {}> { + name: string; + chainId: number; + addresses: T; +} diff --git a/scripts/generateAddresses.ts b/scripts/generateAddresses.ts index 15745fce..cf52048d 100644 --- a/scripts/generateAddresses.ts +++ b/scripts/generateAddresses.ts @@ -61,6 +61,9 @@ import {generateTokenList} from './generator/generateTokenList'; import {generateAaveV1} from './generator/protocolV1Generator'; import {governanceConfigZkSync} from './configs/governance/zksync'; import {zkSyncAddresses} from './configs/networks/zksync'; +import {ghoArbitrum} from './configs/gho/arbitrum'; +import {ghoEthereum} from './configs/gho/ethereum'; +import {generateGho} from './generator/ghoGenerator'; async function main() { // cleanup ts artifacts @@ -131,6 +134,7 @@ async function main() { etherFiEthereumMainnetProtoV3Pool, ].map((config) => generateProtocolV3Library(config)), ); + const ghoAddresses = [ghoEthereum, ghoArbitrum].map((config) => generateGho(config)); const tokenListImports = await generateTokenList([...v2LibraryNames, ...v3LibraryNames]); console.log('✅ Tokens list generation finished'); @@ -173,17 +177,12 @@ async function main() { govImports, smImports, tokenListImports, + ghoAddresses, ].flat(); const jsExports = imports.map((f) => f.js).flat(); writeFileSync(`./src/ts/AaveAddressBook.ts`, prefixWithGeneratedWarning('')); jsExports.map((jsExport) => appendFileSync('./src/ts/AaveAddressBook.ts', `${jsExport}\n`)); - - const solidityImports = imports.map((f) => f.solidity).flat(); - - writeFileSync(`./src/AaveAddressBook.sol`, prefixWithGeneratedWarning(prefixWithPragma(''))); - solidityImports.map((solExport) => appendFileSync('./src/AaveAddressBook.sol', solExport)); - console.log('✅ Generation finished'); } diff --git a/scripts/generateSafeCSV.ts b/scripts/generateSafeCSV.ts index 48c84a70..b5dc67d7 100644 --- a/scripts/generateSafeCSV.ts +++ b/scripts/generateSafeCSV.ts @@ -1,8 +1,8 @@ import {writeFileSync} from 'fs'; import {flattenedAddresses} from '../ui/src/utils/getAddresses'; -import {CHAIN_ID_CHAIN_MAP} from './clients'; +import {ChainList} from '@bgd-labs/rpc-env'; -const addresses = flattenedAddresses.filter((item) => !CHAIN_ID_CHAIN_MAP[item.chainId].testnet); +const addresses = flattenedAddresses.filter((item) => !ChainList[item.chainId].testnet); const safe = `address,name,chainId\n${addresses .sort((a, b) => a.chainId! - b.chainId!) diff --git a/scripts/generator/generateTokenList.ts b/scripts/generator/generateTokenList.ts index dc609a2d..7919dc20 100644 --- a/scripts/generator/generateTokenList.ts +++ b/scripts/generator/generateTokenList.ts @@ -10,7 +10,8 @@ import {Address, getContract, Hex, zeroAddress} from 'viem'; import {IERC20Detailed_ABI} from '../../src/ts/abis/IERC20Detailed'; import {fixSymbol} from './assetsLibraryGenerator'; import {getSymbolUri, VARIANT} from './svgUtils'; -import {CHAIN_ID_CHAIN_MAP, getClient} from '../clients'; +import {getClient} from '../clients'; +import {ChainList} from '@bgd-labs/rpc-env'; const TAGS = { underlying: 'underlying', @@ -41,7 +42,7 @@ export async function generateTokenList(pools: TokenListParams) { const tokens: TokenInfo[] = []; for (const {reservesData, chainId, name: poolName, pool} of pools) { - if (CHAIN_ID_CHAIN_MAP[chainId].testnet) continue; + if (ChainList[chainId].testnet) continue; for (const reserve of reservesData) { async function addToken( token: Address, diff --git a/scripts/generator/ghoGenerator.ts b/scripts/generator/ghoGenerator.ts new file mode 100644 index 00000000..db4c3304 --- /dev/null +++ b/scripts/generator/ghoGenerator.ts @@ -0,0 +1,36 @@ +import * as fs from 'fs'; +import {GhoAddresses, NetworkAddresses} from '../configs/types'; +import { + generateJsConstants, + generateSolidityConstants, + prefixWithGeneratedWarning, + prefixWithPragma, + wrapIntoSolidityLibrary, +} from './utils'; + +export function generateGho(config: GhoAddresses) { + const name = `Gho${config.name}`; + + let solidityLibrary = wrapIntoSolidityLibrary( + generateSolidityConstants({chainId: config.chainId, addresses: config.addresses}), + name, + ); + + fs.writeFileSync( + `./src/${name}.sol`, + prefixWithGeneratedWarning(prefixWithPragma(solidityLibrary)), + ); + fs.writeFileSync( + `./src/ts/${name}.ts`, + prefixWithGeneratedWarning( + generateJsConstants({ + chainId: config.chainId, + addresses: {...config.addresses, CHAIN_ID: {value: config.chainId, type: 'uint256'}}, + }).join('\n'), + ), + ); + return { + js: [`export * as ${name} from './${name}';`], + solidity: [`import {${name}} from './${name}.sol';`], + }; +} diff --git a/scripts/generator/utils.ts b/scripts/generator/utils.ts index e03d7619..3669faca 100644 --- a/scripts/generator/utils.ts +++ b/scripts/generator/utils.ts @@ -1,10 +1,10 @@ import {Client, Hex, getAddress, zeroAddress} from 'viem'; import {AddressInfo, Addresses} from '../configs/types'; import {getStorageAt} from 'viem/actions'; -import {CHAIN_ID_CHAIN_MAP} from '../clients'; +import {ChainList} from '@bgd-labs/rpc-env'; function getExplorerLink(chainId: number, address: Hex) { - const chain = CHAIN_ID_CHAIN_MAP[chainId]; + const chain = ChainList[chainId]; let url = chain.blockExplorers?.default.url; if (url && url.endsWith('/')) { url = url.slice(0, -1); // sanitize explorer url diff --git a/src/AaveAddressBook.sol b/src/AaveAddressBook.sol deleted file mode 100644 index 2f76e182..00000000 --- a/src/AaveAddressBook.sol +++ /dev/null @@ -1,67 +0,0 @@ -// AUTOGENERATED - MANUALLY CHANGES WILL BE REVERTED BY THE GENERATOR -// SPDX-License-Identifier: MIT -pragma solidity >=0.6.0; - -import {GovernanceV3Ethereum} from './GovernanceV3Ethereum.sol'; -import {GovernanceV3Arbitrum} from './GovernanceV3Arbitrum.sol'; -import {GovernanceV3Avalanche} from './GovernanceV3Avalanche.sol'; -import {GovernanceV3Fuji} from './GovernanceV3Fuji.sol'; -import {GovernanceV3Optimism} from './GovernanceV3Optimism.sol'; -import {GovernanceV3Polygon} from './GovernanceV3Polygon.sol'; -import {GovernanceV3Metis} from './GovernanceV3Metis.sol'; -import {GovernanceV3Base} from './GovernanceV3Base.sol'; -import {GovernanceV3BNB} from './GovernanceV3BNB.sol'; -import {GovernanceV3Gnosis} from './GovernanceV3Gnosis.sol'; -import {GovernanceV3Scroll} from './GovernanceV3Scroll.sol'; -import {GovernanceV3PolygonZkEvm} from './GovernanceV3PolygonZkEvm.sol'; -import {GovernanceV3ZkSync} from './GovernanceV3ZkSync.sol'; -import {AaveV1} from './AaveV1.sol'; -import {AaveV2EthereumAMM} from './AaveV2EthereumAMM.sol'; -import {AaveV2EthereumArc} from './AaveV2EthereumArc.sol'; -import {AaveV2Ethereum} from './AaveV2Ethereum.sol'; -import {AaveV2Polygon} from './AaveV2Polygon.sol'; -import {AaveV2Fuji} from './AaveV2Fuji.sol'; -import {AaveV2Avalanche} from './AaveV2Avalanche.sol'; -import {AaveV3Ethereum} from './AaveV3Ethereum.sol'; -import {AaveV3Sepolia} from './AaveV3Sepolia.sol'; -import {AaveV3Polygon} from './AaveV3Polygon.sol'; -import {AaveV3Avalanche} from './AaveV3Avalanche.sol'; -import {AaveV3Fuji} from './AaveV3Fuji.sol'; -import {AaveV3Base} from './AaveV3Base.sol'; -import {AaveV3BaseSepolia} from './AaveV3BaseSepolia.sol'; -import {AaveV3BaseSepoliaLido} from './AaveV3BaseSepoliaLido.sol'; -import {AaveV3Metis} from './AaveV3Metis.sol'; -import {AaveV3Gnosis} from './AaveV3Gnosis.sol'; -import {AaveV3BNB} from './AaveV3BNB.sol'; -import {AaveV3Arbitrum} from './AaveV3Arbitrum.sol'; -import {AaveV3ArbitrumSepolia} from './AaveV3ArbitrumSepolia.sol'; -import {AaveV3Optimism} from './AaveV3Optimism.sol'; -import {AaveV3OptimismSepolia} from './AaveV3OptimismSepolia.sol'; -import {AaveV3Scroll} from './AaveV3Scroll.sol'; -import {AaveV3ScrollSepolia} from './AaveV3ScrollSepolia.sol'; -import {AaveV3ZkSync} from './AaveV3ZkSync.sol'; -import {AaveV3FantomTestnet} from './AaveV3FantomTestnet.sol'; -import {AaveV3Fantom} from './AaveV3Fantom.sol'; -import {AaveV3Harmony} from './AaveV3Harmony.sol'; -import {AaveV3EthereumLido} from './AaveV3EthereumLido.sol'; -import {AaveV3EthereumEtherFi} from './AaveV3EthereumEtherFi.sol'; -import {MiscArbitrum} from './MiscArbitrum.sol'; -import {MiscArbitrumSepolia} from './MiscArbitrumSepolia.sol'; -import {MiscAvalanche} from './MiscAvalanche.sol'; -import {MiscFuji} from './MiscFuji.sol'; -import {MiscBase} from './MiscBase.sol'; -import {MiscBaseSepolia} from './MiscBaseSepolia.sol'; -import {MiscEthereum} from './MiscEthereum.sol'; -import {MiscFantom} from './MiscFantom.sol'; -import {MiscOptimism} from './MiscOptimism.sol'; -import {MiscOptimismSepolia} from './MiscOptimismSepolia.sol'; -import {MiscPolygon} from './MiscPolygon.sol'; -import {MiscMetis} from './MiscMetis.sol'; -import {MiscGnosis} from './MiscGnosis.sol'; -import {MiscBNB} from './MiscBNB.sol'; -import {MiscScroll} from './MiscScroll.sol'; -import {MiscPolygonZkEvm} from './MiscPolygonZkEvm.sol'; -import {MiscSepolia} from './MiscSepolia.sol'; -import {MiscZkSync} from './MiscZkSync.sol'; -import {AaveGovernanceV2} from './AaveGovernanceV2.sol'; -import {AaveSafetyModule} from './AaveSafetyModule.sol'; diff --git a/src/GhoArbitrum.sol b/src/GhoArbitrum.sol new file mode 100644 index 00000000..47abccfe --- /dev/null +++ b/src/GhoArbitrum.sol @@ -0,0 +1,8 @@ +// AUTOGENERATED - MANUALLY CHANGES WILL BE REVERTED BY THE GENERATOR +// SPDX-License-Identifier: MIT +pragma solidity >=0.6.0; + +library GhoArbitrum { + // https://arbiscan.io/address/0xF168B83598516A532a85995b52504a2Fa058C068 + address internal constant GHO_CCIP_TOKEN_POOL = 0xF168B83598516A532a85995b52504a2Fa058C068; +} diff --git a/src/GhoEthereum.sol b/src/GhoEthereum.sol new file mode 100644 index 00000000..fc2ea993 --- /dev/null +++ b/src/GhoEthereum.sol @@ -0,0 +1,47 @@ +// AUTOGENERATED - MANUALLY CHANGES WILL BE REVERTED BY THE GENERATOR +// SPDX-License-Identifier: MIT +pragma solidity >=0.6.0; + +library GhoEthereum { + // https://etherscan.io/address/0x40D16FC0246aD3160Ccc09B8D0D3A2cD28aE6C2f + address internal constant GHO_TOKEN = 0x40D16FC0246aD3160Ccc09B8D0D3A2cD28aE6C2f; + + // https://etherscan.io/address/0x5756880B6a1EAba0175227bf02a7E87c1e02B28C + address internal constant GHO_CCIP_TOKEN_POOL = 0x5756880B6a1EAba0175227bf02a7E87c1e02B28C; + + // https://etherscan.io/address/0xb639D208Bcf0589D54FaC24E655C79EC529762B8 + address internal constant GHO_FLASHMINTER_FACILITATOR = + 0xb639D208Bcf0589D54FaC24E655C79EC529762B8; + + // https://etherscan.io/address/0xA1c93D2687f7014Aaf588c764E3Ce80aF016229b + address internal constant GHO_LIQUIDITY_COMMITTEE = 0xA1c93D2687f7014Aaf588c764E3Ce80aF016229b; + + // https://etherscan.io/address/0x167527DB01325408696326e3580cd8e55D99Dc1A + address internal constant GSM_REGISTRY = 0x167527DB01325408696326e3580cd8e55D99Dc1A; + + // https://etherscan.io/address/0x0d8eFfC11dF3F229AA1EA0509BC9DFa632A13578 + address internal constant GSM_USDC = 0x0d8eFfC11dF3F229AA1EA0509BC9DFa632A13578; + + // https://etherscan.io/address/0x686F8D21520f4ecEc7ba577be08354F4d1EB8262 + address internal constant GSM_USDT = 0x686F8D21520f4ecEc7ba577be08354F4d1EB8262; + + // https://etherscan.io/address/0xD4478A76aCeA81D3768A0ACB6e38f25eEB6Eb1B5 + address internal constant GSM_USDC_FEE_STRATEGY = 0xD4478A76aCeA81D3768A0ACB6e38f25eEB6Eb1B5; + + // https://etherscan.io/address/0xD4478A76aCeA81D3768A0ACB6e38f25eEB6Eb1B5 + address internal constant GSM_USDT_FEE_STRATEGY = 0xD4478A76aCeA81D3768A0ACB6e38f25eEB6Eb1B5; + + // https://etherscan.io/address/0x430BEdcA5DfA6f94d1205Cb33AB4f008D0d9942a + address internal constant GSM_USDC_PRICE_STRATEGY = 0x430BEdcA5DfA6f94d1205Cb33AB4f008D0d9942a; + + // https://etherscan.io/address/0x4c707764cbFB4FFa078e169e6b8A6AdbE7526a2c + address internal constant GSM_USDT_PRICE_STRATEGY = 0x4c707764cbFB4FFa078e169e6b8A6AdbE7526a2c; + + // https://etherscan.io/address/0xef6beCa8D9543eC007bceA835aF768B58F730C1f + address internal constant GSM_USDC_ORACLE_SWAP_FREEZER = + 0xef6beCa8D9543eC007bceA835aF768B58F730C1f; + + // https://etherscan.io/address/0x71381e6718b37C12155CB961Ca3D374A8BfFa0e5 + address internal constant GSM_USDT_ORACLE_SWAP_FREEZER = + 0x71381e6718b37C12155CB961Ca3D374A8BfFa0e5; +} diff --git a/src/MiscArbitrum.sol b/src/MiscArbitrum.sol index babcfdd2..a1380836 100644 --- a/src/MiscArbitrum.sol +++ b/src/MiscArbitrum.sol @@ -27,9 +27,6 @@ library MiscArbitrum { // https://arbiscan.io/address/0xF3272CAfe65b190e76caAF483db13424a3e23dD2 address internal constant rETH_ETH_AGGREGATOR = 0xF3272CAfe65b190e76caAF483db13424a3e23dD2; - // https://arbiscan.io/address/0xF168B83598516A532a85995b52504a2Fa058C068 - address internal constant GHO_CCIP_TOKEN_POOL = 0xF168B83598516A532a85995b52504a2Fa058C068; - // https://arbiscan.io/address/0x7d9103572bE58FfE99dc390E8246f02dcAe6f611 address internal constant LEGACY_BRIDGE_EXECUTOR = 0x7d9103572bE58FfE99dc390E8246f02dcAe6f611; } diff --git a/src/MiscEthereum.sol b/src/MiscEthereum.sol index d555836f..15702f74 100644 --- a/src/MiscEthereum.sol +++ b/src/MiscEthereum.sol @@ -42,45 +42,6 @@ library MiscEthereum { // https://etherscan.io/address/0xa88c6D90eAe942291325f9ae3c66f3563B93FE10 address internal constant AAVE_MERKLE_DISTRIBUTOR = 0xa88c6D90eAe942291325f9ae3c66f3563B93FE10; - // https://etherscan.io/address/0x40D16FC0246aD3160Ccc09B8D0D3A2cD28aE6C2f - address internal constant GHO_TOKEN = 0x40D16FC0246aD3160Ccc09B8D0D3A2cD28aE6C2f; - - // https://etherscan.io/address/0xb639D208Bcf0589D54FaC24E655C79EC529762B8 - address internal constant GHO_FLASHMINTER_FACILITATOR = - 0xb639D208Bcf0589D54FaC24E655C79EC529762B8; - - // https://etherscan.io/address/0x5756880B6a1EAba0175227bf02a7E87c1e02B28C - address internal constant GHO_CCIP_TOKEN_POOL = 0x5756880B6a1EAba0175227bf02a7E87c1e02B28C; - - // https://etherscan.io/address/0x167527DB01325408696326e3580cd8e55D99Dc1A - address internal constant GSM_REGISTRY = 0x167527DB01325408696326e3580cd8e55D99Dc1A; - - // https://etherscan.io/address/0x0d8eFfC11dF3F229AA1EA0509BC9DFa632A13578 - address internal constant GSM_USDC = 0x0d8eFfC11dF3F229AA1EA0509BC9DFa632A13578; - - // https://etherscan.io/address/0x686F8D21520f4ecEc7ba577be08354F4d1EB8262 - address internal constant GSM_USDT = 0x686F8D21520f4ecEc7ba577be08354F4d1EB8262; - - // https://etherscan.io/address/0xD4478A76aCeA81D3768A0ACB6e38f25eEB6Eb1B5 - address internal constant GSM_USDC_FEE_STRATEGY = 0xD4478A76aCeA81D3768A0ACB6e38f25eEB6Eb1B5; - - // https://etherscan.io/address/0xD4478A76aCeA81D3768A0ACB6e38f25eEB6Eb1B5 - address internal constant GSM_USDT_FEE_STRATEGY = 0xD4478A76aCeA81D3768A0ACB6e38f25eEB6Eb1B5; - - // https://etherscan.io/address/0x430BEdcA5DfA6f94d1205Cb33AB4f008D0d9942a - address internal constant GSM_USDC_PRICE_STRATEGY = 0x430BEdcA5DfA6f94d1205Cb33AB4f008D0d9942a; - - // https://etherscan.io/address/0x4c707764cbFB4FFa078e169e6b8A6AdbE7526a2c - address internal constant GSM_USDT_PRICE_STRATEGY = 0x4c707764cbFB4FFa078e169e6b8A6AdbE7526a2c; - - // https://etherscan.io/address/0xef6beCa8D9543eC007bceA835aF768B58F730C1f - address internal constant GSM_USDC_ORACLE_SWAP_FREEZER = - 0xef6beCa8D9543eC007bceA835aF768B58F730C1f; - - // https://etherscan.io/address/0x71381e6718b37C12155CB961Ca3D374A8BfFa0e5 - address internal constant GSM_USDT_ORACLE_SWAP_FREEZER = - 0x71381e6718b37C12155CB961Ca3D374A8BfFa0e5; - // https://etherscan.io/address/0x197E90f9FAD81970bA7976f33CbD77088E5D7cf7 address internal constant sDAI_POT = 0x197E90f9FAD81970bA7976f33CbD77088E5D7cf7; diff --git a/src/test/AaveV2Ethereum.t.sol b/src/test/AaveV2Ethereum.t.sol index cf39927e..6101904b 100644 --- a/src/test/AaveV2Ethereum.t.sol +++ b/src/test/AaveV2Ethereum.t.sol @@ -2,7 +2,7 @@ pragma solidity >=0.6.0; import 'forge-std/Test.sol'; -import {AaveV2Ethereum} from '../AaveAddressBook.sol'; +import {AaveV2Ethereum} from '../AaveV2Ethereum.sol'; // imports are unused but required so forge inspect can find the source code import {IERC20Detailed} from 'aave-v3-origin/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol'; import {IWithGuardian} from 'solidity-utils/contracts/access-control/interfaces/IWithGuardian.sol'; diff --git a/src/test/AaveV2Misfits.t.sol b/src/test/AaveV2Misfits.t.sol index e509fd68..79793ea6 100644 --- a/src/test/AaveV2Misfits.t.sol +++ b/src/test/AaveV2Misfits.t.sol @@ -2,7 +2,9 @@ pragma solidity >=0.6.0; import 'forge-std/Test.sol'; -import {AaveV2Avalanche, AaveV2Polygon, AaveV2EthereumArc} from '../AaveAddressBook.sol'; +import {AaveV2Avalanche} from '../AaveV2Avalanche.sol'; +import {AaveV2Polygon} from '../AaveV2Polygon.sol'; +import {AaveV2EthereumArc} from '../AaveV2EthereumArc.sol'; /** * @dev This test contains regression tests for markets that are slightly different then the default. diff --git a/src/test/AaveV3Avalanche.t.sol b/src/test/AaveV3Avalanche.t.sol index 23772e78..53fbdf00 100644 --- a/src/test/AaveV3Avalanche.t.sol +++ b/src/test/AaveV3Avalanche.t.sol @@ -2,7 +2,7 @@ pragma solidity >=0.6.0; import 'forge-std/Test.sol'; -import {AaveV3Avalanche} from '../AaveAddressBook.sol'; +import {AaveV3Avalanche} from '../AaveV3Avalanche.sol'; import {IAaveProtocolDataProvider, IPoolDataProvider} from '../AaveV3.sol'; contract AaveAddressBookTest is Test { diff --git a/src/ts/AaveAddressBook.ts b/src/ts/AaveAddressBook.ts index 5e49dc70..e0a92e40 100644 --- a/src/ts/AaveAddressBook.ts +++ b/src/ts/AaveAddressBook.ts @@ -62,3 +62,5 @@ export * as MiscSepolia from './MiscSepolia'; export * as MiscZkSync from './MiscZkSync'; export * as AaveGovernanceV2 from './AaveGovernanceV2'; export * as AaveSafetyModule from './AaveSafetyModule'; +export * as GhoEthereum from './GhoEthereum'; +export * as GhoArbitrum from './GhoArbitrum'; diff --git a/src/ts/GhoArbitrum.ts b/src/ts/GhoArbitrum.ts new file mode 100644 index 00000000..c85454d4 --- /dev/null +++ b/src/ts/GhoArbitrum.ts @@ -0,0 +1,5 @@ +// AUTOGENERATED - MANUALLY CHANGES WILL BE REVERTED BY THE GENERATOR +// https://arbiscan.io/address/0xF168B83598516A532a85995b52504a2Fa058C068 +export const GHO_CCIP_TOKEN_POOL = '0xF168B83598516A532a85995b52504a2Fa058C068'; + +export const CHAIN_ID = 42161; diff --git a/src/ts/GhoEthereum.ts b/src/ts/GhoEthereum.ts new file mode 100644 index 00000000..4daccfb8 --- /dev/null +++ b/src/ts/GhoEthereum.ts @@ -0,0 +1,41 @@ +// AUTOGENERATED - MANUALLY CHANGES WILL BE REVERTED BY THE GENERATOR +// https://etherscan.io/address/0x40D16FC0246aD3160Ccc09B8D0D3A2cD28aE6C2f +export const GHO_TOKEN = '0x40D16FC0246aD3160Ccc09B8D0D3A2cD28aE6C2f'; + +// https://etherscan.io/address/0x5756880B6a1EAba0175227bf02a7E87c1e02B28C +export const GHO_CCIP_TOKEN_POOL = '0x5756880B6a1EAba0175227bf02a7E87c1e02B28C'; + +// https://etherscan.io/address/0xb639D208Bcf0589D54FaC24E655C79EC529762B8 +export const GHO_FLASHMINTER_FACILITATOR = '0xb639D208Bcf0589D54FaC24E655C79EC529762B8'; + +// https://etherscan.io/address/0xA1c93D2687f7014Aaf588c764E3Ce80aF016229b +export const GHO_LIQUIDITY_COMMITTEE = '0xA1c93D2687f7014Aaf588c764E3Ce80aF016229b'; + +// https://etherscan.io/address/0x167527DB01325408696326e3580cd8e55D99Dc1A +export const GSM_REGISTRY = '0x167527DB01325408696326e3580cd8e55D99Dc1A'; + +// https://etherscan.io/address/0x0d8eFfC11dF3F229AA1EA0509BC9DFa632A13578 +export const GSM_USDC = '0x0d8eFfC11dF3F229AA1EA0509BC9DFa632A13578'; + +// https://etherscan.io/address/0x686F8D21520f4ecEc7ba577be08354F4d1EB8262 +export const GSM_USDT = '0x686F8D21520f4ecEc7ba577be08354F4d1EB8262'; + +// https://etherscan.io/address/0xD4478A76aCeA81D3768A0ACB6e38f25eEB6Eb1B5 +export const GSM_USDC_FEE_STRATEGY = '0xD4478A76aCeA81D3768A0ACB6e38f25eEB6Eb1B5'; + +// https://etherscan.io/address/0xD4478A76aCeA81D3768A0ACB6e38f25eEB6Eb1B5 +export const GSM_USDT_FEE_STRATEGY = '0xD4478A76aCeA81D3768A0ACB6e38f25eEB6Eb1B5'; + +// https://etherscan.io/address/0x430BEdcA5DfA6f94d1205Cb33AB4f008D0d9942a +export const GSM_USDC_PRICE_STRATEGY = '0x430BEdcA5DfA6f94d1205Cb33AB4f008D0d9942a'; + +// https://etherscan.io/address/0x4c707764cbFB4FFa078e169e6b8A6AdbE7526a2c +export const GSM_USDT_PRICE_STRATEGY = '0x4c707764cbFB4FFa078e169e6b8A6AdbE7526a2c'; + +// https://etherscan.io/address/0xef6beCa8D9543eC007bceA835aF768B58F730C1f +export const GSM_USDC_ORACLE_SWAP_FREEZER = '0xef6beCa8D9543eC007bceA835aF768B58F730C1f'; + +// https://etherscan.io/address/0x71381e6718b37C12155CB961Ca3D374A8BfFa0e5 +export const GSM_USDT_ORACLE_SWAP_FREEZER = '0x71381e6718b37C12155CB961Ca3D374A8BfFa0e5'; + +export const CHAIN_ID = 1; diff --git a/src/ts/MiscArbitrum.ts b/src/ts/MiscArbitrum.ts index 0aa6c2be..d09ac114 100644 --- a/src/ts/MiscArbitrum.ts +++ b/src/ts/MiscArbitrum.ts @@ -23,9 +23,6 @@ export const wstETH_stETH_AGGREGATOR = '0xB1552C5e96B312d0Bf8b554186F846C40614a5 // https://arbiscan.io/address/0xF3272CAfe65b190e76caAF483db13424a3e23dD2 export const rETH_ETH_AGGREGATOR = '0xF3272CAfe65b190e76caAF483db13424a3e23dD2'; -// https://arbiscan.io/address/0xF168B83598516A532a85995b52504a2Fa058C068 -export const GHO_CCIP_TOKEN_POOL = '0xF168B83598516A532a85995b52504a2Fa058C068'; - // https://arbiscan.io/address/0x7d9103572bE58FfE99dc390E8246f02dcAe6f611 export const LEGACY_BRIDGE_EXECUTOR = '0x7d9103572bE58FfE99dc390E8246f02dcAe6f611'; diff --git a/src/ts/MiscEthereum.ts b/src/ts/MiscEthereum.ts index 378fd1e1..9d7e2654 100644 --- a/src/ts/MiscEthereum.ts +++ b/src/ts/MiscEthereum.ts @@ -35,42 +35,6 @@ export const PROTOCOL_GUARDIAN = '0x2CFe3ec4d5a6811f4B8067F0DE7e47DfA938Aa30'; // https://etherscan.io/address/0xa88c6D90eAe942291325f9ae3c66f3563B93FE10 export const AAVE_MERKLE_DISTRIBUTOR = '0xa88c6D90eAe942291325f9ae3c66f3563B93FE10'; -// https://etherscan.io/address/0x40D16FC0246aD3160Ccc09B8D0D3A2cD28aE6C2f -export const GHO_TOKEN = '0x40D16FC0246aD3160Ccc09B8D0D3A2cD28aE6C2f'; - -// https://etherscan.io/address/0xb639D208Bcf0589D54FaC24E655C79EC529762B8 -export const GHO_FLASHMINTER_FACILITATOR = '0xb639D208Bcf0589D54FaC24E655C79EC529762B8'; - -// https://etherscan.io/address/0x5756880B6a1EAba0175227bf02a7E87c1e02B28C -export const GHO_CCIP_TOKEN_POOL = '0x5756880B6a1EAba0175227bf02a7E87c1e02B28C'; - -// https://etherscan.io/address/0x167527DB01325408696326e3580cd8e55D99Dc1A -export const GSM_REGISTRY = '0x167527DB01325408696326e3580cd8e55D99Dc1A'; - -// https://etherscan.io/address/0x0d8eFfC11dF3F229AA1EA0509BC9DFa632A13578 -export const GSM_USDC = '0x0d8eFfC11dF3F229AA1EA0509BC9DFa632A13578'; - -// https://etherscan.io/address/0x686F8D21520f4ecEc7ba577be08354F4d1EB8262 -export const GSM_USDT = '0x686F8D21520f4ecEc7ba577be08354F4d1EB8262'; - -// https://etherscan.io/address/0xD4478A76aCeA81D3768A0ACB6e38f25eEB6Eb1B5 -export const GSM_USDC_FEE_STRATEGY = '0xD4478A76aCeA81D3768A0ACB6e38f25eEB6Eb1B5'; - -// https://etherscan.io/address/0xD4478A76aCeA81D3768A0ACB6e38f25eEB6Eb1B5 -export const GSM_USDT_FEE_STRATEGY = '0xD4478A76aCeA81D3768A0ACB6e38f25eEB6Eb1B5'; - -// https://etherscan.io/address/0x430BEdcA5DfA6f94d1205Cb33AB4f008D0d9942a -export const GSM_USDC_PRICE_STRATEGY = '0x430BEdcA5DfA6f94d1205Cb33AB4f008D0d9942a'; - -// https://etherscan.io/address/0x4c707764cbFB4FFa078e169e6b8A6AdbE7526a2c -export const GSM_USDT_PRICE_STRATEGY = '0x4c707764cbFB4FFa078e169e6b8A6AdbE7526a2c'; - -// https://etherscan.io/address/0xef6beCa8D9543eC007bceA835aF768B58F730C1f -export const GSM_USDC_ORACLE_SWAP_FREEZER = '0xef6beCa8D9543eC007bceA835aF768B58F730C1f'; - -// https://etherscan.io/address/0x71381e6718b37C12155CB961Ca3D374A8BfFa0e5 -export const GSM_USDT_ORACLE_SWAP_FREEZER = '0x71381e6718b37C12155CB961Ca3D374A8BfFa0e5'; - // https://etherscan.io/address/0x197E90f9FAD81970bA7976f33CbD77088E5D7cf7 export const sDAI_POT = '0x197E90f9FAD81970bA7976f33CbD77088E5D7cf7'; diff --git a/tests/verification.spec.ts b/tests/verification.spec.ts index 6cd98e71..cd008d59 100644 --- a/tests/verification.spec.ts +++ b/tests/verification.spec.ts @@ -1,6 +1,5 @@ -import {ChainId} from '@bgd-labs/rpc-env'; +import {ChainId, ChainList} from '@bgd-labs/rpc-env'; import {describe, expect, it} from 'vitest'; -import {CHAIN_ID_CHAIN_MAP} from '../scripts/clients'; import {flattenedAddresses, ListItem} from '../ui/src/utils/getAddresses'; import verified from './cache/verified.json'; import {writeFileSync} from 'fs'; @@ -99,7 +98,7 @@ describe( const addressesToCheck = flattenedAddresses.filter( (item) => ![ChainId.harmony, ChainId.fantom].includes(item.chainId as any) && - !CHAIN_ID_CHAIN_MAP[item.chainId].testnet, + !ChainList[item.chainId].testnet, ); const errors: {item: ListItem}[] = []; let newVerified = false; diff --git a/tokenlist.json b/tokenlist.json index d261e14c..e0f3ab26 100644 --- a/tokenlist.json +++ b/tokenlist.json @@ -2826,7 +2826,8 @@ "name": "rsETH", "decimals": 18, "symbol": "rsETH", - "tags": ["underlying"] + "tags": ["underlying"], + "logoURI": "https://raw.githubusercontent.com/bgd-labs/web3-icons/main/icons/full/rseth.svg" }, { "chainId": 1, @@ -2835,6 +2836,7 @@ "decimals": 18, "symbol": "aEthrsETH", "tags": ["aTokenV3", "aaveV3"], + "logoURI": "https://raw.githubusercontent.com/bgd-labs/web3-icons/main/icons/full/arseth.svg", "extensions": { "pool": "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2", "underlying": "0xA1290d69c65A6Fe4DF752f95823fae25cB99e5A7" @@ -6304,8 +6306,7 @@ "name": "Frapped USDT", "decimals": 6, "symbol": "fUSDT", - "tags": ["underlying"], - "logoURI": "https://raw.githubusercontent.com/bgd-labs/web3-icons/main/icons/full/usdt.svg" + "tags": ["underlying"] }, { "chainId": 250, @@ -6314,7 +6315,6 @@ "decimals": 6, "symbol": "aFanUSDT", "tags": ["aTokenV3", "aaveV3"], - "logoURI": "https://raw.githubusercontent.com/bgd-labs/web3-icons/main/icons/full/ausdt.svg", "extensions": { "pool": "0x794a61358D6845594F94dc1DB02A252b5b4814aD", "underlying": "0x049d68029688eAbF473097a2fC38ef61633A3C7A" @@ -6724,6 +6724,6 @@ } } ], - "version": { "major": 3, "minor": 0, "patch": 60 }, - "timestamp": "2024-11-21T12:03:58.811Z" + "version": { "major": 3, "minor": 0, "patch": 61 }, + "timestamp": "2024-11-22T09:58:33.514Z" } diff --git a/ui/package.json b/ui/package.json index be359945..ba7da972 100644 --- a/ui/package.json +++ b/ui/package.json @@ -9,8 +9,9 @@ "lint": "next lint" }, "dependencies": { - "@bgd-labs/react-web3-icons": "^1.4.7", - "@leeoniya/ufuzzy": "^1.0.14", + "@bgd-labs/react-web3-icons": "^1.7.2", + "@bgd-labs/rpc-env": "^2.1.2", + "@leeoniya/ufuzzy": "^1.0.16", "clsx": "^2.1.1", "next": "14.2.7", "react": "^18", diff --git a/ui/src/app/page.tsx b/ui/src/app/page.tsx index 07f63b34..83aeef2e 100644 --- a/ui/src/app/page.tsx +++ b/ui/src/app/page.tsx @@ -1,8 +1,8 @@ import { Suspense } from 'react'; import { flattenedAddresses } from '../utils/getAddresses'; -import { CHAIN_ID_CHAIN_MAP } from '../../../scripts/clients'; import Image from 'next/image'; import { Search } from '@/components/Search'; +import { ChainList } from '@bgd-labs/rpc-env'; import { SearchSkeleton } from '@/components/SearchSkeleton'; import { Footer } from '@/components/Footer'; import logo from '@/assets/logo.svg'; @@ -31,7 +31,7 @@ const TAG_MAP: Record = { const addresses = flattenedAddresses.map((item) => ({ ...item, - link: `${CHAIN_ID_CHAIN_MAP[item.chainId]?.blockExplorers?.default.url.replace(/\/$/, '')}/address/${item.value}`, + link: `${ChainList[item.chainId as keyof typeof ChainList]?.blockExplorers?.default.url.replace(/\/$/, '')}/address/${item.value}`, searchPath: [ ...item.path, item.value, @@ -40,8 +40,8 @@ const addresses = flattenedAddresses.map((item) => ({ })); const sortedAddresses = addresses.sort((a, b) => { - const aInProduction = !CHAIN_ID_CHAIN_MAP[a.chainId].testnet; - const bInProduction = !CHAIN_ID_CHAIN_MAP[b.chainId].testnet; + const aInProduction = !ChainList[a.chainId as keyof typeof ChainList].testnet; + const bInProduction = !ChainList[b.chainId as keyof typeof ChainList].testnet; if (aInProduction && !bInProduction) { return -1;