From b3c79378d38f48ee5f864d0c86ebaf97c4627be5 Mon Sep 17 00:00:00 2001 From: Aleksandr Kuperman Date: Wed, 16 Oct 2024 17:39:47 +0100 Subject: [PATCH 1/2] chore: adding addresses on Mode and adjusting static audit --- docs/configuration.json | 111 ------------------ docs/olas_bridging.md | 7 +- scripts/audit_chains/audit_contracts_setup.js | 70 +++++------ 3 files changed, 32 insertions(+), 156 deletions(-) diff --git a/docs/configuration.json b/docs/configuration.json index c56f0d0..3466484 100644 --- a/docs/configuration.json +++ b/docs/configuration.json @@ -55,57 +55,6 @@ } ] }, - { - "name": "goerli", - "chainId": "5", - "contracts": [ - { - "name": "OLAS", - "artifact": "abis/0.8.15/OLAS.json", - "address": "0xEdfc28215B1Eb6eb0be426f1f529cf691A5C2400" - }, - { - "name": "Timelock", - "artifact": "abis/0.8.15/Timelock.json", - "address": "0x34C895f302D0b5cf52ec0Edd3945321EB0f83dd5" - }, - { - "name": "veOLAS", - "artifact": "abis/0.8.15/veOLAS.json", - "address": "0xf8B20e160557c747E8640CdcE77E1dd44bCaAfbB" - }, - { - "name": "buOLAS", - "artifact": "abis/0.8.15/buOLAS.json", - "address": "0x397125902ED2cA2d42104F621f448A2cE1bC8Fb7" - }, - { - "name": "wveOLAS", - "artifact": "abis/0.8.19/wveOLAS.json", - "address": "0xa2AA89938805836077aB0724f335142da7A27085" - }, - { - "name": "GovernorOLAS", - "artifact": "abis/0.8.20/GovernorOLAS.json", - "address": "0x63b0f322837a7160B7E3d95C60aAaeB4EF1aECcb" - }, - { - "name": "GuardCM", - "artifact": "abis/0.8.23/GuardCM.json", - "address": "0xe07949B74bED0dac21BA74B4371155520FE6a560" - }, - { - "name": "BridgedERC20", - "artifact": "abis/0.8.23/BridgedERC20.json", - "address": "0x0CF8ad7AD779157a253964036af0e95f625EA27c" - }, - { - "name": "FxERC20RootTunnel", - "artifact": "abis/0.8.23/FxERC20RootTunnel.json", - "address": "0x7E335396a9804097Fd7c04F8b3adc314Ca9398A0" - } - ] - }, { "name": "polygon", "chainId": "137", @@ -122,22 +71,6 @@ } ] }, - { - "name": "polygonMumbai", - "chainId": "80001", - "contracts": [ - { - "name": "FxGovernorTunnel", - "artifact": "abis/0.8.19/FxGovernorTunnel.json", - "address": "0x17806E2a12d5E0F48C9803cd397DB3F044DA3b77" - }, - { - "name": "FxERC20ChildTunnel", - "artifact": "abis/0.8.23/FxERC20ChildTunnel.json", - "address": "0x5b5C7BA8424e6B48f92Ac02980FFc2531c3196DF" - } - ] - }, { "name": "gnosis", "chainId": "100", @@ -149,17 +82,6 @@ } ] }, - { - "name": "chiado", - "chainId": "10200", - "contracts": [ - { - "name": "HomeMediator", - "artifact": "abis/0.8.19/HomeMediator.json", - "address": "0x670Ac235EE13C0B2a5065282bBB0c61cfB354592" - } - ] - }, { "name": "optimistic", "chainId": "10", @@ -171,17 +93,6 @@ } ] }, - { - "name": "optimisticSepolia", - "chainId": "11155420", - "contracts": [ - { - "name": "OptimismMessenger", - "artifact": "abis/0.8.23/OptimismMessenger.json", - "address": "0xaC26774616bbeD41b0CB69EA2ae7de366F430b23" - } - ] - }, { "name": "base", "chainId": "8453", @@ -193,17 +104,6 @@ } ] }, - { - "name": "baseSepolia", - "chainId": "84532", - "contracts": [ - { - "name": "OptimismMessenger", - "artifact": "abis/0.8.23/OptimismMessenger.json", - "address": "0x6f7661F52fE1919996d0A4F68D09B344093a349d" - } - ] - }, { "name": "celo", "chainId": "42220", @@ -215,17 +115,6 @@ } ] }, - { - "name": "celoAlfajores", - "chainId": "44787", - "contracts": [ - { - "name": "WormholeMessenger", - "artifact": "abis/0.8.23/WormholeMessenger.json", - "address": "0xadBBC3FE82836366Bb178Fd210d4dd915e9B3415" - } - ] - }, { "name": "mode", "chainId": "34443", diff --git a/docs/olas_bridging.md b/docs/olas_bridging.md index e000760..e2b50c4 100644 --- a/docs/olas_bridging.md +++ b/docs/olas_bridging.md @@ -9,6 +9,7 @@ In a table below one can find OLAS token addresses on corresponding chains and b | Polygon PoS | [0xFEF5d947472e72Efbb2E388c730B7428406F2F95](https://polygonscan.com/token/0xFEF5d947472e72Efbb2E388c730B7428406F2F95) | [Polygon Portal](https://portal.polygon.technology/bridge) | | Solana | [Ez3nzG9ofodYCvEmw73XhQ87LWNYVRM2s7diB5tBZPyM](https://solscan.io/token/Ez3nzG9ofodYCvEmw73XhQ87LWNYVRM2s7diB5tBZPyM) | [Wormhole Portal](https://portalbridge.com/advanced-tools/#/transfer) | | Arbitrum | [0x064f8b858c2a603e1b106a2039f5446d32dc81c1](https://arbiscan.io/token/0x064f8b858c2a603e1b106a2039f5446d32dc81c1) | [Arbitrum Bridge](https://bridge.arbitrum.io) | -| Optimism | [0xFC2E6e6BCbd49ccf3A5f029c79984372DcBFE527](https://optimistic.etherscan.io/token/0xFC2E6e6BCbd49ccf3A5f029c79984372DcBFE527) | [Optimism Bridge](https://app.optimism.io/bridge/deposit) | -| Base | [0x54330d28ca3357F294334BDC454a032e7f353416](https://basescan.org/token/0x54330d28ca3357F294334BDC454a032e7f353416) | [Base Bridge](https://bridge.base.org/deposit) | -| Celo | [0xaCFfAe8e57Ec6E394Eb1b41939A8CF7892DbDc51](https://celoscan.io/token/0xacffae8e57ec6e394eb1b41939a8cf7892dbdc51) | [Wormhole Portal](https://portalbridge.com/advanced-tools/#/transfer) | +| Optimism | [0xFC2E6e6BCbd49ccf3A5f029c79984372DcBFE527](https://optimistic.etherscan.io/token/0xFC2E6e6BCbd49ccf3A5f029c79984372DcBFE527) | [Optimism Bridge](https://superbridge.app/optimism) | +| Base | [0x54330d28ca3357F294334BDC454a032e7f353416](https://basescan.org/token/0x54330d28ca3357F294334BDC454a032e7f353416) | [Base Bridge](https://superbridge.app/base) | +| Celo | [0xaCFfAe8e57Ec6E394Eb1b41939A8CF7892DbDc51](https://celoscan.io/token/0xacffae8e57ec6e394eb1b41939a8cf7892dbdc51) | [Wormhole Portal](https://portalbridge.com/advanced-tools/#/transfer) | +| Mode | [0xcfD1D50ce23C46D3Cf6407487B2F8934e96DC8f9](https://explorer.mode.network/address/0xcfD1D50ce23C46D3Cf6407487B2F8934e96DC8f9) | [Mode Bridge](https://superbridge.app/mode) | diff --git a/scripts/audit_chains/audit_contracts_setup.js b/scripts/audit_chains/audit_contracts_setup.js index 9f4af2d..f72a8be 100644 --- a/scripts/audit_chains/audit_contracts_setup.js +++ b/scripts/audit_chains/audit_contracts_setup.js @@ -4,7 +4,7 @@ const { ethers } = require("ethers"); const { expect } = require("chai"); const fs = require("fs"); -const verifyRepo = true; +const verifyRepo = false; const verifySetup = true; // Custom expect that is wrapped into try / catch block @@ -393,8 +393,8 @@ async function checkWormholeMessenger(chainId, provider, globalsInstance, config async function main() { // Check for the API keys - if (!process.env.ALCHEMY_API_KEY_MAINNET || !process.env.ALCHEMY_API_KEY_GOERLI || - !process.env.ALCHEMY_API_KEY_MATIC || !process.env.ALCHEMY_API_KEY_MUMBAI) { + if (!process.env.ALCHEMY_API_KEY_MAINNET || !process.env.ALCHEMY_API_KEY_SEPOLIA || + !process.env.ALCHEMY_API_KEY_MATIC || !process.env.ALCHEMY_API_KEY_AMOY) { console.log("Check API keys!"); return; } @@ -410,9 +410,7 @@ async function main() { // For now gnosis chains are not supported const networks = { "mainnet": "etherscan", - "goerli": "goerli.etherscan", "polygon": "polygonscan", - "polygonMumbai": "testnet.polygonscan", "optimistic": "optimistic.etherscan" }; @@ -420,7 +418,7 @@ async function main() { // Traverse all chains for (let i = 0; i < numChains; i++) { - // Skip gnosis chains + // Skip unsupported chains if (!networks[configs[i]["name"]]) { continue; } @@ -447,32 +445,22 @@ async function main() { if (verifySetup) { const globalNames = { "mainnet": "scripts/deployment/globals_mainnet.json", - "goerli": "scripts/deployment/globals_goerli.json", "polygon": "scripts/deployment/bridges/polygon/globals_polygon_mainnet.json", - "polygonMumbai": "scripts/deployment/bridges/polygon/globals_polygon_mumbai.json", "gnosis": "scripts/deployment/bridges/gnosis/globals_gnosis_mainnet.json", - "chiado": "scripts/deployment/bridges/gnosis/globals_gnosis_chiado.json", "optimistic": "scripts/deployment/bridges/optimistic/globals_optimistic_mainnet.json", - "optimisticSepolia": "scripts/deployment/bridges/optimistic/globals_optimistic_sepolia.json", "base": "scripts/deployment/bridges/optimistic/globals_base_mainnet.json", - "baseSepolia": "scripts/deployment/bridges/optimistic/globals_base_sepolia.json", "celo": "scripts/deployment/bridges/wormhole/globals_celo_mainnet.json", - "celoAlfajores": "scripts/deployment/bridges/wormhole/globals_celo_alfajores.json" + "mode": "scripts/deployment/bridges/optimistic/globals_mode_mainnet.json" }; const providerLinks = { "mainnet": "https://eth-mainnet.g.alchemy.com/v2/" + process.env.ALCHEMY_API_KEY_MAINNET, - "goerli": "https://eth-goerli.g.alchemy.com/v2/" + process.env.ALCHEMY_API_KEY_GOERLI, "polygon": "https://polygon-mainnet.g.alchemy.com/v2/" + process.env.ALCHEMY_API_KEY_MATIC, - "polygonMumbai": "https://polygon-mumbai.g.alchemy.com/v2/" + process.env.ALCHEMY_API_KEY_MUMBAI, "gnosis": "https://rpc.gnosischain.com", - "chiado": "https://rpc.chiadochain.net", "optimistic": "https://optimism.drpc.org", - "optimisticSepolia": "https://sepolia.optimism.io", "base": "https://mainnet.base.org", - "baseSepolia": "https://sepolia.base.org", "celo": "https://forno.celo.org", - "celoAlfajores": "https://alfajores-forno.celo-testnet.org" + "mode": "https://mainnet.mode.network" }; // Get all the globals processed @@ -488,41 +476,39 @@ async function main() { console.log("\nVerifying deployed contracts setup... If no error is output, then the contracts are correct."); // L1 contracts - for (let i = 0; i < 2; i++) { - console.log("\n######## Verifying setup on CHAIN ID", configs[i]["chainId"]); + console.log("\n######## Verifying setup on CHAIN ID", configs[0]["chainId"]); - const initLog = "ChainId: " + configs[i]["chainId"] + ", network: " + configs[i]["name"]; + const initLog = "ChainId: " + configs[0]["chainId"] + ", network: " + configs[0]["name"]; - let log = initLog + ", contract: " + "OLAS"; - await checkOLAS(configs[i]["chainId"], providers[i], globals[i], configs[i]["contracts"], "OLAS", log); + let log = initLog + ", contract: " + "OLAS"; + await checkOLAS(configs[0]["chainId"], providers[0], globals[0], configs[0]["contracts"], "OLAS", log); - log = initLog + ", contract: " + "Timelock"; - await checkTimelock(configs[i]["chainId"], providers[i], globals[i], configs[i]["contracts"], "Timelock", log); + log = initLog + ", contract: " + "Timelock"; + await checkTimelock(configs[0]["chainId"], providers[0], globals[0], configs[0]["contracts"], "Timelock", log); - log = initLog + ", contract: " + "veOLAS"; - await checkVEOLAS(configs[i]["chainId"], providers[i], globals[i], configs[i]["contracts"], "veOLAS", log); + log = initLog + ", contract: " + "veOLAS"; + await checkVEOLAS(configs[0]["chainId"], providers[0], globals[0], configs[0]["contracts"], "veOLAS", log); - log = initLog + ", contract: " + "buOLAS"; - await checkBUOLAS(configs[i]["chainId"], providers[i], globals[i], configs[i]["contracts"], "buOLAS", log); + log = initLog + ", contract: " + "buOLAS"; + await checkBUOLAS(configs[0]["chainId"], providers[0], globals[0], configs[0]["contracts"], "buOLAS", log); - log = initLog + ", contract: " + "wveOLAS"; - await checkWrappedVEOLAS(configs[i]["chainId"], providers[i], globals[i], configs[i]["contracts"], "wveOLAS", log); + log = initLog + ", contract: " + "wveOLAS"; + await checkWrappedVEOLAS(configs[0]["chainId"], providers[0], globals[0], configs[0]["contracts"], "wveOLAS", log); - log = initLog + ", contract: " + "GovernorOLAS"; - await checkGovernorOLAS(configs[i]["chainId"], providers[i], globals[i], globals[0], configs[i]["contracts"], "GovernorOLAS", log); + log = initLog + ", contract: " + "GovernorOLAS"; + await checkGovernorOLAS(configs[0]["chainId"], providers[0], globals[0], globals[0], configs[0]["contracts"], "GovernorOLAS", log); - log = initLog + ", contract: " + "GuardCM"; - await checkGuardCM(configs[i]["chainId"], providers[i], globals[i], configs[i]["contracts"], "GuardCM", log); + log = initLog + ", contract: " + "GuardCM"; + await checkGuardCM(configs[0]["chainId"], providers[0], globals[0], configs[0]["contracts"], "GuardCM", log); - log = initLog + ", contract: " + "BridgedERC20"; - await checkBridgedERC20(configs[i]["chainId"], providers[i], globals[i], configs[i]["contracts"], "BridgedERC20", log); + log = initLog + ", contract: " + "BridgedERC20"; + await checkBridgedERC20(configs[0]["chainId"], providers[0], globals[0], configs[0]["contracts"], "BridgedERC20", log); - log = initLog + ", contract: " + "FxERC20RootTunnel"; - await checkFxERC20RootTunnel(configs[i]["chainId"], providers[i], globals[i], configs[i]["contracts"], "FxERC20RootTunnel", log); - } + log = initLog + ", contract: " + "FxERC20RootTunnel"; + await checkFxERC20RootTunnel(configs[0]["chainId"], providers[0], globals[0], configs[0]["contracts"], "FxERC20RootTunnel", log); // L2 contracts - for (let i = 2; i < numChains; i++) { + for (let i = 1; i < numChains; i++) { console.log("\n######## Verifying setup on CHAIN ID", configs[i]["chainId"]); const initLog = "ChainId: " + configs[i]["chainId"] + ", network: " + configs[i]["name"]; @@ -536,7 +522,7 @@ async function main() { } else if (configs[i]["chainId"] == "100" || configs[i]["chainId"] == "10200") { let log = initLog + ", contract: " + "HomeMediator"; await checkHomeMediator(configs[i]["chainId"], providers[i], globals[i], configs[i]["contracts"], "HomeMediator", log); - } else if (configs[i]["chainId"] == "10" || configs[i]["chainId"] == "11155420" || configs[i]["chainId"] == "8453" || configs[i]["chainId"] == "84532") { + } else if (configs[i]["chainId"] == "10" || configs[i]["chainId"] == "11155420" || configs[i]["chainId"] == "8453" || configs[i]["chainId"] == "84532" || configs[i]["chainId"] == "34443") { let log = initLog + ", contract: " + "OptimismMessenger"; await checkOptimismMessenger(configs[i]["chainId"], providers[i], globals[i], configs[i]["contracts"], "OptimismMessenger", log); } else if (configs[i]["chainId"] == "42220" || configs[i]["chainId"] == "44787") { From ff740a25936eb1d6fefeee15616f03eb720adb10 Mon Sep 17 00:00:00 2001 From: Aleksandr Kuperman Date: Wed, 16 Oct 2024 17:42:14 +0100 Subject: [PATCH 2/2] chore: value change in static audit script --- scripts/audit_chains/audit_contracts_setup.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/audit_chains/audit_contracts_setup.js b/scripts/audit_chains/audit_contracts_setup.js index f72a8be..dbfc625 100644 --- a/scripts/audit_chains/audit_contracts_setup.js +++ b/scripts/audit_chains/audit_contracts_setup.js @@ -4,7 +4,7 @@ const { ethers } = require("ethers"); const { expect } = require("chai"); const fs = require("fs"); -const verifyRepo = false; +const verifyRepo = true; const verifySetup = true; // Custom expect that is wrapped into try / catch block