Skip to content

Commit 41e56e4

Browse files
committed
add scripts + guide
1 parent 8ab0376 commit 41e56e4

File tree

3 files changed

+114
-0
lines changed

3 files changed

+114
-0
lines changed

Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,16 @@ upgrade_add_aggregator: ## Add Aggregator to Aligned Contracts
600600
@echo "Adding Aggregator to Aligned Contracts..."
601601
@. contracts/scripts/.env && . contracts/scripts/upgrade_add_aggregator_to_service_manager.sh
602602

603+
set_aggregator_address: ## Add Aggregator to Aligned Contracts
604+
@echo "Setting Aggregator Address in Aligned Service Manager Contract..."
605+
@echo "Aggregator address: $(AGGREGATOR_ADDRESS)"
606+
@. contracts/scripts/.env && . contracts/scripts/set_aggregator_address.sh $(AGGREGATOR_ADDRESS)
607+
608+
set_aggregator_address_devnet: ## Add Aggregator to Aligned Contracts
609+
@echo "Setting Aggregator Address in Aligned Service Manager Contract..."
610+
@echo "Aggregator address: $(AGGREGATOR_ADDRESS)"
611+
RPC_URL="http://localhost:8545" PRIVATE_KEY="0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" OUTPUT_PATH=./script/output/devnet/alignedlayer_deployment_output.json ./contracts/scripts/set_aggregator_address.sh $(AGGREGATOR_ADDRESS)
612+
603613
upgrade_initialize_disabled_verifiers:
604614
@echo "Adding disabled verifiers to Aligned Service Manager..."
605615
@. contracts/scripts/.env && . contracts/scripts/upgrade_disabled_verifiers_in_service_manager.sh
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/bash
2+
3+
# cd to the directory of this script so that this can be run from anywhere
4+
parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
5+
# At this point we are in contracts/scripts
6+
cd "$parent_path"
7+
8+
# At this point we are in contracts
9+
cd ../
10+
11+
# Check if the number of arguments is correct
12+
if [ "$#" -ne 1 ]; then
13+
echo "Usage: set_aggregator_address.sh <AGGREGATOR_ADDRESS>"
14+
exit 1
15+
fi
16+
17+
AGGREGATOR_ADDRESS=$1
18+
19+
# Read the service manager address from the JSON file
20+
SERVICE_MANAGER=$(jq -r '.addresses.alignedLayerServiceManager' "$OUTPUT_PATH")
21+
22+
# Check if the servide manager address is empty
23+
if [ -z "$SERVICE_MANAGER" ]; then
24+
echo "Service manager address is empty"
25+
exit 1
26+
fi
27+
28+
# Check if the Ethereum RPC URL is empty
29+
if [ -z "$RPC_URL" ]; then
30+
echo "Ethereum RPC URL is empty"
31+
exit 1
32+
fi
33+
34+
# Check if the private key is empty
35+
if [ -z "$PRIVATE_KEY" ]; then
36+
echo "Private key is empty"
37+
exit 1
38+
fi
39+
40+
# Call the setAggregator(address _alignedAggregator) function on the contract
41+
cast send \
42+
--private-key=$PRIVATE_KEY \
43+
--rpc-url=$RPC_URL \
44+
$SERVICE_MANAGER "setAggregator(address)" \
45+
$AGGREGATOR_ADDRESS
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Pausable
2+
This doc contains a guide on how to call `setAggregator(address)` to set the `alignedAggregator` value of the AlignedServiceManager.sol contract.
3+
4+
### NOTE:
5+
- This guide assumes the Aligned layer contracts have been sucessfully deployed and the deployment outputs are within `./contracts/script/output/<DEPLOYMENT_FOLDER>
6+
7+
## Locate the deployed Aligned Aggregator Address
8+
9+
The address of Aligned Aggregator can be found in `./contracts/script/output/<DEPLOYMENT_FOLDER>/aligned_deployment_output.json` within
10+
```
11+
"permissions": {
12+
...
13+
"alignedLayerAggregator": "<AGGREGATOR_ADDRESS",
14+
...
15+
}
16+
```
17+
18+
## Locate the Aligend Service Manager Address
19+
20+
The address of Aligned Service Manager can be found in `./contracts/script/output/<DEPLOYMENT_FOLDER>/aligned_deployment_output.json` within
21+
```
22+
"addresses": {
23+
...
24+
"alignedLayerServiceManager": "<ALIGNED_SERVICE_MANAGER_ADDRESS",
25+
...
26+
}
27+
```
28+
29+
## Set Environment Variables
30+
31+
To run the make targets specified in this guide, you must first set the following env vars within `./contracts/scripts/.env`:
32+
```
33+
export RPC_URL=<rpc_url>
34+
export PRIVATE_KEY=<aligned_service_manager_pauser_private_key>
35+
export ALIGNED_SERVICE_MANAGER_ADDRESS=<aligned_service_manager_address>
36+
```
37+
38+
## Check the current value of `alignedAggregator` within AlignedServiceManager.sol
39+
40+
```
41+
cast call $ALIGNED_SERVICE_MANAGER_ADDRESS "alignedAggregator()(address)"
42+
```
43+
44+
You should see that the printed address matches the returned address matches the address from `./contracts/script/output/<DEPLOYMENT_FOLDER>/aligned_deployment_output.json`
45+
46+
## Change the value of `alignedAggregator` within AlignedServiceManager.sol
47+
48+
Set the environment variable `AGGREGATOR_ADDRESS` to the new address of the aggregator.
49+
```
50+
export AGGREGATOR_ADDRESS=<aggregator_address>
51+
make set_aggregator_address
52+
```
53+
54+
## Verify the Aligend Aggreagtor Address has changed
55+
```
56+
cast call $ALIGNED_SERVICE_MANAGER_ADDRESS "alignedAggregator()(address)"
57+
```
58+
59+
You should observe that the printed address matches the address in `AGGREGATOR_ADDRESS`.

0 commit comments

Comments
 (0)