@@ -23,8 +23,8 @@ function fetch_gas_price() {
2323
2424source " $ENV_FILE "
2525
26- # Each elapsed interval lasts for 30 minutes
27- sleep_time=1800
26+ # Each elapsed interval lasts for 5 minutes
27+ sleep_time=300
2828elapsed_intervals=0
2929
3030./alerts/sender_with_alert.sh " $ENV_FILE "
@@ -45,26 +45,44 @@ while true; do
4545 echo " Current gas price: $current_gas_price wei"
4646
4747 # In case current and gas price meet the criteria, send a proof and reset counter
48- if { [ $elapsed_intervals -ge 10 ] && [ $elapsed_intervals -lt 14 ] && [ $current_gas_price -lt 2000000000 ]; }; then
49- # Between 10 and 14 elapsed intervals (5 to 7 hours ), if gas price is below 2 gwei, send a proof
48+ if { [ $elapsed_intervals -ge 1 ] && [ $elapsed_intervals -lt 3 ] && [ $current_gas_price -lt 1500000000 ]; }; then
49+ # Between 1 and 3 elapsed intervals (5 to 15 minutes ), if gas price is below 1.5 gwei, send a proof
5050 message=" Sending proof at $elapsed_intervals with gas price $current_gas_price wei"
5151 echo " $message "
5252 ./alerts/sender_with_alert.sh " $ENV_FILE "
5353 elapsed_intervals=0
54- elif { [ $elapsed_intervals -ge 14 ] && [ $elapsed_intervals -lt 16 ] && [ $current_gas_price -lt 5000000000 ]; }; then
55- # Between 14 and 16 elapsed intervals (7 to 8 hours ), if gas price is below 5 gwei, send a proof
54+ elif { [ $elapsed_intervals -ge 3 ] && [ $elapsed_intervals -lt 6 ] && [ $current_gas_price -lt 4500000000 ]; }; then
55+ # Between 3 and 6 elapsed intervals (15 to 30 minutes ), if gas price is below 4. 5 gwei, send a proof
5656 message=" Sending proof at $elapsed_intervals with gas price $current_gas_price wei"
5757 echo " $message "
5858 ./alerts/sender_with_alert.sh " $ENV_FILE "
5959 elapsed_intervals=0
60- elif { [ $elapsed_intervals -ge 16 ] && [ $elapsed_intervals -lt 24 ] && [ $current_gas_price -lt 15000000000 ]; }; then
61- # Between 16 and 24 elapsed intervals (8 to 12 hours ), if gas price is below 15 gwei, send a proof
60+ elif { [ $elapsed_intervals -ge 6 ] && [ $elapsed_intervals -lt 12 ] && [ $current_gas_price -lt 9000000000 ]; }; then
61+ # Between 6 and 12 elapsed intervals (30 minutes to 1 hour ), if gas price is below 9 gwei, send a proof
6262 message=" Sending proof at $elapsed_intervals with gas price $current_gas_price wei"
6363 echo " $message "
6464 ./alerts/sender_with_alert.sh " $ENV_FILE "
6565 elapsed_intervals=0
66- elif { [ $elapsed_intervals -ge 50 ]; }; then
67- # After 50 elapsed intervals (25 hours) send a proof
66+ elif { [ $elapsed_intervals -ge 12 ] && [ $elapsed_intervals -lt 24 ] && [ $current_gas_price -lt 24000000000 ]; }; then
67+ # Between 12 and 24 elapsed intervals (1 to 2 hours), if gas price is below 24 gwei, send a proof
68+ message=" Sending proof at $elapsed_intervals with gas price $current_gas_price wei"
69+ echo " $message "
70+ ./alerts/sender_with_alert.sh " $ENV_FILE "
71+ elapsed_intervals=0
72+ elif { [ $elapsed_intervals -ge 24 ] && [ $elapsed_intervals -lt 48 ] && [ $current_gas_price -lt 48000000000 ]; }; then
73+ # Between 24 and 48 elapsed intervals (2 to 4 hours), if gas price is below 48 gwei, send a proof
74+ message=" Sending proof at $elapsed_intervals with gas price $current_gas_price wei"
75+ echo " $message "
76+ ./alerts/sender_with_alert.sh " $ENV_FILE "
77+ elapsed_intervals=0
78+ elif { [ $elapsed_intervals -ge 48 ] && [ $elapsed_intervals -lt 96 ] && [ $current_gas_price -lt 96000000000 ]; }; then
79+ # Between 48 and 96 elapsed intervals (4 to 8 hours), if gas price is below 96 gwei, send a proof
80+ message=" Sending proof at $elapsed_intervals with gas price $current_gas_price wei"
81+ echo " $message "
82+ ./alerts/sender_with_alert.sh " $ENV_FILE "
83+ elapsed_intervals=0
84+ elif { [ $elapsed_intervals -ge 96 ] && [ $current_gas_price -lt 192000000000 ]; }; then
85+ # After 96 elapsed intervals (8 hours), if gas price is below 192 gwei, send a proof
6886 message=" Sending proof at $elapsed_intervals with gas price $current_gas_price wei"
6987 echo " $message "
7088 ./alerts/sender_with_alert.sh " $ENV_FILE "
0 commit comments