File tree Expand file tree Collapse file tree 3 files changed +18
-0
lines changed
Expand file tree Collapse file tree 3 files changed +18
-0
lines changed Original file line number Diff line number Diff line change 44
55# # Variables for contract_alerts.sh
66# RPC_URL=<YOUR_RPC_URL>
7+ # RPC_URL_FALLBACK=<YOUR_FALLBACK_RPC_URL>
78# CONTRACT_ADDRESS=<YOUR_CONTRACT_ADDRESS>
89# NEW_BATCH_TOPIC=<YOUR_NEW_BATCH_TOPIC>
910# VERIFIED_BATCH_TOPIC=<YOUR_VERIFIED_BATCH_TOPIC>
1718
1819# # Variables for balance_alerts.sh
1920# RPC_URL=<YOUR_RPC_URL>
21+ # RPC_URL_FALLBACK=<YOUR_FALLBACK_RPC_URL>
2022# PAYMENT_CONTRACT_ADDRESS=<YOUR_PAYMENT_CONTRACT_ADDRESS>
2123# BALANCE_THRESHOLD=<YOUR_BALANCE_THRESHOLD_IN_ETH>
2224# WALLET_ADDRESS=<YOUR_WALLET_ADDRESS>
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ EXPRESSION=<GREP_EXPRESSION>
1717
1818# Variables for balance_alerts.sh
1919RPC_URL = <YOUR_RPC_URL>
20+ RPC_URL_FALLBACK = <YOUR_FALLBACK_RPC_URL>
2021PAYMENT_CONTRACT_ADDRESS = <YOUR_PAYMENT_CONTRACT_ADDRESS>
2122BALANCE_THRESHOLD = <YOUR_BALANCE_THRESHOLD_IN_ETH>
2223WALLET_NAME = <YOUR_WALLET_NAME> # Example: "Task sender"
@@ -37,6 +38,7 @@ LOGS_BLOCK_RANGE=<LOGS_BLOCK_RANGE>
3738CONTRACT_ADDRESS = <YOUR_CONTRACT_ADDRESS>
3839AGGREGATED_PROOF_VERIFIED_TOPIC = 0xfe3e9e971000ab9c80c7e06aba2933aae5419d0e44693e3046913e9e58053f62
3940RPC_URL = <YOUR_RPC_URL>
41+ RPC_URL_FALLBACK = <YOUR_FALLBACK_RPC_URL>
4042LOGS_BLOCK_RANGE = 7500
4143SLEEP_TIME = 3600
4244PAGER_DUTY_KEY = <YOUR_PAGER_DUTY_KEY>
Original file line number Diff line number Diff line change 1414function fetch_gas_price() {
1515 # TODO: We should have a second RPC_URL for fetching gas price to avoid being rate limited
1616 gas_price=$( cast gas-price --rpc-url $RPC_URL )
17+ if [[ -z " $gas_price " || " $gas_price " == " 0" ]]; then
18+ echo " Primary RPC_URL failed to fetch gas price, trying fallback..."
19+ gas_price=$( cast gas-price --rpc-url $RPC_URL_FALLBACK )
20+ fi
21+
1722 echo $gas_price
1823}
1924
@@ -27,6 +32,15 @@ while true; do
2732 echo " Starting pass #$tic "
2833
2934 current_gas_price=$( fetch_gas_price)
35+ if [[ -z " $current_gas_price " || " $current_gas_price " == " 0" ]]; then
36+ echo " Failed to fetch current gas price from both RPC URLs, skipping this pass."
37+
38+ tic=$(( tic + 1 ))
39+
40+ echo " Sleeping $sleep_time seconds (($(( sleep_time / 60 )) minutes))"
41+ sleep " $sleep_time "
42+ continue
43+ fi
3044 echo " Current gas price: $current_gas_price wei"
3145
3246 # In case current tic and gas price meet the criteria, send a proof and reset tic counter
You can’t perform that action at this time.
0 commit comments