forked from itgoldio/everscale-validator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathton-election-date.sh
36 lines (27 loc) · 898 Bytes
/
ton-election-date.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
#!/bin/bash -eE
# export ton environments
. ton-env.sh
ton-check-env.sh TON_CLI
ton-check-env.sh TON_CLI_CONFIG
get_election_date ()
{
ELECTIONS_START=$($TON_CLI -c $TON_CLI_CONFIG runget $ELECTOR_ADDR active_election_id | grep 'Result:' | sed 's/Result:[[:space:]]*//g' | tr -d \"[])
}
# rustcup have unique elector
get_election_date_rustcup ()
{
ELECTION_RESULT=`$TON_CLI -c $TON_CLI_CONFIG run $ELECTOR_ADDR active_election_id {} --abi $TON_CONTRACT_ELECTOR_ABI`
ELECTIONS_START=$(echo $ELECTION_RESULT | awk -F'Result: ' '{print $2}' | jq -r '.value0' )
}
# get elector address
ELECTOR_ADDR="-1:$($TON_CLI -c $TON_CLI_CONFIG getconfig 1 | grep 'p1:' | sed 's/Config p1:[[:space:]]*//g' | tr -d \")"
if [ $TON_IS_RUSTNET -eq 1 ]; then
get_election_date_rustcup
else
get_election_date
fi
if [ -z $ELECTIONS_START ]; then
echo "-1";
exit
fi
echo "$ELECTIONS_START"