Skip to content

Commit

Permalink
Merge pull request #266 from shkangr/feature/added-bridge-bsc-balance…
Browse files Browse the repository at this point in the history
…-checker

feat: added Bridge Bsc operator balance checker
  • Loading branch information
shkangr authored Nov 15, 2023
2 parents 339d19d + f580b61 commit 6c65616
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion bridge-status-bot/app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ CONTRACT_ADDRESS='0xf203ca1769ca8e9e8fe1da9d147db68b6c919817'
BRIDGE_NC_ADDRESS='0x9093dd96c4bb6b44a9e0a522e2de49641f146223'
BRIDGE_ETHEREUM_ADDRESS='0x4A2FbE06004e37dE6Fe7Da59a53D14a407Def0ed'
BRIDGE_ETHEREUM_SAFE_EXECUTOR_ADDRESS='0x241085D7772E12740d6b1420043F04C51Cb3B45A'
BRIDGE_BSC_OPERATOR_ADDRESS='0x4f2b59A8779aea05e5187312FFCb5E8d751cC4CA'

GRAPHQL_API_ENDPOINT='https://9c-main-full-state.nine-chronicles.com'

Expand Down Expand Up @@ -44,6 +45,8 @@ ETH_BALANCE=$(get_eth_balance "$BRIDGE_ETHEREUM_ADDRESS")
ETH_BALANCE_THRESHOLD=0.5
ETH_SAFE_EXECUTOR_BALANCE=$(get_eth_balance "$BRIDGE_ETHEREUM_SAFE_EXECUTOR_ADDRESS")
ETH_SAFE_EXECUTOR_THRESHOLD=2
ETH_BRIDGE_BSC_OPERATOR_BALANCE=$(get_eth_balance "$BRIDGE_BSC_OPERATOR_ADDRESS")
ETH_BRIDGE_BSC_OPERATOR_THRESHOLD=1

# https://etherscan.io/tx/0x851bffbfcb2084bd6ea376b0e799d8111e2b38a04a6eadc74d0c9dbd8c59b7d4
# https://etherscan.io/tx/0x6e7d5d173d2acc7d33f22f4b65da0a33fdfe1a605072e9e70ac1873a7cfe0c18
Expand All @@ -63,7 +66,8 @@ TEXT=":notebook: *9c-bridge report*\\n\
:ncg: NCG Balance: *$GOLD_BALANCE*\\n\
GAP between :wncg: and :ncg:: *$GAP*
:ether: Ether Safe Contract balance: *$ETH_BALANCE*\\n
:ether: Ether Safe Contract Executor balance: *$ETH_SAFE_EXECUTOR_BALANCE*\\n"
:ether: Ether Safe Contract Executor balance: *$ETH_SAFE_EXECUTOR_BALANCE*\\n
:ether: Ether Bridge BSC Operator balance: *$ETH_BRIDGE_BSC_OPERATOR_BALANCE*\\n"

if [ $(echo "${ETH_BALANCE} <= ${ETH_BALANCE_THRESHOLD}" | bc) -eq 1 ];then
TEXT+="Ether Balance is lower than the threshold (*$ETH_BALANCE_THRESHOLD ETH*). <!here>\\n"
Expand All @@ -73,5 +77,9 @@ if [ $(echo "${ETH_SAFE_EXECUTOR_BALANCE} <= ${ETH_SAFE_EXECUTOR_THRESHOLD}" | b
TEXT+="Ether Safe Executor Balance is lower than the threshold (*$ETH_SAFE_EXECUTOR_THRESHOLD ETH*). <!here>\\n"
fi

if [ $(echo "${ETH_BRIDGE_BSC_OPERATOR_BALANCE} <= ${ETH_BRIDGE_BSC_OPERATOR_THRESHOLD}" | bc) -eq 1 ];then
TEXT+="Ether Bridge BSC Operator Balance is lower than the threshold (*$ETH_BRIDGE_BSC_OPERATOR_THRESHOLD ETH*). <!here>\\n"
fi

DATA="{\"channel\":\"$SLACK_CHANNEL\",\"text\":\"$TEXT\",\"mrkdwn\":true}"
curl "https://slack.com/api/chat.postMessage" --request POST --data "$DATA" -H "Content-Type: application/json; charset=utf-8" -H "Authorization: Bearer $SLACK_BOT_TOKEN" -s

0 comments on commit 6c65616

Please sign in to comment.