-
Notifications
You must be signed in to change notification settings - Fork 396
Expand file tree
/
Copy pathdeploy_aligned_contracts.sh
More file actions
executable file
·69 lines (51 loc) · 3.75 KB
/
deploy_aligned_contracts.sh
File metadata and controls
executable file
·69 lines (51 loc) · 3.75 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/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 )
# At this point we are in tests/integration
cd "$parent_path"
# Start anvil chain in the background and dump its state to a json file upon exit
anvil --load-state state/sp1-deployed-anvil-state.json --dump-state state/alignedlayer-deployed-anvil-state.json &
cd ../../
ALIGNED_LAYER_SERVICE_MANAGER_ADDRESS=$(jq -r '.addresses.alignedLayerServiceManager' ./script/output/devnet/alignedlayer_deployment_output.json)
sleep 1
# Deploy the contracts
forge script script/deploy/AlignedLayerDeployer.s.sol \
./script/output/devnet/eigenlayer_deployment_output.json \
./script/deploy/config/devnet/aligned.devnet.config.json \
./script/output/devnet/alignedlayer_deployment_output.json \
--rpc-url "http://localhost:8545" \
--private-key "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" \
--broadcast \
--sig "run(string memory existingDeploymentInfoPath, string memory deployConfigPath, string memory outputPath)"
ALIGNED_LAYER_SERVICE_MANAGER_ADDRESS=$(jq -r '.addresses.alignedLayerServiceManager' ./script/output/devnet/alignedlayer_deployment_output.json)
# Can't deploy on another script, current open issue: https://github.com/foundry-rs/foundry/issues/7952
forge script ../examples/verify/script/VerifyBatchInclusionCallerDeployer.s.sol \
"$ALIGNED_LAYER_SERVICE_MANAGER_ADDRESS" \
--rpc-url "http://localhost:8545" \
--private-key "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" \
--broadcast \
--sig "run(address _targetContract)"
output_path=./script/output/devnet/batcher_deployment_output.json
# Deploy Batcher Payments Contract
forge script script/deploy/BatcherPaymentServiceDeployer.s.sol \
./script/deploy/config/devnet/batcher-payment-service.devnet.config.json \
$output_path \
--rpc-url "http://localhost:8545" \
--private-key "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" \
--broadcast \
--sig "run(string batcherConfigPath, string outputPath)"
# Extract the batcher payment service values from the output
batcher_payment_service_proxy=$(jq -r '.addresses.batcherPaymentService' $output_path)
batcher_payment_service_implementation=$(jq -r '.addresses.batcherPaymentServiceImplementation' $output_path)
# Give initial funds to ServiceManager for the Batcher
cast send $ALIGNED_LAYER_SERVICE_MANAGER_ADDRESS "depositToBatcher(address)()" $batcher_payment_service_proxy --value 1ether --private-key "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" --rpc-url "http://localhost:8545"
# 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 batcher_payment_service_proxy "$batcher_payment_service_proxy" '.addresses.batcherPaymentService = $batcher_payment_service_proxy' "script/output/devnet/alignedlayer_deployment_output.json" > "script/output/devnet/alignedlayer_deployment_output.temp1.json"
jq --arg batcher_payment_service_implementation "$batcher_payment_service_implementation" '.addresses.batcherPaymentServiceImplementation = $batcher_payment_service_implementation' "script/output/devnet/alignedlayer_deployment_output.temp1.json" > "script/output/devnet/alignedlayer_deployment_output.temp2.json"
# Replace the original file with the temporary file
mv "script/output/devnet/alignedlayer_deployment_output.temp2.json" "script/output/devnet/alignedlayer_deployment_output.json"
# Delete the temporary file
rm -f "script/output/devnet/alignedlayer_deployment_output.temp1.json"
rm -f "script/output/devnet/alignedlayer_deployment_output.temp2.json"
# Kill the anvil process to save state
pkill anvil