From 937b958af85b210f186959d5785b0089a650a755 Mon Sep 17 00:00:00 2001 From: Lukas Date: Wed, 27 Nov 2024 06:34:22 +0100 Subject: [PATCH] feat: add bridges (#718) --- lefthook.yml | 15 +++ package-lock.json | 153 +++++++++++++++++++++++++++ package.json | 3 +- safe.csv | 2 + scripts/configs/networks/arbitrum.ts | 2 + scripts/configs/networks/optimism.ts | 2 + src/MiscArbitrum.sol | 3 + src/MiscOptimism.sol | 3 + src/ts/MiscArbitrum.ts | 3 + src/ts/MiscOptimism.ts | 3 + tests/cache/verified.json | 27 +++++ tests/setup.ts | 1 + vitest.config.ts | 7 ++ 13 files changed, 223 insertions(+), 1 deletion(-) create mode 100644 lefthook.yml create mode 100644 tests/setup.ts create mode 100644 vitest.config.ts diff --git a/lefthook.yml b/lefthook.yml new file mode 100644 index 00000000..b380e14b --- /dev/null +++ b/lefthook.yml @@ -0,0 +1,15 @@ +pre-commit: + parallel: false + commands: + generate: + priority: 1 + run: npm run generate:addresses + stage_fixed: true + test: + priority: 2 + run: npm run test + stage_fixed: true + format: + priority: 3 + run: npm run prettier + stage_fixed: true diff --git a/package-lock.json b/package-lock.json index ccd33a53..0f90bff8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,6 +20,7 @@ "ajv-formats": "^3.0.1", "dotenv": "^16.4.1", "esbuild-plugin-file-path-extensions": "^2.0.0", + "lefthook": "^1.8.4", "prettier": "^3.0.3", "prettier-plugin-solidity": "^1.1.3", "tsup": "^8.0.2", @@ -4112,6 +4113,158 @@ "node": ">=0.10" } }, + "node_modules/lefthook": { + "version": "1.8.4", + "resolved": "https://registry.npmjs.org/lefthook/-/lefthook-1.8.4.tgz", + "integrity": "sha512-XNyMaTWNRuADOaocYiHidgNkNDz8SCekpdNJ7lqceFcBT2zjumnb28/o7IMaNROpLBZdQkLkJXSeaQWGqn3kog==", + "dev": true, + "hasInstallScript": true, + "bin": { + "lefthook": "bin/index.js" + }, + "optionalDependencies": { + "lefthook-darwin-arm64": "1.8.4", + "lefthook-darwin-x64": "1.8.4", + "lefthook-freebsd-arm64": "1.8.4", + "lefthook-freebsd-x64": "1.8.4", + "lefthook-linux-arm64": "1.8.4", + "lefthook-linux-x64": "1.8.4", + "lefthook-openbsd-arm64": "1.8.4", + "lefthook-openbsd-x64": "1.8.4", + "lefthook-windows-arm64": "1.8.4", + "lefthook-windows-x64": "1.8.4" + } + }, + "node_modules/lefthook-darwin-arm64": { + "version": "1.8.4", + "resolved": "https://registry.npmjs.org/lefthook-darwin-arm64/-/lefthook-darwin-arm64-1.8.4.tgz", + "integrity": "sha512-OS5MsU0gvd8LYSpuQCHtmDUqwNrJ/LjCO0LGC1wNepY4OkuVl9DfX+rQ506CVUQYZiGVcwy2/qPOOBjNzA5+wQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/lefthook-darwin-x64": { + "version": "1.8.4", + "resolved": "https://registry.npmjs.org/lefthook-darwin-x64/-/lefthook-darwin-x64-1.8.4.tgz", + "integrity": "sha512-QLRsqK9aTMRcVW8qz4pzI2OWnGCEcaEPJlIiFjwstYsS+wfkooxOS0UkfVMjy+QoGgEcki+cxF/FoY7lE7DDtw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/lefthook-freebsd-arm64": { + "version": "1.8.4", + "resolved": "https://registry.npmjs.org/lefthook-freebsd-arm64/-/lefthook-freebsd-arm64-1.8.4.tgz", + "integrity": "sha512-chnQ1m/Cmn9c0sLdk5HL2SToE5LBJv5uQMdH1IGRRcw+nEqWqrMnDXvM75caiJAyjmUGvPH3czKTJDzTFV1E+A==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/lefthook-freebsd-x64": { + "version": "1.8.4", + "resolved": "https://registry.npmjs.org/lefthook-freebsd-x64/-/lefthook-freebsd-x64-1.8.4.tgz", + "integrity": "sha512-KQi+WBUdnGLnK0rHOR58kbMH5TDVN1ZjZLu66Pv9FCG7Y7shR1qtaTXu+wmxdRhMvaLeQIXRsUEPjNRC66yMmA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/lefthook-linux-arm64": { + "version": "1.8.4", + "resolved": "https://registry.npmjs.org/lefthook-linux-arm64/-/lefthook-linux-arm64-1.8.4.tgz", + "integrity": "sha512-CXNcqIskLwTwQARidGdFqmNxpvOU3jsWPK4KA7pq2+QmlWJ64w98ebMvNBoUmRUCXqzmUm7Udf/jpfz2fobewQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/lefthook-linux-x64": { + "version": "1.8.4", + "resolved": "https://registry.npmjs.org/lefthook-linux-x64/-/lefthook-linux-x64-1.8.4.tgz", + "integrity": "sha512-pVNITkFBxUCEtamWSM/res2Gd48+m9YKbNyIBndAuZVC5pKV5aGKZy2DNq6PWUPYiUDPx+7hoAtCJg/tlAiqhw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/lefthook-openbsd-arm64": { + "version": "1.8.4", + "resolved": "https://registry.npmjs.org/lefthook-openbsd-arm64/-/lefthook-openbsd-arm64-1.8.4.tgz", + "integrity": "sha512-l+i/Dg5X36kYzhpMGSPE3rMbWy1KSytbLB9lY1PmxYb6LRH6iQTYIoxvLabVUwSBPSq8HtIFa50+bvC5+scfVA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "openbsd" + ] + }, + "node_modules/lefthook-openbsd-x64": { + "version": "1.8.4", + "resolved": "https://registry.npmjs.org/lefthook-openbsd-x64/-/lefthook-openbsd-x64-1.8.4.tgz", + "integrity": "sha512-CqhDDPPX8oHzMLgNi/Reba823DRzj+eMNWQ8axvSiIG+zmG1w20xZH5QSs/mD3tjrND90yfDd90mWMt181qPyA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "openbsd" + ] + }, + "node_modules/lefthook-windows-arm64": { + "version": "1.8.4", + "resolved": "https://registry.npmjs.org/lefthook-windows-arm64/-/lefthook-windows-arm64-1.8.4.tgz", + "integrity": "sha512-dvpvorICmVjmw29Aiczg7DcaSzkd86bEBomiGq4UsAEk3+7ExLrlWJDLFsI6xLjMKmTxy+F7eXb2uDtuFC1N4g==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/lefthook-windows-x64": { + "version": "1.8.4", + "resolved": "https://registry.npmjs.org/lefthook-windows-x64/-/lefthook-windows-x64-1.8.4.tgz", + "integrity": "sha512-e+y8Jt4/7PnoplhOuK48twjGVJEsU4T3J5kxD4mWfl6Cbit0YSn4bme9nW41eqCqTUqOm+ky29XlfnPHFX5ZNA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] + }, "node_modules/levn": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", diff --git a/package.json b/package.json index 9fb4c5bd..76382ed0 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "generate:addresses": "tsx scripts/generateAddresses.ts && npm run generate:safe && npm run prettier", "start": "tsx scripts/generateABIs.ts && tsx scripts/generateAddresses.ts && npm run prettier", "build": "tsup", - "test": "vitest tests", + "test": "vitest run tests", "prepublishOnly": "npm run build" }, "repository": { @@ -86,6 +86,7 @@ "ajv-formats": "^3.0.1", "dotenv": "^16.4.1", "esbuild-plugin-file-path-extensions": "^2.0.0", + "lefthook": "^1.8.4", "prettier": "^3.0.3", "prettier-plugin-solidity": "^1.1.3", "tsup": "^8.0.2", diff --git a/safe.csv b/safe.csv index 0a14ff95..15fe29e2 100644 --- a/safe.csv +++ b/safe.csv @@ -909,6 +909,7 @@ address,name,chainId 0xE3B770Dc4ae3f8bECaB3Ed12dE692c741603e16A,GovernanceV3Optimism PC_DATA_HELPER,10 0x55Cf9583D7D30DC4936bAee1f747591dBECe5df7,MiscOptimism AAVE_CL_ROBOT_OPERATOR,10 0x1685D81212580DD4cDA287616C2f6F4794927e18,MiscOptimism AAVE_MERKLE_DISTRIBUTOR,10 +0xc3250A20F8a7BbDd23adE87737EE46A45Fe5543E,MiscOptimism AAVE_OPT_ETH_BRIDGE,10 0x3b56998Ec06477704622ca8e2eA1b4db134cec32,MiscOptimism CREATE_3_FACTORY,10 0x7d9103572bE58FfE99dc390E8246f02dcAe6f611,MiscOptimism LEGACY_BRIDGE_EXECUTOR,10 0x9abf798f5314BFd793A9E57A654BEd35af4A1D60,MiscOptimism PARASWAP_FEE_CLAIMER,10 @@ -1789,6 +1790,7 @@ address,name,chainId 0x4922093c476CfbCF903C7C4082d2D64bAE8A37cE,GovernanceV3Arbitrum GRANULAR_GUARDIAN,42161 0x89644CA1bB8064760312AE4F03ea41b05dA3637C,GovernanceV3Arbitrum PAYLOADS_CONTROLLER,42161 0xE3B770Dc4ae3f8bECaB3Ed12dE692c741603e16A,GovernanceV3Arbitrum PC_DATA_HELPER,42161 +0x0335ffa9af5CE05590d6C9A75B645470e07744a9,MiscArbitrum AAVE_ARB_ETH_BRIDGE,42161 0xaa944aD95e51CB83C1f35FAEEDfC7d2c31B0BB4d,MiscArbitrum AAVE_CL_ROBOT_OPERATOR,42161 0x3b56998Ec06477704622ca8e2eA1b4db134cec32,MiscArbitrum CREATE_3_FACTORY,42161 0x7d9103572bE58FfE99dc390E8246f02dcAe6f611,MiscArbitrum LEGACY_BRIDGE_EXECUTOR,42161 diff --git a/scripts/configs/networks/arbitrum.ts b/scripts/configs/networks/arbitrum.ts index 0d286374..b54ff288 100644 --- a/scripts/configs/networks/arbitrum.ts +++ b/scripts/configs/networks/arbitrum.ts @@ -6,6 +6,7 @@ export const arbitrumAddresses: NetworkAddresses<{ wstETH_stETH_AGGREGATOR: Hex; rETH_ETH_AGGREGATOR: Hex; LEGACY_BRIDGE_EXECUTOR: Hex; + AAVE_ARB_ETH_BRIDGE: Hex; }> = { name: 'Arbitrum', chainId: ChainId.arbitrum, @@ -19,6 +20,7 @@ export const arbitrumAddresses: NetworkAddresses<{ wstETH_stETH_AGGREGATOR: '0xB1552C5e96B312d0Bf8b554186F846C40614a540', rETH_ETH_AGGREGATOR: '0xF3272CAfe65b190e76caAF483db13424a3e23dD2', LEGACY_BRIDGE_EXECUTOR: '0x7d9103572bE58FfE99dc390E8246f02dcAe6f611', + AAVE_ARB_ETH_BRIDGE: '0x0335ffa9af5CE05590d6C9A75B645470e07744a9', }, }; diff --git a/scripts/configs/networks/optimism.ts b/scripts/configs/networks/optimism.ts index ab5ea955..e5c6c2ab 100644 --- a/scripts/configs/networks/optimism.ts +++ b/scripts/configs/networks/optimism.ts @@ -6,6 +6,7 @@ export const optimismAddresses: NetworkAddresses<{ wstETH_stETH_AGGREGATOR: Hex; rETH_ETH_AGGREGATOR: Hex; LEGACY_BRIDGE_EXECUTOR: Hex; + AAVE_OPT_ETH_BRIDGE: Hex; }> = { name: 'Optimism', chainId: ChainId.optimism, @@ -20,6 +21,7 @@ export const optimismAddresses: NetworkAddresses<{ wstETH_stETH_AGGREGATOR: '0xe59EBa0D492cA53C6f46015EEa00517F2707dc77', rETH_ETH_AGGREGATOR: '0x22F3727be377781d1579B7C9222382b21c9d1a8f', LEGACY_BRIDGE_EXECUTOR: '0x7d9103572bE58FfE99dc390E8246f02dcAe6f611', + AAVE_OPT_ETH_BRIDGE: '0xc3250A20F8a7BbDd23adE87737EE46A45Fe5543E', }, }; diff --git a/src/MiscArbitrum.sol b/src/MiscArbitrum.sol index a1380836..240f3a31 100644 --- a/src/MiscArbitrum.sol +++ b/src/MiscArbitrum.sol @@ -29,4 +29,7 @@ library MiscArbitrum { // https://arbiscan.io/address/0x7d9103572bE58FfE99dc390E8246f02dcAe6f611 address internal constant LEGACY_BRIDGE_EXECUTOR = 0x7d9103572bE58FfE99dc390E8246f02dcAe6f611; + + // https://arbiscan.io/address/0x0335ffa9af5CE05590d6C9A75B645470e07744a9 + address internal constant AAVE_ARB_ETH_BRIDGE = 0x0335ffa9af5CE05590d6C9A75B645470e07744a9; } diff --git a/src/MiscOptimism.sol b/src/MiscOptimism.sol index c917ca97..c4f4f636 100644 --- a/src/MiscOptimism.sol +++ b/src/MiscOptimism.sol @@ -32,4 +32,7 @@ library MiscOptimism { // https://optimistic.etherscan.io/address/0x7d9103572bE58FfE99dc390E8246f02dcAe6f611 address internal constant LEGACY_BRIDGE_EXECUTOR = 0x7d9103572bE58FfE99dc390E8246f02dcAe6f611; + + // https://optimistic.etherscan.io/address/0xc3250A20F8a7BbDd23adE87737EE46A45Fe5543E + address internal constant AAVE_OPT_ETH_BRIDGE = 0xc3250A20F8a7BbDd23adE87737EE46A45Fe5543E; } diff --git a/src/ts/MiscArbitrum.ts b/src/ts/MiscArbitrum.ts index d09ac114..e2a15580 100644 --- a/src/ts/MiscArbitrum.ts +++ b/src/ts/MiscArbitrum.ts @@ -26,4 +26,7 @@ export const rETH_ETH_AGGREGATOR = '0xF3272CAfe65b190e76caAF483db13424a3e23dD2'; // https://arbiscan.io/address/0x7d9103572bE58FfE99dc390E8246f02dcAe6f611 export const LEGACY_BRIDGE_EXECUTOR = '0x7d9103572bE58FfE99dc390E8246f02dcAe6f611'; +// https://arbiscan.io/address/0x0335ffa9af5CE05590d6C9A75B645470e07744a9 +export const AAVE_ARB_ETH_BRIDGE = '0x0335ffa9af5CE05590d6C9A75B645470e07744a9'; + export const CHAIN_ID = 42161; diff --git a/src/ts/MiscOptimism.ts b/src/ts/MiscOptimism.ts index 92237501..93a2abd9 100644 --- a/src/ts/MiscOptimism.ts +++ b/src/ts/MiscOptimism.ts @@ -29,4 +29,7 @@ export const rETH_ETH_AGGREGATOR = '0x22F3727be377781d1579B7C9222382b21c9d1a8f'; // https://optimistic.etherscan.io/address/0x7d9103572bE58FfE99dc390E8246f02dcAe6f611 export const LEGACY_BRIDGE_EXECUTOR = '0x7d9103572bE58FfE99dc390E8246f02dcAe6f611'; +// https://optimistic.etherscan.io/address/0xc3250A20F8a7BbDd23adE87737EE46A45Fe5543E +export const AAVE_OPT_ETH_BRIDGE = '0xc3250A20F8a7BbDd23adE87737EE46A45Fe5543E'; + export const CHAIN_ID = 10; diff --git a/tests/cache/verified.json b/tests/cache/verified.json index 909c4ce4..20a96a47 100644 --- a/tests/cache/verified.json +++ b/tests/cache/verified.json @@ -2279,6 +2279,27 @@ }, "0x9FB3B12248bf010AEA7cE08343C8499FFAB4770f": { "name": "TransparentProxyFactory" + }, + "0xA1290d69c65A6Fe4DF752f95823fae25cB99e5A7": { + "name": "TransparentUpgradeableProxy" + }, + "0x2D62109243b87C4bA3EE7bA1D91B0dD0A074d7b1": { + "name": "InitializableImmutableAdminUpgradeabilityProxy" + }, + "0x6De3E52A1B7294A34e271a508082b1Ff4a37E30e": { + "name": "InitializableImmutableAdminUpgradeabilityProxy" + }, + "0x47F52B2e43D0386cF161e001835b03Ad49889e3b": { + "name": "RsETHPriceCapAdapter" + }, + "0xd1B2dec98A95B773C4909B5CD8FB455F467A527f": { + "name": "ParaSwapDebtSwapAdapterV3" + }, + "0x40ede12b44d98Fc4E53A2fB027D1BD1846e1690C": { + "name": "ParaSwapDebtSwapAdapterV3" + }, + "0xA1c93D2687f7014Aaf588c764E3Ce80aF016229b": { + "name": "GnosisSafeProxy" } }, "10": { @@ -2734,6 +2755,9 @@ }, "0x984B710D22730f799312513A10C1382e9D1Fa689": { "name": "TransparentProxyFactory" + }, + "0xc3250A20F8a7BbDd23adE87737EE46A45Fe5543E": { + "name": "AaveOpEthERC20Bridge" } }, "56": { @@ -5618,6 +5642,9 @@ }, "0x9B643d4aC937BEE8Bfb1Ec76401C22E18C318429": { "name": "TransparentProxyFactory" + }, + "0x0335ffa9af5CE05590d6C9A75B645470e07744a9": { + "name": "AaveArbEthERC20Bridge" } }, "43113": { diff --git a/tests/setup.ts b/tests/setup.ts new file mode 100644 index 00000000..0b172b7b --- /dev/null +++ b/tests/setup.ts @@ -0,0 +1 @@ +import 'dotenv/config'; diff --git a/vitest.config.ts b/vitest.config.ts new file mode 100644 index 00000000..32b37ef6 --- /dev/null +++ b/vitest.config.ts @@ -0,0 +1,7 @@ +import {defineConfig} from 'vitest/config'; + +export default defineConfig({ + test: { + setupFiles: ['./tests/setup.ts'], //this line, + }, +});