Skip to content

Commit

Permalink
add script to test upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
skosito committed Aug 2, 2024
1 parent acc628e commit 5b84119
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions v2/scripts/deploy/UpgradeGatewayEVM.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;

import "forge-std/Script.sol";
import "src/evm/GatewayEVM.sol";
import "test/utils/GatewayEVMUpgradeTest.sol";
import "test/utils/TestERC20.sol";
import { ERC1967Proxy } from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";
import { Upgrades } from "openzeppelin-foundry-upgrades/Upgrades.sol";

contract UpgradeGatewayEVM is Script {
function run() external {
// TODO: should be passed as arg
string memory mnemonic = "test test test test test test test test test test test junk";
uint256 privateKey = vm.deriveKey(mnemonic, 0);
address deployer = vm.rememberKey(privateKey);

// TODO: should be passed as arg
address proxy = vm.envOr("PROXY_ADDRESS", address(0xA7806c719bd377F15bA6CaDf2F94Afb7FfA66256));

GatewayEVM prevImpl = GatewayEVM(proxy);

vm.startBroadcast(deployer);

Upgrades.upgradeProxy(proxy, "GatewayEVMUpgradeTest.sol", "");

GatewayEVM newImpl = GatewayEVM(proxy);

require(prevImpl.tssAddress() == newImpl.tssAddress(), "tss addr changed");
require(prevImpl.zetaToken() == newImpl.zetaToken(), "zeta token addr changed");

vm.stopBroadcast();
}
}

0 comments on commit 5b84119

Please sign in to comment.