Skip to content

Commit dd99849

Browse files
committed
Revert "Merge branch 'decouple-order-3-leyers' into save-open"
This reverts commit 09b5f63, reversing changes made to 6d6d91e.
1 parent 09b5f63 commit dd99849

File tree

3 files changed

+797
-526
lines changed

3 files changed

+797
-526
lines changed

solidity/script/DeployHyperlane7683.s.sol

Lines changed: 13 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ import { ProxyAdmin } from "@openzeppelin/contracts/proxy/transparent/ProxyAdmin
1111

1212
import { Hyperlane7683 } from "../src/Hyperlane7683.sol";
1313

14-
import { ICreateX } from "./utils/ICreateX.sol";
15-
1614
contract OwnableProxyAdmin is ProxyAdmin {
1715
constructor(address _owner) {
1816
_transferOwnership(_owner);
@@ -24,16 +22,26 @@ contract DeployHyperlane7683 is Script {
2422
function run() public {
2523
uint256 deployerPrivateKey = vm.envUint("DEPLOYER_PK");
2624

25+
string memory ROUTER_SALT = vm.envString("HYPERLANE7683_SALT");
26+
address mailbox = vm.envAddress("MAILBOX");
27+
address permit2 = vm.envAddress("PERMIT2");
28+
address proxyAdminOwner = vm.envOr("PROXY_ADMIN_OWNER", address(0));
29+
address owner = vm.envAddress("ROUTER_OWNER");
2730
uint256[] memory domains = vm.envUint("DOMAINS", ",");
2831
uint32[] memory _domains = new uint32[](domains.length);
2932
bytes32[] memory routers = new bytes32[](domains.length);
3033
GasRouter.GasRouterConfig[] memory gasConfigs = new GasRouter.GasRouterConfig[](domains.length);
3134

3235
vm.startBroadcast(deployerPrivateKey);
3336

34-
ProxyAdmin proxyAdmin = deployProxyAdmin();
35-
address routerImpl = deployImplementation();
36-
TransparentUpgradeableProxy proxy = deployProxy(routerImpl, address(proxyAdmin));
37+
ProxyAdmin proxyAdmin = new OwnableProxyAdmin{salt: keccak256(abi.encode(ROUTER_SALT))}(proxyAdminOwner);
38+
39+
address routerImpl = address(new Hyperlane7683{salt: keccak256(abi.encode(ROUTER_SALT))}(mailbox, permit2));
40+
TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy{salt: keccak256(abi.encode(ROUTER_SALT))}(
41+
routerImpl,
42+
address(proxyAdmin),
43+
abi.encodeWithSelector(Hyperlane7683.initialize.selector, address(0), address(0), owner)
44+
);
3745

3846
for (uint i = 0; i < domains.length; i++) {
3947
routers[i] = TypeCasts.addressToBytes32(address(proxy));
@@ -53,44 +61,4 @@ contract DeployHyperlane7683 is Script {
5361
console2.log("Implementation:", routerImpl);
5462
console2.log("ProxyAdmin:", address(proxyAdmin));
5563
}
56-
57-
function deployProxyAdmin() internal returns (ProxyAdmin proxyAdmin) {
58-
string memory ROUTER_SALT = vm.envString("HYPERLANE7683_SALT");
59-
address proxyAdminOwner = vm.envOr("PROXY_ADMIN_OWNER", address(0));
60-
proxyAdmin = new OwnableProxyAdmin{salt: keccak256(abi.encode(ROUTER_SALT))}(proxyAdminOwner);
61-
}
62-
63-
function deployImplementation() internal returns (address routerImpl) {
64-
uint256 deployerPrivateKey = vm.envUint("DEPLOYER_PK");
65-
address createX = vm.envAddress("CREATEX_ADDRESS");
66-
string memory ROUTER_SALT = vm.envString("HYPERLANE7683_SALT");
67-
address mailbox = vm.envAddress("MAILBOX");
68-
address permit2 = vm.envAddress("PERMIT2");
69-
bytes32 salt = keccak256(abi.encodePacked("impl",ROUTER_SALT, vm.addr(deployerPrivateKey)));
70-
71-
bytes memory routerCreation = type(Hyperlane7683).creationCode;
72-
bytes memory routerBytecode = abi.encodePacked(routerCreation, abi.encode(mailbox, permit2));
73-
74-
routerImpl = ICreateX(createX).deployCreate3(salt, routerBytecode);
75-
}
76-
77-
function deployProxy(address routerImpl, address proxyAdmin) internal returns (TransparentUpgradeableProxy proxy) {
78-
uint256 deployerPrivateKey = vm.envUint("DEPLOYER_PK");
79-
address createX = vm.envAddress("CREATEX_ADDRESS");
80-
string memory ROUTER_SALT = vm.envString("HYPERLANE7683_SALT");
81-
address owner = vm.envAddress("ROUTER_OWNER");
82-
83-
bytes32 salt = keccak256(abi.encodePacked("proxy", ROUTER_SALT, vm.addr(deployerPrivateKey)));
84-
85-
bytes memory proxyCreation = type(TransparentUpgradeableProxy).creationCode;
86-
bytes memory proxyBytecode = abi.encodePacked(proxyCreation, abi.encode(
87-
routerImpl,
88-
proxyAdmin,
89-
abi.encodeWithSelector(Hyperlane7683.initialize.selector, address(0), address(0), owner)
90-
));
91-
92-
proxy = TransparentUpgradeableProxy(
93-
payable(ICreateX(createX).deployCreate3(salt, proxyBytecode))
94-
);
95-
}
9664
}

solidity/script/utils/ICreateX.sol

Lines changed: 0 additions & 195 deletions
This file was deleted.

0 commit comments

Comments
 (0)