Skip to content

Commit

Permalink
feat(protocol): upgrade script (#18334)
Browse files Browse the repository at this point in the history
Co-authored-by: David <david@taiko.xyz>
  • Loading branch information
YoGhurt111 and davidtaikocha authored Oct 29, 2024
1 parent 3d12cb2 commit 2c41dd1
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
35 changes: 35 additions & 0 deletions packages/protocol/script/layer1/DeployHeklaL2Contracts.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

import "test/shared/DeployCapability.sol";
import "src/shared/bridge/Bridge.sol";
import "src/shared/common/AddressManager.sol";
import "../../contracts/layer2/hekla/HeklaTaikoL2.sol";
import "../../contracts/shared/tokenvault/BridgedERC20V2.sol";

contract DeployHeklaL2Contracts is DeployCapability {
uint256 public privateKey = vm.envUint("PRIVATE_KEY");

modifier broadcast() {
require(privateKey != 0, "invalid private key");
vm.startBroadcast(privateKey);
_;
vm.stopBroadcast();
}

function run() external broadcast {
// TaikoL2
address heklaTaikoL2 = address(new HeklaTaikoL2());
// Bridge
address bridge = address(new Bridge());
// Address manager
address addressManager = address(new AddressManager());
// Bridged ERC20 V2
address bridgedERC20V2 = address(new BridgedERC20V2());

console2.log("> hekla_taiko_l2@", heklaTaikoL2);
console2.log("> bridge@", bridge);
console2.log("> address_manager@", addressManager);
console2.log("> bridged_erc20_v2@", bridgedERC20V2);
}
}
9 changes: 8 additions & 1 deletion packages/protocol/script/layer1/UpgradeHeklaOntakeL2.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ contract UpgradeHeklaOntakeL2 is DeployCapability {
address public newHeklaTaikoL2 = vm.envAddress("NEW_HEKLA_TAIKO_L2");
address public newBridge = vm.envAddress("NEW_BRIDGE");
address public newAddressManager = vm.envAddress("NEW_ADDRESS_MANAGER");
address public newBridgedERC20 = vm.envAddress("NEW_BRIDGED_ERC20");

modifier broadcast() {
require(privateKey != 0, "invalid private key");
Expand All @@ -26,7 +27,7 @@ contract UpgradeHeklaOntakeL2 is DeployCapability {
}

function run() external broadcast {
Multicall3.Call3[] memory calls = new Multicall3.Call3[](4);
Multicall3.Call3[] memory calls = new Multicall3.Call3[](5);
// TaikoL2
calls[0].target = 0x1670090000000000000000000000000000010001;
calls[0].allowFailure = false;
Expand All @@ -43,6 +44,12 @@ contract UpgradeHeklaOntakeL2 is DeployCapability {
calls[3].target = 0x1670090000000000000000000000000000000006;
calls[3].allowFailure = false;
calls[3].callData = abi.encodeCall(UUPSUpgradeable.upgradeTo, (newAddressManager));
// Register Bridged ERC20
calls[4].target = 0x1670090000000000000000000000000000000006;
calls[4].allowFailure = false;
calls[4].callData = abi.encodeCall(
AddressManager.setAddress, (167_009, bytes32(bytes("bridged_erc20")), newBridgedERC20)
);

DelegateOwner.Call memory dcall = DelegateOwner.Call({
txId: 0,
Expand Down

0 comments on commit 2c41dd1

Please sign in to comment.