forked from smart-transaction/stxn-contracts-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.sh
executable file
·50 lines (40 loc) · 979 Bytes
/
deploy.sh
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
#!/bin/bash
# Execute this scipt with: ./deploy.sh <CONTRACT NAME> <SALT(only for testnet)>
# Check if at least one argument is passed
if [ $# -lt 1 ]; then
echo "Usage: $0 <command>"
exit 1
fi
# Get the contract name
CONTRACT=$1
SCRIPT_NAME="Deploy${CONTRACT}"
SALT=$2
# Get the network
echo "Select Network (local/testnet/mainnet)"
read NETWORK
# TODO: Deploy selected chains
if [ "$NETWORK" = "mainnet" ]; then
SIGNATURE="deployMainnet()"
elif [ "$NETWORK" = "testnet" ]; then
SIGNATURE="deployTestnet(uint256)"
elif [ "$NETWORK" = "local" ]; then
SIGNATURE="deployLocal()"
else
echo "INVALID INPUT"
exit 1
fi
if [ "$NETWORK" = "testnet" ]
then
cmd="forge script $SCRIPT_NAME $SALT --sig '$SIGNATURE'"
else
cmd="forge script $SCRIPT_NAME --sig '$SIGNATURE'"
fi
echo "Broadcast deployment? (y/n)"
read BROADCAST
if [ "$BROADCAST" = "y" ]
then
cmd="$cmd --broadcast"
fi
# Execute the built command
echo "Executing: $cmd"
eval "$cmd"