Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8daf0da

Browse files
authored
Log wallet balance
1 parent f1bcaae commit 8daf0da

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

massa-guard.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ do
4242
CandidateRolls=$(GetCandidateRoll "$WalletAddress")
4343
# Get MAS amount
4444
MasBalance=$(GetMASAmount "$WalletAddress")
45+
# Log Wallet balance if not already log today
46+
if [ ! -e $PATH_LOGS_MASSAGUARD/$(date +%Y%m%d)-massa_guard.txt ]; LogWalletsBalance "$CandidateRolls" "$MasBalance" "$WalletAddress" then
4547
# Buy max roll or 1 roll if possible when candidate roll amount = 0
4648
BuyOrSellRoll "$CandidateRolls" "$MasBalance" "$WalletAddress"
4749
done

sources/lib.sh

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,6 @@ GetMASAmount() {
117117
BuyOrSellRoll() {
118118
# Check if RESCUE_MAS_AMOUNT is set into config.ini or set it to 0
119119
if [ ! -v RESCUE_MAS_AMOUNT ]; then RESCUE_MAS_AMOUNT=0 ; fi
120-
# Check if day log file already exist or create it
121-
if [ ! -e $PATH_LOGS_MASSAGUARD/$(date +%Y%m%d)-massa_guard.txt ]
122-
then
123-
# Create log file of the day
124-
touch $PATH_LOGS_MASSAGUARD/$(date +%Y%m%d)-massa_guard.txt
125-
# Log amounts of the day
126-
Events+=("[INFO][$1][MAS=$2][ROLL=$3]")
127-
fi
128120

129121
# Check candidate roll > 0 and Mas amount >= 100 to buy first roll
130122
if ([ $1 -eq 0 ] && [ $2 -ge 100 ])
@@ -425,6 +417,9 @@ CheckAndUpdateNode () {
425417
LogEvents () {
426418
# Check if RESCUE_MAS_AMOUNT is set into config.ini or set it to 0
427419
if [ ! -v DISCORD_WEBHOOK ]; then DISCORD_WEBHOOK=0 ; fi
420+
# Check if day log file already exist or create it
421+
if [ ! -e $PATH_LOGS_MASSAGUARD/$(date +%Y%m%d)-massa_guard.txt ]; then touch $PATH_LOGS_MASSAGUARD/$(date +%Y%m%d)-massa_guard.txt ; fi
422+
428423
# Set current date
429424
Date=$(date +%Y%m%d-%HH%M)
430425
DayDate=$(date +%Y%m%d)
@@ -443,4 +438,16 @@ LogEvents () {
443438
fi
444439
done
445440
return 0
441+
}
442+
443+
#############################################################
444+
# FONCTION = LogWalletsBalance
445+
# ARGUMENTS = CandidateRollAmount, MasAmount, WalletAddress
446+
# DESCRIPTION = Log ROLL and MAS balance
447+
#############################################################
448+
LogWalletsBalance() {
449+
# Log wallet amounts
450+
Events+=("[INFO][$3][MAS=$2][ROLL=$1]")
451+
452+
return 0
446453
}

0 commit comments

Comments
 (0)