Skip to content

Commit

Permalink
refactor: replaced SKL with sFuel as a gas token in logs (#1253)
Browse files Browse the repository at this point in the history
* refactor: replaced SKL with sFuel as a gas token in logs

* refactor: lowered the value for minimum sFuel required to warn the staker to add more

* refactor: rename sFuel to sFUEL
  • Loading branch information
Yashk767 authored Oct 15, 2024
1 parent 0df6525 commit 6917916
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion cmd/addStake.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func (*UtilsStruct) ExecuteStake(flagSet *pflag.FlagSet) {
log.Debug("Checking for sufficient balance...")
razorUtils.CheckAmountAndBalance(valueInWei, balance)

log.Debug("Checking whether sFuel balance is not 0...")
log.Debug("Checking whether sFUEL balance is not 0...")
razorUtils.CheckEthBalanceIsZero(context.Background(), client, address)

minSafeRazor, err := razorUtils.GetMinSafeRazor(context.Background(), client)
Expand Down
2 changes: 1 addition & 1 deletion cmd/delegate.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func (*UtilsStruct) ExecuteDelegate(flagSet *pflag.FlagSet) {
log.Debug("Checking for sufficient balance...")
razorUtils.CheckAmountAndBalance(valueInWei, balance)

log.Debug("Checking whether sFuel balance is not 0...")
log.Debug("Checking whether sFUEL balance is not 0...")
razorUtils.CheckEthBalanceIsZero(context.Background(), client, address)

txnArgs := types.TransactionOptions{
Expand Down
8 changes: 4 additions & 4 deletions cmd/vote.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,9 @@ func (*UtilsStruct) HandleBlock(client *ethclient.Client, account types.Account,
return
}

// Warning the staker if ETH balance is less than 0.1 ETH
if ethBalance.Cmp(big.NewInt(1e17)) == -1 {
log.Warn("sFuel balance is lower than 0.1 SKL, kindly add more SKL to be safe for executing transactions successfully")
// Warning the staker if sFUEL balance is less than 0.001 sFUEL
if ethBalance.Cmp(big.NewInt(1e15)) == -1 {
log.Warn("sFUEL balance is lower than 0.001 sFUEL, kindly add more sFUEL to be safe for executing transactions successfully")
}

actualStake, err := utils.ConvertWeiToEth(stakedAmount)
Expand Down Expand Up @@ -264,7 +264,7 @@ func (*UtilsStruct) HandleBlock(client *ethclient.Client, account types.Account,
}
}

log.Infof("State: %s Staker ID: %d Stake: %f sRZR Balance: %f sFuel Balance: %f", utils.GetStateName(state), stakerId, actualStake, sRZRInEth, actualBalance)
log.Infof("State: %s Staker ID: %d Stake: %f sRZR Balance: %f sFUEL Balance: %f", utils.GetStateName(state), stakerId, actualStake, sRZRInEth, actualBalance)

if staker.IsSlashed {
log.Error("Staker is slashed.... cannot continue to vote!")
Expand Down
4 changes: 2 additions & 2 deletions utils/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,10 @@ func (*UtilsStruct) IsFlagPassed(name string) bool {
func (*UtilsStruct) CheckEthBalanceIsZero(ctx context.Context, client *ethclient.Client, address string) {
ethBalance, err := ClientInterface.BalanceAtWithRetry(ctx, client, common.HexToAddress(address))
if err != nil {
log.Fatalf("Error in fetching sFuel balance of the account: %s\n%s", address, err)
log.Fatalf("Error in fetching sFUEL balance of the account: %s\n%s", address, err)
}
if ethBalance.Cmp(big.NewInt(0)) == 0 {
log.Fatal("sFuel balance is 0, Aborting...")
log.Fatal("sFUEL balance is 0, Aborting...")
}
}

Expand Down

0 comments on commit 6917916

Please sign in to comment.