Skip to content

Commit

Permalink
Merge pull request #13 from Layr-Labs/samlaf/add-deploy-script-for-sh…
Browse files Browse the repository at this point in the history
…ared-contracts

added deploy script for shared contracts
  • Loading branch information
stevennevins authored Oct 19, 2023
2 parents 164fc6a + b037a81 commit b158095
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ node_modules/
/broadcast/*/31337/
/broadcast/**/dry-run/

# Ignore local chain deployment output files
!script/output/31337
script/output/31337/**

# Docs
docs/

Expand Down
1 change: 1 addition & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
src = "src"
out = "out"
libs = ["lib"]
fs_permissions = [{ access = "read-write", path = "./" }]

# See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options
50 changes: 50 additions & 0 deletions script/DeploySharedContracts.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity =0.8.12;

import "../src/BLSPublicKeyCompendium.sol";
import "../src/BLSOperatorStateRetriever.sol";

import "forge-std/Script.sol";
import "forge-std/Test.sol";

// # To load the variables in the .env file
// source .env

// # To deploy and verify our contract
// forge script script/DeploySharedContracts.s.sol --rpc-url $RPC_URL --private-key $PRIVATE_KEY --broadcast
contract DeploySharedContracts is Script, Test {
Vm cheats = Vm(HEVM_ADDRESS);

BLSPublicKeyCompendium public blsPublicKeyCompendium;
BLSOperatorStateRetriever public blsOperatorStateRetriever;

function run() external {
vm.startBroadcast();
blsPublicKeyCompendium = new BLSPublicKeyCompendium();
blsOperatorStateRetriever = new BLSOperatorStateRetriever();
vm.stopBroadcast();

string memory deployed_addresses = "addresses";
vm.serializeAddress(
deployed_addresses,
"blsOperatorStateRetriever",
address(blsOperatorStateRetriever)
);
string memory finalJson = vm.serializeAddress(
deployed_addresses,
"blsPublicKeyCompendium",
address(blsPublicKeyCompendium)
);
vm.writeJson(finalJson, outputFileName());
}

function outputFileName() internal view returns (string memory) {
return
string.concat(
vm.projectRoot(),
"/script/output/",
vm.toString(block.chainid),
"/shared_contracts_deployment_data.json"
);
}
}

0 comments on commit b158095

Please sign in to comment.