-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·57 lines (46 loc) · 1.37 KB
/
deploy.sh
File metadata and controls
executable file
·57 lines (46 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
# Load generic environment variables
source .env
# Parse command line options
while [[ "$#" -gt 0 ]]; do
case $1 in
--env) ENVIRONMENT="$2"; shift ;; # Shift past the value
--contract) CONTRACT_TYPE="$2"; shift ;; # Shift past the value
*) echo "Unknown parameter passed: $1"; exit 1 ;;
esac
shift # Shift past the current key or value
done
# Path to the environment file
ENV_FILE=".env.$ENVIRONMENT"
# Check if the environment file exists
if [ ! -f "$ENV_FILE" ]; then
echo "Environment file $ENV_FILE does not exist."
exit 1
fi
# Source environment variables
source $ENV_FILE
# Echo back the environment for verification
echo "Deploying to $ENVIRONMENT environment with settings from '$ENV_FILE'..."
# Deployment-related commands
echo "Running deployment tasks..."
# Clean the build directory
forge clean
# Determine which contract to deploy
if [ "$CONTRACT_TYPE" = "token" ]; then
SCRIPT="script/SimpleToken.s.sol:DeploySimpleToken"
CONTRACT_NAME="SimpleToken"
else
echo "Invalid contract type. Use 'token'"
exit 1
fi
echo "Deploying $CONTRACT_NAME..."
# Deploy the selected contract
forge script $SCRIPT \
--rpc-url $RPC_URL \
--private-key $PRIVATE_KEY \
--broadcast \
-vvvvv \
--verify \
--verifier etherscan \
--verifier-url $VERIFIER_URL \
--etherscan-api-key $ETHERSCAN_API_KEY