Skip to content

Commit f62ce80

Browse files
shutter-service: added combined deploy script
1 parent f9d4575 commit f62ce80

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

script/Deploy.service.s.sol

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity ^0.8.20;
3+
4+
import "forge-std/Script.sol";
5+
import "../src/common/KeyBroadcastContract.sol";
6+
import "../src/common/KeyperSet.sol";
7+
import "../src/common/KeyperSetManager.sol";
8+
import "../src/shutter-service/ShutterRegistry.sol";
9+
10+
contract Deploy is Script {
11+
function deployKeyperSetManager(
12+
address deployerAddress
13+
) public returns (KeyperSetManager) {
14+
KeyperSetManager ksm = new KeyperSetManager(deployerAddress);
15+
16+
// add bootstrap keyper set
17+
KeyperSet fakeKeyperset = new KeyperSet();
18+
fakeKeyperset.setFinalized();
19+
ksm.addKeyperSet(0, address(fakeKeyperset));
20+
21+
console.log("KeyperSetManager:", address(ksm));
22+
return ksm;
23+
}
24+
25+
function deployKeyBroadcastContract(
26+
KeyperSetManager ksm
27+
) public returns (KeyBroadcastContract) {
28+
KeyBroadcastContract kbc = new KeyBroadcastContract(address(ksm));
29+
console.log("KeyBroadcastContract:", address(kbc));
30+
return kbc;
31+
}
32+
33+
function deployRegistry() public returns (ShutterRegistry) {
34+
ShutterRegistry s = new ShutterRegistry();
35+
console.log("Registry:", address(s));
36+
return s;
37+
}
38+
39+
function run() external {
40+
uint256 deployKey = vm.envUint("DEPLOY_KEY");
41+
address deployerAddress = vm.addr(deployKey);
42+
console.log("Deployer:", deployerAddress);
43+
vm.startBroadcast(deployKey);
44+
45+
KeyperSetManager ksm = deployKeyperSetManager(deployerAddress);
46+
deployKeyBroadcastContract(ksm);
47+
deployRegistry();
48+
49+
vm.stopBroadcast();
50+
}
51+
}

0 commit comments

Comments
 (0)