Skip to content

Commit

Permalink
chore: read sender from env
Browse files Browse the repository at this point in the history
(cherry picked from commit 15e5c8cfdb44b07f027a928548632f3bc449cb97)
  • Loading branch information
superical committed Mar 26, 2024
1 parent 2146c49 commit 2375611
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
23 changes: 12 additions & 11 deletions bin/deploy.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
#!/bin/bash

if [ "$#" -lt 4 ]; then
echo "Usage: $0 network sender verify script_name [sig] [sig_params...]"
if [ "$#" -lt 3 ]; then
echo "Usage: $0 network verify script_name [sig] [sig_params...]"
exit 1
fi

source .env

NETWORK=$1
SENDER=$2
VERIFY=$3
SCRIPT=$4

# Check if the SIG which is $5 is provided and if it is then include SIG_PARAMS too
if [[ "$5" != "" && "$5" != -* ]]; then
SIG=$5
shift 5
VERIFY=$2
SCRIPT=$3

# Check if the SIG which is $4 is provided and if it is then include SIG_PARAMS too
if [[ "$4" != "" && "$5" != -* ]]; then
SIG=$4
shift 4
SIG_PARAMS=("$@")
fi

# forge command
COMMAND="forge script \"$SCRIPT\" --broadcast -i 1 -f \"$NETWORK\" --sender \"$SENDER\""
COMMAND="forge script \"$SCRIPT\" --broadcast -i 1 -f \"$NETWORK\" --sender \"$DEPLOYER_ADDRESS\""

if [ "$VERIFY" -eq 1 ]; then
COMMAND="$COMMAND --verify"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"prettier:write": "npx prettier --write \"**/*.{json,md,yml,sol}\" \"!broadcast/**/*\" --ignore-path=.prettierignore",
"test": "forge test",
"test:coverage": "npm run clean && ./bin/coverage.sh",
"deploy": "./bin/deploy.sh $npm_config_network $npm_config_sender $npm_config_verify",
"deploy": "./bin/deploy.sh $npm_config_network $npm_config_verify",
"deploy:ds": "npm run -s deploy script/DocumentStore.s.sol:DocumentStoreScript \"run(string,address)\" \"$npm_config_name\" \"$npm_config_admin\"",
"deploy:ds:impl": "npm run -s deploy script/DocumentStoreInitializable.s.sol:DocumentStoreInitializableScript",
"deploy:ds:upgradeable": "npm run -s deploy script/DocumentStoreUpgradeable.s.sol:DocumentStoreUpgradeableScript \"run(string,address)\" \"$npm_config_name\" \"$npm_config_admin\"",
Expand Down

0 comments on commit 2375611

Please sign in to comment.