Skip to content

Commit

Permalink
shutter-service: added combined deploy script
Browse files Browse the repository at this point in the history
  • Loading branch information
blockchainluffy committed Dec 26, 2024
1 parent f9d4575 commit f62ce80
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions script/Deploy.service.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "forge-std/Script.sol";
import "../src/common/KeyBroadcastContract.sol";
import "../src/common/KeyperSet.sol";
import "../src/common/KeyperSetManager.sol";
import "../src/shutter-service/ShutterRegistry.sol";

contract Deploy is Script {
function deployKeyperSetManager(
address deployerAddress
) public returns (KeyperSetManager) {
KeyperSetManager ksm = new KeyperSetManager(deployerAddress);

// add bootstrap keyper set
KeyperSet fakeKeyperset = new KeyperSet();
fakeKeyperset.setFinalized();
ksm.addKeyperSet(0, address(fakeKeyperset));

console.log("KeyperSetManager:", address(ksm));
return ksm;
}

function deployKeyBroadcastContract(
KeyperSetManager ksm
) public returns (KeyBroadcastContract) {
KeyBroadcastContract kbc = new KeyBroadcastContract(address(ksm));
console.log("KeyBroadcastContract:", address(kbc));
return kbc;
}

function deployRegistry() public returns (ShutterRegistry) {
ShutterRegistry s = new ShutterRegistry();
console.log("Registry:", address(s));
return s;
}

function run() external {
uint256 deployKey = vm.envUint("DEPLOY_KEY");
address deployerAddress = vm.addr(deployKey);
console.log("Deployer:", deployerAddress);
vm.startBroadcast(deployKey);

KeyperSetManager ksm = deployKeyperSetManager(deployerAddress);
deployKeyBroadcastContract(ksm);
deployRegistry();

vm.stopBroadcast();
}
}

0 comments on commit f62ce80

Please sign in to comment.