forked from taikoxyz/taiko-mono
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a68af76
commit c46e659
Showing
4 changed files
with
85 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.24; | ||
|
||
import "forge-std/src/Script.sol"; | ||
import "forge-std/src/console2.sol"; | ||
import "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol"; | ||
|
||
import "src/shared/common/AddressManager.sol"; | ||
|
||
contract ChangeOwners is Script { | ||
uint256 public adminPrivateKey = vm.envUint("PRIVATE_KEY"); | ||
address public newOwner = vm.envAddress("NEW_OWNER"); | ||
|
||
function run() external { | ||
address[] memory contracts = vm.envAddress("CONTRACTS", ","); | ||
vm.startBroadcast(adminPrivateKey); | ||
for(uint i; i < contracts.length; ++i) { | ||
OwnableUpgradeable(contracts[0]).transferOwnership(newOwner); | ||
} | ||
vm.stopBroadcast(); | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
packages/protocol/script/shared/DeployTimelockedOwner.s.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.24; | ||
|
||
import "@openzeppelin/contracts/governance/TimelockController.sol"; | ||
import "test/shared/DeployCapability.sol"; | ||
|
||
contract DeployTimelockedOwner is DeployCapability { | ||
uint256 public deployerPrivKey = vm.envUint("PRIVATE_KEY"); | ||
function run() external { | ||
require(deployerPrivKey != 0, "invalid deployer priv key"); | ||
vm.startBroadcast(deployerPrivKey); | ||
address[] memory executors = vm.envAddress("OWNER_MULTISIG_SIGNERS", ","); | ||
|
||
address ownerMultisig = vm.envAddress("OWNER_MULTISIG"); | ||
addressNotNull(ownerMultisig, "ownerMultisig"); | ||
|
||
address[] memory proposers = new address[](1); | ||
proposers[0] = ownerMultisig; | ||
|
||
// Setup timelock controller with 45 day (86400 seconds * 45) delay | ||
address timelockController = address( | ||
new TimelockController(86400 * 45, proposers, executors, address(0)) | ||
); | ||
console2.log("Timelocked owner: ", timelockController); | ||
vm.stopBroadcast(); | ||
} | ||
|
||
function addressNotNull(address addr, string memory err) private pure { | ||
require(addr != address(0), err); | ||
} | ||
} |