-
Notifications
You must be signed in to change notification settings - Fork 54
53 lines (49 loc) · 1.92 KB
/
check-gentx-pr.yml
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
name: Check new gentxs according to the criteria
on:
# push:
# paths:
# - 'sge-network-2/gentxs/**'
pull_request:
paths:
- 'sge-network-2/gentxs/**'
env:
MIN_STAKE: 10000000000
jobs:
check-gentxs-directory:
runs-on: ubuntu-latest
steps:
- name: Checkout PR branch
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- name: Check gentx amount
run: |
for file in sge-network-2/gentxs/*.json; do
NAME=$(echo $file | cut -f 1 -d '.')
STAKED=$(jq -r '.body.messages[0].value.amount' "$file")
if [[ $STAKED -ge $MIN_STAKE ]]; then
# If the validator meets the criteria, print a message
echo "$NAME has $STAKED tokens staked"
else
# If the validator does not meet the criteria, print a warning message
echo "WARNING: $NAME has $STAKED tokens staked, minimum ammount is $MIN_STAKE "
fi
done
#- name: Check gentx criteria
# run: |
## Loop through each validator and check if it meets the criteria
#for V in $(echo "$VALIDATORS" | jq -c '.validators[]'); do
# STAKED=$(echo "$V" | jq -r '.tokens')
# NAME=$(echo "$V" | jq -r '.description.moniker')
# COMMISSION_TIME=$(echo "$V" | jq -r '.commission.update_time')
# echo "$NAME has $STAKED tokens staked and last updated commission on $COMMISSION_TIME"
# COMMISSION_UNIX_TIME=$(date -d $COMMISSION_TIME +%s)
# TX_UNIX_TIME=$(date -d @$TX_TIME +%s)
# if [[ $STAKED -ge $MIN_STAKE ]] && [[ $COMMISSION_UNIX_TIME -ge $TX_UNIX_TIME ]]; then
# echo "Validator $NAME meets the criteria."
# else
# echo "Validator $NAME does not meet the criteria."
# exit 1
# fi
#done
#echo "All validators meet the criteria."