Skip to content

Commit 5317e93

Browse files
Improve comments on the periodic sender script
1 parent a1aab86 commit 5317e93

1 file changed

Lines changed: 12 additions & 11 deletions

File tree

alerts/periodic_sender.sh

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/bash
2-
# This script is responsible for the infinite loop and the sleep between passes.
3-
# It forwards the path of the .env file as the first argument to action.sh
2+
# This script is responsible for the handling of periodic sending, and the clauses for sending proofs.
3+
# It forwards the path of the .env file as the first argument to the sender_with_alert.sh script when
4+
# the conditions are met.
45

56
ENV_FILE="$1"
67

@@ -28,31 +29,31 @@ while true; do
2829
current_gas_price=$(fetch_gas_price)
2930
echo "Current gas price: $current_gas_price wei"
3031

31-
# Conditions for sending proofs:
32+
# In case current tic and gas price meet the criteria, send a proof and reset tic counter
3233
if { [ $tic -ge 10 ] && [ $tic -lt 14 ] && [ $current_gas_price -lt 2000000000 ]; }; then
33-
# - Between 10 and 14 tics (5 to 7 hours), if gas price is below 2 gwei, send a proof
34+
# Between 10 and 14 tics (5 to 7 hours), if gas price is below 2 gwei, send a proof
3435
message="Sending proof at tic $tic with gas price $current_gas_price wei"
3536
echo "$message"
3637
./alerts/sender_with_alert.sh "$ENV_FILE"
37-
tic=0 # Reset tic counter after sending a proof
38+
tic=0
3839
elif { [ $tic -ge 14 ] && [ $tic -lt 16 ] && [ $current_gas_price -lt 5000000000 ]; }; then
39-
# - Between 14 and 16 tics (7 to 8 hours), if gas price is below 5 gwei, send a proof
40+
# Between 14 and 16 tics (7 to 8 hours), if gas price is below 5 gwei, send a proof
4041
message="Sending proof at tic $tic with gas price $current_gas_price wei"
4142
echo "$message"
4243
./alerts/sender_with_alert.sh "$ENV_FILE"
43-
tic=0 # Reset tic counter after sending a proof
44+
tic=0
4445
elif { [ $tic -ge 16 ] && [ $tic -lt 24 ] && [ $current_gas_price -lt 15000000000 ]; }; then
45-
# - Between 16 and 24 tics (8 to 12 hours), if gas price is below 15 gwei, send a proof
46+
# Between 16 and 24 tics (8 to 12 hours), if gas price is below 15 gwei, send a proof
4647
message="Sending proof at tic $tic with gas price $current_gas_price wei"
4748
echo "$message"
4849
./alerts/sender_with_alert.sh "$ENV_FILE"
49-
tic=0 # Reset tic counter after sending a proof
50+
tic=0
5051
elif { [ $tic -ge 50 ]; }; then
51-
# - After 50 tics (25 hours), if gas price is below 50 gwei, send a proof
52+
# After 50 tics (25 hours), if gas price is below 50 gwei, send a proof
5253
message="Sending proof at tic $tic with gas price $current_gas_price wei"
5354
echo "$message"
5455
./alerts/sender_with_alert.sh "$ENV_FILE"
55-
tic=0 # Reset tic counter after sending a proof
56+
tic=0
5657
fi
5758

5859
tic=$((tic + 1))

0 commit comments

Comments
 (0)