Skip to content

Commit 61cfd7f

Browse files
committed
fix: output of pauser registry
1 parent 8c26d54 commit 61cfd7f

File tree

2 files changed

+22
-51
lines changed

2 files changed

+22
-51
lines changed

contracts/script/deploy/PauserRegistryDeployer.s.sol

Lines changed: 2 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ contract PauserRegistryDeployer is ExistingDeploymentParser {
2121
string memory existingDeploymentInfoPath,
2222
string memory deployConfigPath,
2323
string memory outputPath
24-
) external {
24+
) external returns (address, address) {
2525
// get info on all the already-deployed contracts
2626
_parseDeployedContracts(existingDeploymentInfoPath);
2727

@@ -68,51 +68,6 @@ contract PauserRegistryDeployer is ExistingDeploymentParser {
6868
vm.stopPrank();
6969

7070
//write output
71-
_writeOutput(config_data, outputPath);
72-
}
73-
74-
function _writeOutput(string memory config_data, string memory outputPath) internal {
75-
string memory parent_object = "parent object";
76-
77-
string memory deployed_addresses = "addresses";
78-
79-
string memory deployed_addresses_output = vm.serializeAddress(
80-
deployed_addresses,
81-
"pauserRegistry",
82-
address(pauserRegistry)
83-
);
84-
85-
string memory chain_info = "chainInfo";
86-
vm.serializeUint(chain_info, "deploymentBlock", block.number);
87-
string memory chain_info_output = vm.serializeUint(
88-
chain_info,
89-
"chainId",
90-
block.chainid
91-
);
92-
93-
address pauserAddress = stdJson.readAddress(
94-
config_data,
95-
".permissions.pauser"
96-
);
97-
string memory permissions = "permissions";
98-
99-
string memory permissions_output = vm.serializeAddress(
100-
permissions,
101-
"alignedLayerPauser",
102-
pauserAddress
103-
);
104-
105-
vm.serializeString(parent_object, chain_info, chain_info_output);
106-
vm.serializeString(
107-
parent_object,
108-
deployed_addresses,
109-
deployed_addresses_output
110-
);
111-
string memory finalJson = vm.serializeString(
112-
parent_object,
113-
permissions,
114-
permissions_output
115-
);
116-
vm.writeJson(finalJson, outputPath);
71+
return(address(pauserRegistry), address(pauser));
11772
}
11873
}

contracts/scripts/deploy_pauser_registry.sh

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,31 @@ cd "$parent_path"
99
cd ../
1010

1111
# Deploy the contracts
12-
forge script script/deploy/PauserRegistryDeployer.s.sol \
12+
forge_output=$(forge script script/deploy/PauserRegistryDeployer.s.sol \
1313
$EXISTING_DEPLOYMENT_INFO_PATH \
1414
$DEPLOY_CONFIG_PATH \
1515
$OUTPUT_PATH \
1616
--rpc-url $RPC_URL \
1717
--private-key $PRIVATE_KEY \
1818
--broadcast \
1919
--sig "run(string memory existingDeploymentInfoPath, string memory deployConfigPath, string memory outputPath)" \
20-
--slow
20+
--slow)
2121

22-
# TODO fix: this deploy is overwritting the whole deployment output file,
23-
# it should only add the new contract value
22+
echo "$forge_output"
23+
24+
# Extract the pauser registry and Pauser addresses values from the output
25+
26+
pauser_registry=$(echo "$forge_output" | awk '/0: address/ {print $3}')
27+
pauser=$(echo "$forge_output" | awk '/1: address/ {print $3}')
28+
29+
# Use the extracted value to replace the batcher payment service values in alignedlayer_deployment_output.json and save it to a temporary file
30+
jq --arg pauser_registry "$pauser_registry" '.addresses.pauserRegistry = $pauser_registry' "script/output/holesky/alignedlayer_deployment_output.json" > "script/output/holesky/alignedlayer_deployment_output.temp.temp.json"
31+
jq --arg pauser "$pauser" '.permissions.alignedLayerPauser = $pauser' "script/output/holesky/alignedlayer_deployment_output.temp.temp.json" > "script/output/holesky/alignedlayer_deployment_output.temp.json"
32+
33+
34+
# Replace the original file with the temporary file
35+
mv "script/output/holesky/alignedlayer_deployment_output.temp.json" "script/output/holesky/alignedlayer_deployment_output.json"
36+
37+
# Delete the temporary file
38+
rm -f "script/output/holesky/alignedlayer_deployment_output.temp.json"
39+
rm -f "script/output/holesky/alignedlayer_deployment_output.temp.temp.json"

0 commit comments

Comments
 (0)