From 948cf4127c9ad1c068444b60047429c702c991aa Mon Sep 17 00:00:00 2001 From: xiaoch05 Date: Sun, 28 Apr 2024 16:05:59 +0800 Subject: [PATCH] transfer ownership (#6) * transfer ownership * update chains --- foundry.toml | 3 ++ script/3_AcceptOwnership.s.sol | 55 ++++++++++++++++++++++++++++++++++ script/common/Base.sol | 2 +- script/common/Proposal.s.sol | 4 +-- 4 files changed, 61 insertions(+), 3 deletions(-) create mode 100644 script/3_AcceptOwnership.s.sol diff --git a/foundry.toml b/foundry.toml index 4d9b9ab..d3497e1 100644 --- a/foundry.toml +++ b/foundry.toml @@ -13,3 +13,6 @@ anvil = "http://127.0.0.1:8545" polygon = "https://polygon-rpc.com" optimism = "https://rpc.ankr.com/optimism" arbitrum = "https://arb1.arbitrum.io/rpc" +linea = "https://rpc.linea.build" +ethereum = "https://rpc.ankr.com/eth" +blast = "https://rpc.blast.io" diff --git a/script/3_AcceptOwnership.s.sol b/script/3_AcceptOwnership.s.sol new file mode 100644 index 0000000..19f1127 --- /dev/null +++ b/script/3_AcceptOwnership.s.sol @@ -0,0 +1,55 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {Base} from "./common/Base.sol"; +import {safeconsole} from "forge-std/safeconsole.sol"; + +interface III { + function dao() external view returns (address); + function pendingDao() external view returns (address); + function acceptOwnership() external; +} + +contract AcceptOwnership3 is Base { + uint256 OptimisticChainId = 10; + uint256 ArbitrumChainId = 42161; + uint256 LineaChainId = 59144; + uint256 PolygonChainId = 137; + uint256 BlastChainId = 81457; + uint256 EthereumChainId = 1; + + function acceptAndCheckOwnership(address addr) internal { + address dao = safeAddress(); + if (addr != address(0)) { + if (dao == III(addr).pendingDao()) { + III(addr).acceptOwnership(); + } + require(III(addr).dao() == dao, "failed"); + } + } + + function run() public sphinx { + address lzMessager = address(0); + address msgPortMessager = address(0); + address lnv2Opposite = address(0); + address lnv2Default = address(0); + + address lnv3 = address(0); + if (block.chainid == ArbitrumChainId) { + msgPortMessager = 0x65Be094765731F394bc6d9DF53bDF3376F1Fc8B0; + } else if (block.chainid == LineaChainId) { + lnv3 = 0xbA5D580B18b6436411562981e02c8A9aA1776D10; + } else if (block.chainid == BlastChainId) { + lzMessager = 0x98982b1685a63596834a05C1288dA7fbF27d684E; + lnv3 = 0xB180D7DcB5CC161C862aD60442FA37527546cAFC; + } else if (block.chainid == EthereumChainId) { + msgPortMessager = 0x65Be094765731F394bc6d9DF53bDF3376F1Fc8B0; + lnv3 = 0xbA5D580B18b6436411562981e02c8A9aA1776D10; + } + acceptAndCheckOwnership(lzMessager); + acceptAndCheckOwnership(msgPortMessager); + acceptAndCheckOwnership(lnv2Opposite); + acceptAndCheckOwnership(lnv2Default); + acceptAndCheckOwnership(lnv3); + } +} diff --git a/script/common/Base.sol b/script/common/Base.sol index 8f667ab..ff9b02a 100644 --- a/script/common/Base.sol +++ b/script/common/Base.sol @@ -17,6 +17,6 @@ contract Base is Sphinx, Script { sphinxConfig.threshold = 3; sphinxConfig.projectName = "Helix-DAO"; // sphinxConfig.mainnets = ["polygon", "arbitrum", "optimism", "mantle"]; - sphinxConfig.mainnets = ["optimism", "arbitrum"]; + sphinxConfig.mainnets = ["arbitrum", "ethereum", "blast", "linea"]; } } diff --git a/script/common/Proposal.s.sol b/script/common/Proposal.s.sol index 0efc405..486fc7e 100644 --- a/script/common/Proposal.s.sol +++ b/script/common/Proposal.s.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import {RegisterEthTokenArbAndOp2} from "../2_RegisterEthTokenArbAndOp.s.sol"; +import {AcceptOwnership3} from "../3_AcceptOwnership.s.sol"; -contract Proposal is RegisterEthTokenArbAndOp2 {} +contract Proposal is AcceptOwnership3 {}