-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(protocol): proxy upgrade scripts (#13944)
- Loading branch information
1 parent
66649bd
commit ccef198
Showing
10 changed files
with
224 additions
and
1 deletion.
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
26 changes: 26 additions & 0 deletions
26
packages/protocol/script/upgrade/UpgradeAddressManager.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,26 @@ | ||
// SPDX-License-Identifier: MIT | ||
// _____ _ _ _ _ | ||
// |_ _|_ _(_) |_____ | | __ _| |__ ___ | ||
// | |/ _` | | / / _ \ | |__/ _` | '_ (_-< | ||
// |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ | ||
|
||
pragma solidity ^0.8.18; | ||
|
||
import "forge-std/Script.sol"; | ||
import "forge-std/console2.sol"; | ||
import | ||
"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; | ||
import "@openzeppelin/contracts-upgradeable/utils/math/SafeCastUpgradeable.sol"; | ||
import "../../contracts/common/AddressManager.sol"; | ||
import "./UpgradeScript.s.sol"; | ||
|
||
contract UpgradeAddressManager is UpgradeScript { | ||
function run() external setUp { | ||
AddressManager newAddressManager = new ProxiedAddressManager(); | ||
proxy.upgradeTo(address(newAddressManager)); | ||
console2.log( | ||
"proxy upgraded AddressManager implementation to", | ||
address(newAddressManager) | ||
); | ||
} | ||
} |
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,25 @@ | ||
// SPDX-License-Identifier: MIT | ||
// _____ _ _ _ _ | ||
// |_ _|_ _(_) |_____ | | __ _| |__ ___ | ||
// | |/ _` | | / / _ \ | |__/ _` | '_ (_-< | ||
// |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ | ||
|
||
pragma solidity ^0.8.18; | ||
|
||
import "forge-std/Script.sol"; | ||
import "forge-std/console2.sol"; | ||
import | ||
"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; | ||
import "@openzeppelin/contracts-upgradeable/utils/math/SafeCastUpgradeable.sol"; | ||
import "../../contracts/bridge/Bridge.sol"; | ||
import "./UpgradeScript.s.sol"; | ||
|
||
contract UpgradeBridge is UpgradeScript { | ||
function run() external setUp { | ||
Bridge newBridge = new ProxiedBridge(); | ||
proxy.upgradeTo(address(newBridge)); | ||
console2.log( | ||
"proxy upgraded Bridge implementation to", address(newBridge) | ||
); | ||
} | ||
} |
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,33 @@ | ||
// SPDX-License-Identifier: MIT | ||
// _____ _ _ _ _ | ||
// |_ _|_ _(_) |_____ | | __ _| |__ ___ | ||
// | |/ _` | | / / _ \ | |__/ _` | '_ (_-< | ||
// |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ | ||
|
||
pragma solidity ^0.8.18; | ||
|
||
import "forge-std/Script.sol"; | ||
import "forge-std/console2.sol"; | ||
import | ||
"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; | ||
import "@openzeppelin/contracts-upgradeable/utils/math/SafeCastUpgradeable.sol"; | ||
|
||
contract UpgradeScript is Script { | ||
uint256 public deployerPrivateKey = vm.envUint("PRIVATE_KEY"); | ||
|
||
address public proxyAddress = vm.envAddress("PROXY_ADDRESS"); | ||
|
||
TransparentUpgradeableProxy proxy; | ||
|
||
modifier setUp() { | ||
require(deployerPrivateKey != 0, "PRIVATE_KEY not set"); | ||
require(proxyAddress != address(0), "PROXY_ADDRESS not set"); | ||
|
||
vm.startBroadcast(deployerPrivateKey); | ||
|
||
proxy = TransparentUpgradeableProxy(payable(proxyAddress)); | ||
_; | ||
|
||
vm.stopBroadcast(); | ||
} | ||
} |
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,26 @@ | ||
// SPDX-License-Identifier: MIT | ||
// _____ _ _ _ _ | ||
// |_ _|_ _(_) |_____ | | __ _| |__ ___ | ||
// | |/ _` | | / / _ \ | |__/ _` | '_ (_-< | ||
// |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ | ||
|
||
pragma solidity ^0.8.18; | ||
|
||
import "forge-std/Script.sol"; | ||
import "forge-std/console2.sol"; | ||
import | ||
"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; | ||
import "@openzeppelin/contracts-upgradeable/utils/math/SafeCastUpgradeable.sol"; | ||
import "../../contracts/signal/SignalService.sol"; | ||
import "./UpgradeScript.s.sol"; | ||
|
||
contract UpgradeSignalService is UpgradeScript { | ||
function run() external setUp { | ||
SignalService newSignalService = new ProxiedSignalService(); | ||
proxy.upgradeTo(address(newSignalService)); | ||
console2.log( | ||
"proxy upgraded SignalService implementation to", | ||
address(newSignalService) | ||
); | ||
} | ||
} |
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,25 @@ | ||
// SPDX-License-Identifier: MIT | ||
// _____ _ _ _ _ | ||
// |_ _|_ _(_) |_____ | | __ _| |__ ___ | ||
// | |/ _` | | / / _ \ | |__/ _` | '_ (_-< | ||
// |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ | ||
|
||
pragma solidity ^0.8.18; | ||
|
||
import "forge-std/Script.sol"; | ||
import "forge-std/console2.sol"; | ||
import | ||
"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; | ||
import "@openzeppelin/contracts-upgradeable/utils/math/SafeCastUpgradeable.sol"; | ||
import "../../contracts/L1/TaikoL1.sol"; | ||
import "./UpgradeScript.s.sol"; | ||
|
||
contract UpgradeTaikoL1 is UpgradeScript { | ||
function run() external setUp { | ||
TaikoL1 newTaikoL1 = new ProxiedTaikoL1(); | ||
proxy.upgradeTo(address(newTaikoL1)); | ||
console2.log( | ||
"proxy upgraded taiko L1 implementation to", address(newTaikoL1) | ||
); | ||
} | ||
} |
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,25 @@ | ||
// SPDX-License-Identifier: MIT | ||
// _____ _ _ _ _ | ||
// |_ _|_ _(_) |_____ | | __ _| |__ ___ | ||
// | |/ _` | | / / _ \ | |__/ _` | '_ (_-< | ||
// |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ | ||
|
||
pragma solidity ^0.8.18; | ||
|
||
import "forge-std/Script.sol"; | ||
import "forge-std/console2.sol"; | ||
import | ||
"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; | ||
import "@openzeppelin/contracts-upgradeable/utils/math/SafeCastUpgradeable.sol"; | ||
import "../../contracts/L2/TaikoL2.sol"; | ||
import "./UpgradeScript.s.sol"; | ||
|
||
contract UpgradeTaikoL2 is UpgradeScript { | ||
function run() external setUp { | ||
TaikoL2 newTaikoL2 = new ProxiedTaikoL2(); | ||
proxy.upgradeTo(address(newTaikoL2)); | ||
console2.log( | ||
"proxy upgraded TaikoL2 implementation to", address(newTaikoL2) | ||
); | ||
} | ||
} |
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,26 @@ | ||
// SPDX-License-Identifier: MIT | ||
// _____ _ _ _ _ | ||
// |_ _|_ _(_) |_____ | | __ _| |__ ___ | ||
// | |/ _` | | / / _ \ | |__/ _` | '_ (_-< | ||
// |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ | ||
|
||
pragma solidity ^0.8.18; | ||
|
||
import "forge-std/Script.sol"; | ||
import "forge-std/console2.sol"; | ||
import | ||
"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; | ||
import "@openzeppelin/contracts-upgradeable/utils/math/SafeCastUpgradeable.sol"; | ||
import "../../contracts/L1/TaikoToken.sol"; | ||
import "./UpgradeScript.s.sol"; | ||
|
||
contract UpgradeTaikoToken is UpgradeScript { | ||
function run() external setUp { | ||
TaikoToken newTaikoToken = new ProxiedTaikoToken(); | ||
proxy.upgradeTo(address(newTaikoToken)); | ||
console2.log( | ||
"proxy upgraded TaikoToken implementation to", | ||
address(newTaikoToken) | ||
); | ||
} | ||
} |
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,26 @@ | ||
// SPDX-License-Identifier: MIT | ||
// _____ _ _ _ _ | ||
// |_ _|_ _(_) |_____ | | __ _| |__ ___ | ||
// | |/ _` | | / / _ \ | |__/ _` | '_ (_-< | ||
// |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ | ||
|
||
pragma solidity ^0.8.18; | ||
|
||
import "forge-std/Script.sol"; | ||
import "forge-std/console2.sol"; | ||
import | ||
"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; | ||
import "@openzeppelin/contracts-upgradeable/utils/math/SafeCastUpgradeable.sol"; | ||
import "../../contracts/bridge/TokenVault.sol"; | ||
import "./UpgradeScript.s.sol"; | ||
|
||
contract UpgradeTokenVault is UpgradeScript { | ||
function run() external setUp { | ||
TokenVault newTokenVault = new ProxiedTokenVault(); | ||
proxy.upgradeTo(address(newTokenVault)); | ||
console2.log( | ||
"proxy upgraded TokenVault implementation to", | ||
address(newTokenVault) | ||
); | ||
} | ||
} |
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,10 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
: "${FORK_URL:=http://localhost:8545}" | ||
|
||
forge script script/upgrade/Upgrade$CONTRACT.s.sol:Upgrade$CONTRACT \ | ||
--fork-url $FORK_URL \ | ||
--broadcast \ | ||
--ffi \ | ||
-vvvv |