Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: updates to node deploy script #546

Merged
merged 5 commits into from
Feb 24, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion contracts/script/DeployGroupMessages.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ contract DeployGroupMessages is Script, Utils, Environment {
function run() external {
admin = vm.envAddress("XMTP_GROUP_MESSAGES_ADMIN_ADDRESS");
require(admin != address(0), "XMTP_GROUP_MESSAGES_ADMIN_ADDRESS not set");
require(admin.code.length == 0, "admin address is a contract, not an EOA");

uint256 privateKey = vm.envUint("PRIVATE_KEY");
require(privateKey != 0, "PRIVATE_KEY not set");

deployer = vm.addr(privateKey);
vm.startBroadcast(privateKey);

Expand Down
3 changes: 2 additions & 1 deletion contracts/script/DeployIdentityUpdates.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ contract DeployIdentityUpdates is Script, Utils, Environment {
function run() external {
admin = vm.envAddress("XMTP_IDENTITY_UPDATES_ADMIN_ADDRESS");
require(admin != address(0), "XMTP_IDENTITY_UPDATES_ADMIN_ADDRESS not set");
require(admin.code.length == 0, "admin address is a contract, not an EOA");

uint256 privateKey = vm.envUint("PRIVATE_KEY");
require(privateKey != 0, "PRIVATE_KEY not set");

deployer = vm.addr(privateKey);
vm.startBroadcast(privateKey);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ contract Deployer is Script {

function run() public {
vm.startBroadcast();
new Nodes(msg.sender);

new Nodes();
vm.broadcast();
}
}
}
51 changes: 51 additions & 0 deletions contracts/script/DeployNodeRegistryV2.s.sol
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/Nodes.sol";

contract DeployXMTPNodeRegistry is Script, Environment, Utils {
Nodes 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 Nodes(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);
}
}
1 change: 1 addition & 0 deletions contracts/script/utils/Environment.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ import "forge-std/src/Script.sol";
contract Environment is Script {
string public constant XMTP_GROUP_MESSAGES_OUTPUT_JSON = "GroupMessages";
string public constant XMTP_IDENTITY_UPDATES_OUTPUT_JSON = "IdentityUpdates";
string public constant XMTP_NODE_REGISTRY_OUTPUT_JSON = "XMTPNodeRegistry";
}