Skip to content

Commit 2e605fc

Browse files
committed
fix: deploy script
1 parent 8a4d38b commit 2e605fc

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

script/releases/v1.8.0-hourglass/1-deployDestinationChainProxies.s.sol

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,25 @@ contract DeployDestinationChainProxies is MultisigBuilder {
7474
return admin;
7575
}
7676

77+
/// @dev Check if the TaskMailbox proxy is deployed by checking if it's code size is greater than 0
78+
function _areProxiesDeployed() internal view returns (bool) {
79+
EmptyContract emptyContract = Env.impl.emptyContract();
80+
address taskMailboxProxy = _computeExpectedProxyAddress(type(TaskMailbox).name, address(emptyContract));
81+
82+
if (taskMailboxProxy.code.length > 0) {
83+
return true;
84+
}
85+
return false;
86+
}
87+
88+
/// @dev Add the contracts to the env
89+
function _addContractsToEnv() internal {
90+
EmptyContract emptyContract = Env.impl.emptyContract();
91+
_unsafeAddProxyContract(
92+
type(TaskMailbox).name, _computeExpectedProxyAddress(type(TaskMailbox).name, address(emptyContract))
93+
);
94+
}
95+
7796
/// @dev Compute the expected proxy address for a given name and empty contract
7897
function _computeExpectedProxyAddress(string memory name, address emptyContract) internal view returns (address) {
7998
return CrosschainDeployLib.computeCrosschainUpgradeableProxyAddress({

script/releases/v1.8.0-hourglass/3-instantiateDestinationChainProxies.s.sol

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,15 @@ contract InstantiateDestinationChainProxies is DeployDestinationChainImpls {
4848
return;
4949
}
5050

51-
// 1. Deploy the destination chain proxies
52-
DeployDestinationChainProxies._runAsMultisig();
53-
_unsafeResetHasPranked(); // reset hasPranked so we can use it in the execute()
51+
// 1. Deploy the destination chain contracts
52+
// If proxies are not deployed, deploy them
53+
if (!_areProxiesDeployed()) {
54+
DeployDestinationChainProxies._runAsMultisig();
55+
_unsafeResetHasPranked(); // reset hasPranked so we can use it in the execute()
56+
} else {
57+
// Since the proxies are already deployed, we need to update the env with the proper addresses
58+
_addContractsToEnv();
59+
}
5460

5561
// 2. Deploy the destination chain impls
5662
_mode = OperationalMode.EOA; // Set to EOA mode so we can deploy the impls in the EOA script

0 commit comments

Comments
 (0)