Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
6ce24775
Commit
6ce24775
authored
Dec 07, 2023
by
Mark Tyneway
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
contracts-bedrock: modularize addresses abstraction
parent
13748031
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
27 deletions
+28
-27
Deploy.s.sol
packages/contracts-bedrock/scripts/Deploy.s.sol
+1
-27
Deployer.sol
packages/contracts-bedrock/scripts/Deployer.sol
+27
-0
No files found.
packages/contracts-bedrock/scripts/Deploy.s.sol
View file @
6ce24775
...
@@ -54,7 +54,7 @@ import { LibStateDiff } from "scripts/libraries/LibStateDiff.sol";
...
@@ -54,7 +54,7 @@ import { LibStateDiff } from "scripts/libraries/LibStateDiff.sol";
/// To add a new contract to the system, add a public function that deploys that individual contract.
/// To add a new contract to the system, add a public function that deploys that individual contract.
/// Then add a call to that function inside of `run`. Be sure to call the `save` function after each
/// Then add a call to that function inside of `run`. Be sure to call the `save` function after each
/// deployment so that hardhat-deploy style artifacts can be generated using a call to `sync()`.
/// deployment so that hardhat-deploy style artifacts can be generated using a call to `sync()`.
/// The `
ADDRESSES
` environment variable can be set to a path that contains a JSON file full of
/// The `
CONTRACT_ADDRESSES_PATH
` environment variable can be set to a path that contains a JSON file full of
/// contract name to address pairs. That enables this script to be much more flexible in the way
/// contract name to address pairs. That enables this script to be much more flexible in the way
/// it is used.
/// it is used.
contract Deploy is Deployer {
contract Deploy is Deployer {
...
@@ -227,32 +227,6 @@ contract Deploy is Deployer {
...
@@ -227,32 +227,6 @@ contract Deploy is Deployer {
console.log("Deploying from %s", deployScript);
console.log("Deploying from %s", deployScript);
console.log("Deployment context: %s", deploymentContext);
console.log("Deployment context: %s", deploymentContext);
// Load addresses from a JSON file if the ADDRESSES environment variable is set.
// Great for loading addresses from `superchain-registry`.
string memory addresses = vm.envOr("ADDRESSES", string(""));
if (bytes(addresses).length > 0) {
console.log("Loading addresses from %s", addresses);
_loadAddresses(addresses);
}
}
/// @notice Populates the addresses to be used in a script based on a JSON file.
/// The format of the JSON file is the same that it output by this script
/// as well as the JSON files that contain addresses in the `superchain-ops`
/// repo. The JSON key is the name of the contract and the value is an address.
function _loadAddresses(string memory _path) internal {
string[] memory commands = new string[](3);
commands[0] = "bash";
commands[1] = "-c";
commands[2] = string.concat("jq -cr < ", _path);
string memory json = string(vm.ffi(commands));
string[] memory keys = vm.parseJsonKeys(json, "");
for (uint256 i; i < keys.length; i++) {
string memory key = keys[i];
address addr = stdJson.readAddress(json, string.concat("$.", key));
save(key, addr);
}
}
}
/// @notice Deploy all of the L1 contracts necessary for a full Superchain with a single Op Chain.
/// @notice Deploy all of the L1 contracts necessary for a full Superchain with a single Op Chain.
...
...
packages/contracts-bedrock/scripts/Deployer.sol
View file @
6ce24775
...
@@ -116,8 +116,35 @@ abstract contract Deployer is Script {
...
@@ -116,8 +116,35 @@ abstract contract Deployer is Script {
vm.writeJson("{}", tempDeploymentsPath);
vm.writeJson("{}", tempDeploymentsPath);
}
}
console.log("Storing temp deployment data in %s", tempDeploymentsPath);
console.log("Storing temp deployment data in %s", tempDeploymentsPath);
// Load addresses from a JSON file if the CONTRACT_ADDRESSES_PATH environment variable
// is set. Great for loading addresses from `superchain-registry`.
string memory addresses = vm.envOr("CONTRACT_ADDRESSES_PATH", string(""));
if (bytes(addresses).length > 0) {
console.log("Loading addresses from %s", addresses);
_loadAddresses(addresses);
}
}
/// @notice Populates the addresses to be used in a script based on a JSON file.
/// The format of the JSON file is the same that it output by this script
/// as well as the JSON files that contain addresses in the `superchain-ops`
/// repo. The JSON key is the name of the contract and the value is an address.
function _loadAddresses(string memory _path) internal {
string[] memory commands = new string[](3);
commands[0] = "bash";
commands[1] = "-c";
commands[2] = string.concat("jq -cr < ", _path);
string memory json = string(vm.ffi(commands));
string[] memory keys = vm.parseJsonKeys(json, "");
for (uint256 i; i < keys.length; i++) {
string memory key = keys[i];
address addr = stdJson.readAddress(json, string.concat("$.", key));
save(key, addr);
}
}
}
/// @notice Call this function to sync the deployment artifacts such that
/// @notice Call this function to sync the deployment artifacts such that
/// hardhat deploy style artifacts are created.
/// hardhat deploy style artifacts are created.
function sync() public {
function sync() public {
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment