Skip to content

Commit

Permalink
fix: check addresses exist
Browse files Browse the repository at this point in the history
  • Loading branch information
parketh committed Nov 22, 2024
1 parent b30f4fb commit de1adc3
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions scripts/l2/l2-gen-addresses.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,16 @@ output=$($WALLETS_SCRIPT)
# Path to the .env file
ENV_FILE="$(pwd)/.env"

# Source the .env file
source "$ENV_FILE"

# Check if any addresses already exist in the .env file
check_addresses_exist() {
for role in ADMIN BATCHER PROPOSER; do
if grep -q "^GS_${role}_ADDRESS=." "$ENV_FILE" || \
grep -q "^GS_${role}_PRIVATE_KEY=." "$ENV_FILE"; then
address_var="GS_${role}_ADDRESS"
private_key_var="GS_${role}_PRIVATE_KEY"

if [[ -n "${!address_var}" ]] || [[ -n "${!private_key_var}" ]]; then
return 0
fi
done
Expand Down Expand Up @@ -64,9 +69,6 @@ fund_address() {
--value "$amount" "$address"
}

# Source the .env file
source "$ENV_FILE"

# Fund the generated addresses
for role in ADMIN BATCHER PROPOSER; do
address_var="GS_${role}_ADDRESS"
Expand Down

0 comments on commit de1adc3

Please sign in to comment.