-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: updates to node deploy script (#546)
Closes #542 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a new deployment workflow for the node registry that automatically produces a JSON summary of deployment data. - Expanded the environment configuration with additional output parameters. - **Refactor** - Updated validations in the deployment process to ensure necessary credentials are provided. - Streamlined the contract initialization process for a more flexible and robust deployment experience. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
- Loading branch information
Showing
5 changed files
with
57 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,4 +12,4 @@ contract Deployer is Script { | |
new Nodes(); | ||
vm.broadcast(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.28; | ||
|
||
import {Script, console} from "forge-std/src/Script.sol"; | ||
import {Environment} from "./utils/Environment.sol"; | ||
import {Utils} from "./utils/Utils.sol"; | ||
import "src/interfaces/INodes.sol"; | ||
import "src/NodesV2.sol"; | ||
|
||
contract DeployXMTPNodeRegistry is Script, Environment, Utils { | ||
NodesV2 nodes; | ||
|
||
address admin; | ||
address deployer; | ||
|
||
function run() public { | ||
admin = vm.envAddress("XMTP_NODE_REGISTRY_ADMIN_ADDRESS"); | ||
require(admin != address(0), "XMTP_NODE_REGISTRY_ADMIN_ADDRESS not set"); | ||
|
||
uint256 privateKey = vm.envUint("PRIVATE_KEY"); | ||
require(privateKey != 0, "PRIVATE_KEY not set"); | ||
|
||
deployer = vm.addr(privateKey); | ||
vm.startBroadcast(privateKey); | ||
|
||
nodes = new NodesV2(admin); | ||
require(address(nodes) != address(0), "Nodes deployment failed"); | ||
|
||
vm.stopBroadcast(); | ||
|
||
_serializeDeploymentData(); | ||
} | ||
|
||
function _serializeDeploymentData() internal { | ||
string memory parent_object = "parent object"; | ||
string memory addresses = "addresses"; | ||
|
||
string memory addressesOutput; | ||
|
||
addressesOutput = vm.serializeAddress(addresses, "XMTPNodeRegistryDeployer", deployer); | ||
addressesOutput = vm.serializeAddress(addresses, "XMTPNodeRegistryInitialAdmin", admin); | ||
addressesOutput = vm.serializeAddress(addresses, "XMTPNodeRegistry", address(nodes)); | ||
|
||
string memory finalJson; | ||
finalJson = vm.serializeString(parent_object, addresses, addressesOutput); | ||
finalJson = vm.serializeUint(parent_object, "deploymentBlock", block.number); | ||
finalJson = vm.serializeUint(parent_object, "latestUpgradeBlock", block.number); | ||
|
||
writeOutput(finalJson, XMTP_NODE_REGISTRY_OUTPUT_JSON); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters