-
Notifications
You must be signed in to change notification settings - Fork 396
Expand file tree
/
Copy pathupgrade.sh
More file actions
36 lines (26 loc) · 1.61 KB
/
upgrade.sh
File metadata and controls
36 lines (26 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
# cd to the directory of this script so that this can be run from anywhere
parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
cd "$parent_path"
cd ../
# Save the output to a variable to later extract the address of the new deployed contract
forge_output=$(forge script script/upgrade/ProofAggregatorServiceUpgrader.s.sol \
$EXISTING_DEPLOYMENT_INFO_PATH \
$PROOF_AGGREGATION_SERVICE_OUTPUT_PATH \
--rpc-url $RPC_URL \
--private-key $PRIVATE_KEY \
--broadcast \
--verify \
--etherscan-api-key $ETHERSCAN_API_KEY \
--sig "run(string memory alignedLayerDeploymentFilePath)")
echo "$forge_output"
# Extract the proof aggregator service values from the output
proof_aggregator_service_proxy=$(echo "$forge_output" | awk '/0: address/ {print $3}')
proof_aggregator_service_implementation=$(echo "$forge_output" | awk '/1: address/ {print $3}')
# Use the extracted value to replace the batcher payment service values in alignedlayer_deployment_output.json and save it to a temporary file
jq --arg proof_aggregator_service_implementation "$proof_aggregator_service_implementation" '.addresses.alignedProofAggregationServiceImplementation = $proof_aggregator_service_implementation' $PROOF_AGGREGATION_SERVICE_OUTPUT_PATH > "$PROOF_AGGREGATION_SERVICE_OUTPUT_PATH.temp"
# Replace the original file with the temporary file
mv "$PROOF_AGGREGATION_SERVICE_OUTPUT_PATH.temp" $PROOF_AGGREGATION_SERVICE_OUTPUT_PATH
# Delete the temporary file
rm -f "$PROOF_AGGREGATION_SERVICE_OUTPUT_PATH.temp"
echo "The new Proof Aggregator Service Implementation is $proof_aggregator_service_implementation"