Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(protocol): upgrade script #18334

Merged
merged 14 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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