-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Amend salt scripts to work without AtomicAuctionHouse deployment
- Loading branch information
Showing
3 changed files
with
51 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,50 @@ | ||
#!/bin/bash | ||
|
||
# Usage: | ||
# ./allowlist_salts.sh <atomic | batch> | ||
# ./allowlist_salts.sh --type <atomic | batch> --envFile <.env> | ||
# | ||
# Expects the following environment variables: | ||
# CHAIN: The chain to deploy to, based on values from the ./script/env.json file. | ||
|
||
# Load environment variables, but respect overrides | ||
curenv=$(declare -p -x) | ||
source .env | ||
eval "$curenv" | ||
# Iterate through named arguments | ||
# Source: https://unix.stackexchange.com/a/388038 | ||
while [ $# -gt 0 ]; do | ||
if [[ $1 == *"--"* ]]; then | ||
v="${1/--/}" | ||
declare $v="$2" | ||
fi | ||
|
||
# Get command-line arguments | ||
MODE=$1 | ||
shift | ||
done | ||
|
||
# Get the name of the .env file or use the default | ||
ENV_FILE=${envFile:-".env"} | ||
echo "Sourcing environment variables from $ENV_FILE" | ||
|
||
# Load environment file | ||
set -a # Automatically export all variables | ||
source $ENV_FILE | ||
set +a # Disable automatic export | ||
|
||
# Check that the CHAIN environment variable is set | ||
if [ -z "$CHAIN" ] | ||
then | ||
echo "CHAIN environment variable is not set. Please set it in the .env file or provide it as an environment variable." | ||
exit 1 | ||
fi | ||
|
||
# Check that the mode is "atomic" or "batch" | ||
if [ "$MODE" != "atomic" ] && [ "$MODE" != "batch" ] | ||
if [ "$type" != "atomic" ] && [ "$type" != "batch" ] | ||
then | ||
echo "Invalid mode specified. Provide 'atomic' or 'batch' after the command as argument 2." | ||
echo "Invalid type specified. Provide 'atomic' or 'batch' after the --type flag." | ||
exit 1 | ||
fi | ||
|
||
# Set flag for atomic or batch auction | ||
ATOMIC=$( if [ "$MODE" == "atomic" ]; then echo "true"; else echo "false"; fi ) | ||
ATOMIC=$( if [ "$type" == "atomic" ]; then echo "true"; else echo "false"; fi ) | ||
|
||
echo "Using RPC at URL: $RPC_URL" | ||
echo "Using chain: $CHAIN" | ||
echo "Using variant: $MODE" | ||
echo "Using type: $type" | ||
|
||
forge script ./script/salts/allowlist/AllowListSalts.s.sol:AllowlistSalts --sig "generate(string,bool)()" $CHAIN $ATOMIC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters