1
1
#! /bin/bash
2
2
set -exu
3
3
4
+ # If REGISTRY_CONTRACT_ADDRESS is already set, skip deployment and just write the file
5
+ if [ -n " ${REGISTRY_CONTRACT_ADDRESS:- } " ]; then
6
+ echo " Registry address already set. Skipping deployment."
7
+ # Write the addresses to a file in the shared volume
8
+ cat << EOF >/shared/contracts/contracts.env
9
+ export REGISTRY_CONTRACT_ADDRESS=$REGISTRY_CONTRACT_ADDRESS
10
+ EOF
11
+ cat /shared/contracts/contracts.env
12
+ exit 0
13
+ fi
14
+
4
15
SALT=${1:- $RANDOM }
5
16
CHAIN_ID=$2
6
17
VALIDATOR_ADDRESSES=$3
@@ -9,10 +20,15 @@ VALIDATOR_ADDRESSES=$3
9
20
output=" "
10
21
MAX_RETRIES=5
11
22
RETRY_DELAY=15
23
+ TEST_ACCOUNTS=${TEST_ACCOUNTS:- false}
24
+ TEST_ACCOUNTS_ARG=" "
25
+ if [ " $TEST_ACCOUNTS " = " true" ]; then
26
+ TEST_ACCOUNTS_ARG=" --test-accounts"
27
+ fi
12
28
13
29
for attempt in $( seq 1 $MAX_RETRIES ) ; do
14
30
# Construct base command
15
- base_cmd=" LOG_LEVEL=debug node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js deploy-l1-contracts --test-accounts "
31
+ base_cmd=" LOG_LEVEL=debug node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js deploy-l1-contracts $TEST_ACCOUNTS_ARG "
16
32
17
33
# Add account - use private key if set, otherwise use mnemonic
18
34
if [ -n " ${L1_DEPLOYMENT_PRIVATE_KEY:- } " ]; then
@@ -38,32 +54,12 @@ done || {
38
54
echo " $output "
39
55
40
56
# Extract contract addresses using grep and regex
41
- rollup_address=$( echo " $output " | grep -oP ' Rollup Address: \K0x[a-fA-F0-9]{40}' )
42
57
registry_address=$( echo " $output " | grep -oP ' Registry Address: \K0x[a-fA-F0-9]{40}' )
43
- inbox_address=$( echo " $output " | grep -oP ' L1 -> L2 Inbox Address: \K0x[a-fA-F0-9]{40}' )
44
- outbox_address=$( echo " $output " | grep -oP ' L2 -> L1 Outbox Address: \K0x[a-fA-F0-9]{40}' )
45
- fee_juice_address=$( echo " $output " | grep -oP ' Fee Juice Address: \K0x[a-fA-F0-9]{40}' )
46
- staking_asset_address=$( echo " $output " | grep -oP ' Staking Asset Address: \K0x[a-fA-F0-9]{40}' )
47
- fee_juice_portal_address=$( echo " $output " | grep -oP ' Fee Juice Portal Address: \K0x[a-fA-F0-9]{40}' )
48
- coin_issuer_address=$( echo " $output " | grep -oP ' CoinIssuer Address: \K0x[a-fA-F0-9]{40}' )
49
- reward_distributor_address=$( echo " $output " | grep -oP ' RewardDistributor Address: \K0x[a-fA-F0-9]{40}' )
50
- governance_proposer_address=$( echo " $output " | grep -oP ' GovernanceProposer Address: \K0x[a-fA-F0-9]{40}' )
51
- governance_address=$( echo " $output " | grep -oP ' Governance Address: \K0x[a-fA-F0-9]{40}' )
52
58
slash_factory_address=$( echo " $output " | grep -oP ' SlashFactory Address: \K0x[a-fA-F0-9]{40}' )
53
59
54
60
# Write the addresses to a file in the shared volume
55
61
cat << EOF >/shared/contracts/contracts.env
56
- export ROLLUP_CONTRACT_ADDRESS=$rollup_address
57
62
export REGISTRY_CONTRACT_ADDRESS=$registry_address
58
- export INBOX_CONTRACT_ADDRESS=$inbox_address
59
- export OUTBOX_CONTRACT_ADDRESS=$outbox_address
60
- export FEE_JUICE_CONTRACT_ADDRESS=$fee_juice_address
61
- export STAKING_ASSET_CONTRACT_ADDRESS=$staking_asset_address
62
- export FEE_JUICE_PORTAL_CONTRACT_ADDRESS=$fee_juice_portal_address
63
- export COIN_ISSUER_CONTRACT_ADDRESS=$coin_issuer_address
64
- export REWARD_DISTRIBUTOR_CONTRACT_ADDRESS=$reward_distributor_address
65
- export GOVERNANCE_PROPOSER_CONTRACT_ADDRESS=$governance_proposer_address
66
- export GOVERNANCE_CONTRACT_ADDRESS=$governance_address
67
63
export SLASH_FACTORY_CONTRACT_ADDRESS=$slash_factory_address
68
64
EOF
69
65
0 commit comments