@@ -8,52 +8,50 @@ import "../src/KeyperSetManager.sol";
8
8
import "../src/Sequencer.sol " ;
9
9
import "../src/ValidatorRegistry.sol " ;
10
10
11
- contract DeployAll is Script {
12
- KeyBroadcastContract public keyBroadcastContract;
13
- KeyperSet public keyperSet;
14
- KeyperSetManager public keyperSetManager;
15
- Sequencer public sequencer;
16
- ValidatorRegistry public validatorRegistry;
17
-
18
- function deployKeyperSet () public {
19
- address broadcaster = vm.envAddress ("BROADCASTER " );
20
- keyperSet = new KeyperSet ();
21
- address [] memory members = new address [](3 );
22
- members[0 ] = address (1 );
23
- members[1 ] = address (2 );
24
- members[2 ] = address (3 );
25
- keyperSet.addMembers (members);
26
- keyperSet.setKeyBroadcaster (broadcaster);
27
- keyperSet.setFinalized ();
28
- }
11
+ contract Deploy is Script {
12
+ function deployKeyperSetManager () public returns (KeyperSetManager) {
13
+ KeyperSetManager ksm = new KeyperSetManager ();
14
+
15
+ // add bootstrap keyper set
16
+ KeyperSet fakeKeyperset = new KeyperSet ();
17
+ fakeKeyperset.setFinalized ();
18
+ ksm.addKeyperSet (0 , address (fakeKeyperset));
29
19
30
- function deployKeyperSetManager () public {
31
- keyperSetManager = new KeyperSetManager ();
32
- keyperSetManager.addKeyperSet (0 , address (keyperSet));
20
+ console.log ("KeyperSetManager: " , address (ksm));
21
+ return ksm;
33
22
}
34
23
35
- function deployKeyBroadcastContract () public {
36
- keyBroadcastContract = new KeyBroadcastContract (
37
- address (keyperSetManager)
38
- );
24
+ function deployKeyBroadcastContract (
25
+ KeyperSetManager ksm
26
+ ) public returns (KeyBroadcastContract) {
27
+ KeyBroadcastContract kbc = new KeyBroadcastContract (address (ksm));
28
+ console.log ("KeyBroadcastContract: " , address (kbc));
29
+ return kbc;
39
30
}
40
31
41
- function deploySequencer () public {
42
- sequencer = new Sequencer ();
32
+ function deploySequencer () public returns (Sequencer) {
33
+ Sequencer s = new Sequencer ();
34
+ console.log ("Sequencer: " , address (s));
35
+ return s;
43
36
}
44
37
45
- function deployValidatorRegistry () public {
46
- validatorRegistry = new ValidatorRegistry ();
38
+ function deployValidatorRegistry () public returns (ValidatorRegistry) {
39
+ ValidatorRegistry vr = new ValidatorRegistry ();
40
+ console.log ("ValidatorRegistry: " , address (vr));
41
+ return vr;
47
42
}
48
43
49
44
function run () external {
50
- uint256 deployerPrivateKey = vm.envUint ("PRIVATE_KEY " );
51
- vm.startBroadcast (deployerPrivateKey);
52
- deployKeyperSet ();
53
- deployKeyperSetManager ();
54
- deployKeyBroadcastContract ();
45
+ uint256 deployKey = vm.envUint ("DEPLOY_KEY " );
46
+ address deployerAddress = vm.addr (deployKey);
47
+ console.log ("Deployer: " , deployerAddress);
48
+ vm.startBroadcast (deployKey);
49
+
50
+ KeyperSetManager ksm = deployKeyperSetManager ();
51
+ deployKeyBroadcastContract (ksm);
55
52
deploySequencer ();
56
53
deployValidatorRegistry ();
54
+
57
55
vm.stopBroadcast ();
58
56
}
59
57
}
0 commit comments