-
Notifications
You must be signed in to change notification settings - Fork 11
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
5b0f67b
commit 002c898
Showing
2 changed files
with
50 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
## These env vars are used for ExecuteNitroContracts2Point1Point2UpgradeScript | ||
|
||
UPGRADE_ACTION_ADDRESS= | ||
INBOX_ADDRESS= | ||
PROXY_ADMIN_ADDRESS= | ||
PARENT_UPGRADE_EXECUTOR_ADDRESS= |
44 changes: 44 additions & 0 deletions
44
scripts/foundry/contract-upgrades/2.1.2/ExecuteNitroContracts2Point1Point2Upgrade.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,44 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
pragma solidity 0.8.16; | ||
|
||
import "forge-std/Script.sol"; | ||
import { | ||
NitroContracts2Point1Point2UpgradeAction, | ||
ProxyAdmin | ||
} from "../../../../contracts/parent-chain/contract-upgrades/NitroContracts2Point1Point2UpgradeAction.sol"; | ||
import {IInboxBase} from "@arbitrum/nitro-contracts-1.2.1/src/bridge/IInboxBase.sol"; | ||
import {IERC20Bridge} from "@arbitrum/nitro-contracts-2.1.2/src/bridge/IERC20Bridge.sol"; | ||
import {IUpgradeExecutor} from "@offchainlabs/upgrade-executor/src/IUpgradeExecutor.sol"; | ||
|
||
/** | ||
* @title ExecuteNitroContracts1Point2Point1UpgradeScript | ||
* @notice This script executes nitro contracts 2.1.0 upgrade through UpgradeExecutor | ||
*/ | ||
contract ExecuteNitroContracts2Point1Point2UpgradeScript is Script { | ||
function run() public { | ||
|
||
NitroContracts2Point1Point2UpgradeAction upgradeAction = | ||
NitroContracts2Point1Point2UpgradeAction(vm.envAddress("UPGRADE_ACTION_ADDRESS")); | ||
|
||
IInboxBase inbox = IInboxBase(vm.envAddress("INBOX_ADDRESS")); | ||
|
||
address bridge = address(inbox.bridge()); | ||
|
||
vm.startBroadcast(); | ||
|
||
// prepare upgrade calldata | ||
ProxyAdmin proxyAdmin = ProxyAdmin(vm.envAddress("PROXY_ADMIN_ADDRESS")); | ||
bytes memory upgradeCalldata = | ||
abi.encodeCall(NitroContracts2Point1Point2UpgradeAction.perform, (bridge, proxyAdmin)); | ||
|
||
// execute the upgrade | ||
// action checks prerequisites, and script will fail if the action reverts | ||
IUpgradeExecutor executor = IUpgradeExecutor(vm.envAddress("PARENT_UPGRADE_EXECUTOR_ADDRESS")); | ||
executor.execute(address(upgradeAction), upgradeCalldata); | ||
|
||
// sanity check, full checks are done on-chain by the upgrade action | ||
require(IERC20Bridge(bridge).nativeTokenDecimals() == 18, "Unexpected native token decimals"); | ||
|
||
vm.stopBroadcast(); | ||
} | ||
} |