-
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.
minor: add deploy.sh and upgrade.sh to avoid error
- Loading branch information
1 parent
fc0e83d
commit 3c7e2cd
Showing
7 changed files
with
96 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,3 +33,4 @@ yarn.lock | |
# coverage stuff | ||
coverage/ | ||
lcov.info | ||
**/*.env |
Empty file.
Empty file.
Empty file.
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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/bash | ||
|
||
# Check for arguments | ||
if [ -z "$1" ] || [ -z "$2" ] ; then | ||
echo "Usage: npm run deploy -- <token> <chain>" | ||
# Example: | ||
# npm run deploy -- tnusd eth-mainnet | ||
# npm run deploy -- tnsgd eth-sepolia | ||
# npm run deploy -- tnusd op-mainnet | ||
# npm run deploy -- tnusd op-sepolia | ||
exit 1 | ||
fi | ||
|
||
# Assign arguments to variables | ||
TOKEN=$1 | ||
CHAIN=$2 | ||
ENV_FILE="config/${TOKEN}/${CHAIN}.env" | ||
ROOT_ENV_FILE="./.env" | ||
|
||
# Load environment variables from .env file | ||
if [ -f "$ENV_FILE" ]; then | ||
source $ENV_FILE | ||
|
||
# Copy the .env file to the current directory | ||
cp "$ENV_FILE" "$ROOT_ENV_FILE" | ||
|
||
# Confirm the copy was successful | ||
if [[ -f "$ROOT_ENV_FILE" ]]; then | ||
echo "File '.env' has been successfully copied to the current folder." | ||
else | ||
echo "Error: Failed to copy '.env' to the current folder." | ||
fi | ||
else | ||
echo "$ENV_FILE file not found!" | ||
exit 1 | ||
fi | ||
|
||
if [[ -n "${ETHERSCAN_API_KEY}" ]]; then | ||
echo "The environment variable ETHERSCAN_API_KEY has a value: ${ETHERSCAN_API_KEY}" | ||
# with verify | ||
forge script script/DeployFiatToken.s.sol:DeployFiatToken --rpc-url $RPC_URL --ledger --hd-paths $DERIVATION_PATH --sender $DEFAULT_ADMIN_ADDRESS --broadcast --verify --ffi -vvvv | ||
else | ||
echo "The environment variable ETHERSCAN_API_KEY is not set or is empty." | ||
# no verify | ||
forge script script/DeployFiatToken.s.sol:DeployFiatToken --rpc-url $RPC_URL --ledger --hd-paths $DERIVATION_PATH --sender $DEFAULT_ADMIN_ADDRESS --broadcast --ffi -vvvv | ||
fi |
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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/bash | ||
|
||
# Check for arguments | ||
if [ -z "$1" ] || [ -z "$2" ] ; then | ||
echo "Usage: npm run deploy -- <token> <chain>" | ||
# Example: | ||
# npm run deploy -- tnusd eth-mainnet | ||
# npm run deploy -- tnsgd eth-sepolia | ||
# npm run deploy -- tnusd op-mainnet | ||
# npm run deploy -- tnusd op-sepolia | ||
exit 1 | ||
fi | ||
|
||
# Assign arguments to variables | ||
TOKEN=$1 | ||
CHAIN=$2 | ||
ENV_FILE="config/${TOKEN}/${CHAIN}.env" | ||
ROOT_ENV_FILE="./.env" | ||
|
||
# Load environment variables from .env file | ||
if [ -f "$ENV_FILE" ]; then | ||
source $ENV_FILE | ||
|
||
# Copy the .env file to the current directory | ||
cp "$ENV_FILE" "$ROOT_ENV_FILE" | ||
|
||
# Confirm the copy was successful | ||
if [[ -f "$ROOT_ENV_FILE" ]]; then | ||
echo "File '.env' has been successfully copied to the current folder." | ||
else | ||
echo "Error: Failed to copy '.env' to the current folder." | ||
fi | ||
else | ||
echo "$ENV_FILE file not found!" | ||
exit 1 | ||
fi | ||
|
||
if [[ -n "${ETHERSCAN_API_KEY}" ]]; then | ||
echo "The environment variable ETHERSCAN_API_KEY has a value: ${ETHERSCAN_API_KEY}" | ||
# with verify | ||
forge script script/UpgradeFiatToken.s.sol:UpgradeFiatToken --rpc-url $RPC_URL --ledger --hd-paths $DERIVATION_PATH --sender $DEFAULT_ADMIN_ADDRESS --broadcast --verify --ffi -vvvv | ||
else | ||
echo "The environment variable ETHERSCAN_API_KEY is not set or is empty." | ||
# no verify | ||
forge script script/UpgradeFiatToken.s.sol:UpgradeFiatToken --rpc-url $RPC_URL --ledger --hd-paths $DERIVATION_PATH --sender $DEFAULT_ADMIN_ADDRESS --broadcast --ffi -vvvv | ||
fi |