-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDeploy.s.sol
More file actions
42 lines (34 loc) · 1.58 KB
/
Deploy.s.sol
File metadata and controls
42 lines (34 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.25;
import {Script, console} from "forge-std/Script.sol";
import {Vm} from "forge-std/Vm.sol";
import {ICreateX} from "createx/ICreateX.sol";
import {DeployUtils} from "../libraries/DeployUtils.sol";
import {CrossChainCounter} from "../src/CrossChainCounter.sol";
// Example forge script for deploying as an alternative to sup: super-cli (https://github.com/ethereum-optimism/super-cli)
contract Deploy is Script {
/// @notice Array of RPC URLs to deploy to, deploy to supersim 901 and 902 by default.
string[] private rpcUrls = ["http://localhost:9545", "http://localhost:9546"];
/// @notice Modifier that wraps a function in broadcasting.
modifier broadcast() {
vm.startBroadcast(msg.sender);
_;
vm.stopBroadcast();
}
function run() public {
for (uint256 i = 0; i < rpcUrls.length; i++) {
string memory rpcUrl = rpcUrls[i];
console.log("Deploying to RPC: ", rpcUrl);
vm.createSelectFork(rpcUrl);
deployCrossChainCounterContract();
}
}
function deployCrossChainCounterContract() public broadcast returns (address addr_) {
bytes memory initCode = abi.encodePacked(type(CrossChainCounter).creationCode);
addr_ = DeployUtils.deployContract("CrossChainCounter", _implSalt(), initCode);
}
/// @notice The CREATE2 salt to be used when deploying a contract.
function _implSalt() internal view returns (bytes32) {
return keccak256(abi.encodePacked(vm.envOr("DEPLOY_SALT", string("ethers phoenix"))));
}
}