@@ -10,6 +10,10 @@ if [[ -z "$ENV_FILE" ]]; then
1010 exit 1
1111fi
1212
13+ function send_proof_background() {
14+ ./alerts/sender_with_alert.sh " $ENV_FILE "
15+ }
16+
1317# Fetches the current ETH gas price
1418function fetch_gas_price() {
1519 gas_price=$( cast gas-price --rpc-url $RPC_URL )
@@ -49,43 +53,43 @@ while true; do
4953 # Between 1 and 3 elapsed intervals (5 to 15 minutes), if gas price is below 1.5 gwei, send a proof
5054 message=" Sending proof at $elapsed_intervals with gas price $current_gas_price wei"
5155 echo " $message "
52- ./alerts/sender_with_alert.sh " $ENV_FILE "
56+ send_proof_background ()
5357 elapsed_intervals=0
5458 elif { [ $elapsed_intervals -ge 3 ] && [ $elapsed_intervals -lt 6 ] && [ $current_gas_price -lt 4500000000 ]; }; then
5559 # Between 3 and 6 elapsed intervals (15 to 30 minutes), if gas price is below 4.5 gwei, send a proof
5660 message=" Sending proof at $elapsed_intervals with gas price $current_gas_price wei"
5761 echo " $message "
58- ./alerts/sender_with_alert.sh " $ENV_FILE "
62+ send_proof_background ()
5963 elapsed_intervals=0
6064 elif { [ $elapsed_intervals -ge 6 ] && [ $elapsed_intervals -lt 12 ] && [ $current_gas_price -lt 9000000000 ]; }; then
6165 # Between 6 and 12 elapsed intervals (30 minutes to 1 hour), if gas price is below 9 gwei, send a proof
6266 message=" Sending proof at $elapsed_intervals with gas price $current_gas_price wei"
6367 echo " $message "
64- ./alerts/sender_with_alert.sh " $ENV_FILE "
68+ send_proof_background ()
6569 elapsed_intervals=0
6670 elif { [ $elapsed_intervals -ge 12 ] && [ $elapsed_intervals -lt 24 ] && [ $current_gas_price -lt 24000000000 ]; }; then
6771 # Between 12 and 24 elapsed intervals (1 to 2 hours), if gas price is below 24 gwei, send a proof
6872 message=" Sending proof at $elapsed_intervals with gas price $current_gas_price wei"
6973 echo " $message "
70- ./alerts/sender_with_alert.sh " $ENV_FILE "
74+ send_proof_background ()
7175 elapsed_intervals=0
7276 elif { [ $elapsed_intervals -ge 24 ] && [ $elapsed_intervals -lt 48 ] && [ $current_gas_price -lt 48000000000 ]; }; then
7377 # Between 24 and 48 elapsed intervals (2 to 4 hours), if gas price is below 48 gwei, send a proof
7478 message=" Sending proof at $elapsed_intervals with gas price $current_gas_price wei"
7579 echo " $message "
76- ./alerts/sender_with_alert.sh " $ENV_FILE "
80+ send_proof_background ()
7781 elapsed_intervals=0
7882 elif { [ $elapsed_intervals -ge 48 ] && [ $elapsed_intervals -lt 96 ] && [ $current_gas_price -lt 96000000000 ]; }; then
7983 # Between 48 and 96 elapsed intervals (4 to 8 hours), if gas price is below 96 gwei, send a proof
8084 message=" Sending proof at $elapsed_intervals with gas price $current_gas_price wei"
8185 echo " $message "
82- ./alerts/sender_with_alert.sh " $ENV_FILE "
86+ send_proof_background ()
8387 elapsed_intervals=0
8488 elif { [ $elapsed_intervals -ge 96 ] && [ $current_gas_price -lt 192000000000 ]; }; then
8589 # After 96 elapsed intervals (8 hours), if gas price is below 192 gwei, send a proof
8690 message=" Sending proof at $elapsed_intervals with gas price $current_gas_price wei"
8791 echo " $message "
88- ./alerts/sender_with_alert.sh " $ENV_FILE "
92+ send_proof_background ()
8993 elapsed_intervals=0
9094 fi
9195
0 commit comments