Skip to content

Commit 3202784

Browse files
MegaRedHanduri-99
andauthored
chore: output BatcherPaymentService addresses as JSON (#1698)
Co-authored-by: Uriel Mihura <[email protected]>
1 parent 5d4c5e5 commit 3202784

File tree

7 files changed

+32
-30
lines changed

7 files changed

+32
-30
lines changed

contracts/script/deploy/BatcherPaymentServiceDeployer.s.sol

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,15 @@ import "forge-std/Script.sol";
88
import "forge-std/StdJson.sol";
99

1010
contract BatcherPaymentServiceDeployer is Script {
11-
function run(
12-
string memory batcherConfigPath
13-
) external returns (address, address) {
11+
function run(string memory batcherConfigPath, string memory outputPath) external returns (address, address) {
1412
// READ JSON CONFIG DATA
1513
string memory config_data = vm.readFile(batcherConfigPath);
1614

17-
address batcherWallet = stdJson.readAddress(
18-
config_data,
19-
".address.batcherWallet"
20-
);
15+
address batcherWallet = stdJson.readAddress(config_data, ".address.batcherWallet");
2116

22-
address alignedLayerServiceManager = stdJson.readAddress(
23-
config_data,
24-
".address.alignedLayerServiceManager"
25-
);
17+
address alignedLayerServiceManager = stdJson.readAddress(config_data, ".address.alignedLayerServiceManager");
2618

27-
address batcherPaymentServiceOwner = stdJson.readAddress(
28-
config_data,
29-
".permissions.owner"
30-
);
19+
address batcherPaymentServiceOwner = stdJson.readAddress(config_data, ".permissions.owner");
3120

3221
vm.startBroadcast();
3322

@@ -45,6 +34,15 @@ contract BatcherPaymentServiceDeployer is Script {
4534

4635
vm.stopBroadcast();
4736

37+
string memory addresses = "addresses";
38+
vm.serializeAddress(addresses, "batcherPaymentService", address(proxy));
39+
string memory addressesStr =
40+
vm.serializeAddress(addresses, "batcherPaymentServiceImplementation", address(batcherPaymentService));
41+
42+
string memory parentObject = "parent";
43+
string memory finalJson = vm.serializeString(parentObject, "addresses", addressesStr);
44+
vm.writeJson(finalJson, outputPath);
45+
4846
return (address(proxy), address(batcherPaymentService));
4947
}
5048
}

contracts/scripts/.env.example.holesky

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ DEPLOY_CONFIG_PATH=./script/deploy/config/holesky/aligned.holesky.config.json
55
OUTPUT_PATH=./script/output/holesky/alignedlayer_deployment_output.json
66
ETHERSCAN_API_KEY=<etherscan_api_key>
77
BATCHER_PAYMENT_SERVICE_CONFIG_PATH=./script/deploy/config/holesky/batcher-payment-service.holesky.config.json
8+
BATCHER_PAYMENT_SERVICE_OUTPUT_PATH=./script/output/holesky/batcher_deployment_output.json
89
MULTISIG=<false|true>

contracts/scripts/.env.holesky

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ PRIVATE_KEY=<YOUR_PRIVATE_KEY>
33
EXISTING_DEPLOYMENT_INFO_PATH=./script/output/holesky/eigenlayer_deployment_output.json
44
DEPLOY_CONFIG_PATH=./script/deploy/config/holesky/aligned.holesky.config.json
55
BATCHER_PAYMENT_SERVICE_CONFIG_PATH=./script/deploy/config/holesky/batcher-payment-service.holesky.config.json
6+
BATCHER_PAYMENT_SERVICE_OUTPUT_PATH=./script/output/holesky/batcher_deployment_output.json
67
OUTPUT_PATH=./script/output/holesky/alignedlayer_deployment_output.json
78
ETHERSCAN_API_KEY=<YOUR_ETHERSCAN_API_KEY>
8-
MULTISIG=false
9+
MULTISIG=false

contracts/scripts/.env.mainnet

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ PRIVATE_KEY=<YOUR_PRIVATE_KEY>
33
EXISTING_DEPLOYMENT_INFO_PATH=./script/output/mainnet/eigenlayer_deployment_output.json
44
DEPLOY_CONFIG_PATH=./script/deploy/config/mainnet/aligned.mainnet.config.json
55
BATCHER_PAYMENT_SERVICE_CONFIG_PATH=./script/deploy/config/mainnet/batcher-payment-service.mainnet.config.json
6+
BATCHER_PAYMENT_SERVICE_OUTPUT_PATH=./script/output/mainnet/batcher_deployment_output.json
67
OUTPUT_PATH=./script/output/mainnet/alignedlayer_deployment_output.json
78
ETHERSCAN_API_KEY=<YOUR_ETHERSCAN_API_KEY>
8-
MULTISIG=false
9+
MULTISIG=false

contracts/scripts/.env.sepolia

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ PRIVATE_KEY=<YOUR_PRIVATE_KEY>
33
EXISTING_DEPLOYMENT_INFO_PATH=./script/output/sepolia/eigenlayer_deployment_output.json
44
DEPLOY_CONFIG_PATH=./script/deploy/config/sepolia/aligned.sepolia.config.json
55
BATCHER_PAYMENT_SERVICE_CONFIG_PATH=./script/deploy/config/sepolia/batcher-payment-service.sepolia.config.json
6+
BATCHER_PAYMENT_SERVICE_OUTPUT_PATH=./script/output/sepolia/batcher_deployment_output.json
67
OUTPUT_PATH=./script/output/sepolia/alignedlayer_deployment_output.json
78
ETHERSCAN_API_KEY=<YOUR_ETHERSCAN_API_KEY>
8-
MULTISIG=false
9+
MULTISIG=false

contracts/scripts/anvil/deploy_aligned_contracts.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,20 @@ forge script ../examples/verify/script/VerifyBatchInclusionCallerDeployer.s.sol
3535
--broadcast \
3636
--sig "run(address _targetContract)"
3737

38+
output_path=./script/output/devnet/batcher_deployment_output.json
39+
3840
# Deploy Batcher Payments Contract
39-
forge_output=$(forge script script/deploy/BatcherPaymentServiceDeployer.s.sol \
41+
forge script script/deploy/BatcherPaymentServiceDeployer.s.sol \
4042
./script/deploy/config/devnet/batcher-payment-service.devnet.config.json \
43+
$output_path \
4144
--rpc-url "http://localhost:8545" \
4245
--private-key "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" \
4346
--broadcast \
44-
--sig "run(string batcherConfigPath)")
47+
--sig "run(string batcherConfigPath, string outputPath)"
4548

4649
# Extract the batcher payment service values from the output
47-
# new_aligned_layer_service_manager_implementation=$(echo "$forge_output" | awk '/1: address/ {print $3}')
48-
batcher_payment_service_proxy=$(echo "$forge_output" | awk '/0: address/ {print $3}')
49-
batcher_payment_service_implementation=$(echo "$forge_output" | awk '/1: address/ {print $3}')
50+
batcher_payment_service_proxy=$(jq -r '.addresses.batcherPaymentService' $output_path)
51+
batcher_payment_service_implementation=$(jq -r '.addresses.batcherPaymentServiceImplementation' $output_path)
5052

5153
# Give initial funds to ServiceManager for the Batcher
5254
cast send $ALIGNED_LAYER_SERVICE_MANAGER_ADDRESS "depositToBatcher(address)()" $batcher_payment_service_proxy --value 1ether --private-key "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" --rpc-url "http://localhost:8545"

contracts/scripts/deploy_batcher_payment_service.sh

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,20 @@ cd ../
1111
source scripts/.env
1212

1313
# Deploy Batcher Payments Contract
14-
forge_output=$(forge script script/deploy/BatcherPaymentServiceDeployer.s.sol \
14+
forge script script/deploy/BatcherPaymentServiceDeployer.s.sol \
1515
$BATCHER_PAYMENT_SERVICE_CONFIG_PATH \
16+
$BATCHER_PAYMENT_SERVICE_OUTPUT_PATH \
1617
--rpc-url $RPC_URL \
1718
--private-key $PRIVATE_KEY \
1819
--broadcast \
1920
--legacy \
2021
--verify \
2122
--etherscan-api-key $ETHERSCAN_API_KEY \
22-
--sig "run(string memory batcherConfigPath)")
23-
24-
echo "$forge_output"
23+
--sig "run(string memory batcherConfigPath, string memory outputPath)"
2524

2625
# Extract the batcher payment service values from the output
27-
# new_aligned_layer_service_manager_implementation=$(echo "$forge_output" | awk '/1: address/ {print $3}')
28-
batcher_payment_service_proxy=$(echo "$forge_output" | awk '/0: address/ {print $3}')
29-
batcher_payment_service_implementation=$(echo "$forge_output" | awk '/1: address/ {print $3}')
26+
batcher_payment_service_proxy=$(jq -r '.addresses.batcherPaymentService' $BATCHER_PAYMENT_SERVICE_OUTPUT_PATH)
27+
batcher_payment_service_implementation=$(jq -r '.addresses.batcherPaymentServiceImplementation' $BATCHER_PAYMENT_SERVICE_OUTPUT_PATH)
3028

3129
# Use the extracted value to replace the batcher payment service values in alignedlayer_deployment_output.json and save it to a temporary file
3230
jq --arg batcher_payment_service_proxy "$batcher_payment_service_proxy" '.addresses.batcherPaymentService = $batcher_payment_service_proxy' $OUTPUT_PATH > $OUTPUT_PATH.temp2

0 commit comments

Comments
 (0)