-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexec-bot.sh
executable file
·55 lines (42 loc) · 1.26 KB
/
exec-bot.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
51
52
53
54
55
#!/usr/local/bin/bash
##!/usr/bin/env bash
echo "executing bot $(date)"
# crash/stop on errors
set -e
PROJECT_HOME=$(realpath "$( cd "${BASH_SOURCE[0]%/*}" && pwd )")
cd "$PROJECT_HOME"
# shellcheck disable=SC1090
source ./scripts/lib/shared.sh
echo "wut: $PROJECT_HOME"
exit 1
echo_env
ensure_nvm
namespace bot
###############
#
#echo "executing bot $(date)"
#
#echo "echo_announce"
echo_announce
#echo "\echo_announce"
DATE=$(date +%F-%S)
NETWORK=${1:-local}
exec_cmd() {
COMMAND="$1"
PROTOCOL="bot"
FILENAME="${DATE}-${NETWORK}-${PROTOCOL}-${COMMAND}"
FILEPATH="./transaction-history/$FILENAME"
nudge() {
F=$1
yq -o json -P < "$F" > "${F}on" || true
rm "$F" || true
}
./exec-checkfunds.sh "$NETWORK" > "${FILEPATH}-before.js" ; nudge "${FILEPATH}-before.js"
# npx hardhat "checkfunds" --network "$NETWORK" > "${FILEPATH}-before.js" ; nudge "${FILEPATH}-before.js"
npx hardhat "$COMMAND" --network "$NETWORK" 2>&1 | tee "${FILEPATH}-exec.txt"
npx hardhat "checkfunds" --network "$NETWORK" > "${FILEPATH}-finally.js" ; nudge "${FILEPATH}-finally.js"
# npx hardhat "checkfunds" --network "$NETWORK" 2>&1 > "${FILEPATH}-finally.js" ; nudge "${FILEPATH}-finally.js"
}
echo 'exec_cmd grapeFlow05'
exec_cmd "grapeFlow05"
echo '\exec_cmd grapeFlow05'