-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdev.sh
executable file
·70 lines (54 loc) · 1.62 KB
/
dev.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env bash
set -e
test "$(basename "$(pwd)")" == "rewards_contracts" || (echo "Plz invoke this script in project root"; exit 1)
source ./.env
# we use .env both for substituting docker-compose.yml and for container
COMPOSE="docker-compose --env-file .env -f docker-compose.yml"
_generate-svc-config() {
tee /tmp/kwil-reward-signersvc-config.json <<EOF > /dev/null
{
"kwil_rpc": "http://kwild:8484",
"private_key": "$TEST_PK",
"kwil_namespace": "rewards",
"sync_after_block": 0,
"sync_every": 30,
"state_file": "/tmp/kwil-reward-signersvc-state.json"
}
EOF
tee /tmp/kwil-reward-postersvc-config.json <<EOF > /dev/null
{
"eth_rpc": "$SEPOLIA_RPC",
"private_key": "$TEST_PK",
"safe_address": "$SEPOLIA_SAFE_ADDRESS",
"reward_address": "$SEPOLIA_REWARD_ADDRESS",
"sync_every": 30000,
"kwil_rpc": "http://kwild:8484",
"kwil_chain_id": "kwil-testnet",
"kwil_namespace": "rewards",
"state_file": "/tmp/kwil-reward-postersvc-state.json"
}
EOF
}
run-fresh() {
# we always use /tmp/.testnet/node0 as the Kwild root dir
rm -rf /tmp/.testnet
docker run --rm -it -v /tmp:/tmp kwil-reward:latest setup testnet -v 1 -o /tmp/.testnet
perl -i -pe "s/^.*\"db_owner\":.*$/ \"db_owner\": \"$TEST_ADDRESS\",/g" /tmp/.testnet/node0/genesis.json
_generate-svc-config
$COMPOSE up
$COMPOSE rm -s -v -f
}
#run-old() {
# generate-svc-config
#
# $COMPOSE up
# $COMPOSE rm -s -v -f
#}
build() {
cd peripheral/goimpl || exit 1
test -f go.work && go work vendor || go mod vendor
cd - || exit 1
$COMPOSE build
}
test $# -eq 0 && (echo Availbale funcs:;echo; declare -F | awk '{print $3}'; exit 1)
"$@"