forked from MyBitFoundation/MyBit-Network.tech
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexport_chain
executable file
·35 lines (34 loc) · 1.02 KB
/
export_chain
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
#!/bin/bash
#Exports a chain folder to the given directory
CURRENT_DIR=$PWD
CHAIN_DIR=$1
#Move to chain directory that was passed to program
cd $CHAIN_DIR
if [ -d chain ]; then
#If chain exists, remove all file within
rm -rf chain
fi
#Create chain folder
mkdir chain
#Run ganache in background with db set to chain folder (kill any running ganache first)
pkill -f ganache-cli
npx ganache-cli -d --mnemonic "myth like bonus scare over problem client lizard pioneer submit female collect" --networkId 70 --accounts 20 --db chain &
#Move back to directory this program is run from
cd $CURRENT_DIR
#Deploy contracts
npx truffle migrate --reset --network mybit
#Kill ganache
pkill -f ganache-cli
#Move addresses.json to chain directory
cp networks/mybit/contracts.json $CHAIN_DIR
cp networks/mybit/accounts.json $CHAIN_DIR
#Move back to chain directory
cd $CHAIN_DIR
#If git exists in folder, update git
# if [ -d .git ]; then
# echo "Updating git..."
# #Add to git
# git add .
# git commit -m "Updated chain"
# git push origin
# fi