From 194d41eae30efbd35d6c4bfe623ce2f0d315428d Mon Sep 17 00:00:00 2001 From: batphonghan Date: Mon, 4 Mar 2024 19:28:12 +0700 Subject: [PATCH] Update message --- stader-cli/node/claim-rewards.go | 6 +++--- stader-cli/node/repay-sd.go | 2 +- stader-cli/node/utilize-sd.go | 14 ++++++++------ stader-cli/node/withdraw-sd.go | 3 ++- stader-cli/validator/deposit.go | 2 +- 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/stader-cli/node/claim-rewards.go b/stader-cli/node/claim-rewards.go index 4d28be96..3ce2599e 100644 --- a/stader-cli/node/claim-rewards.go +++ b/stader-cli/node/claim-rewards.go @@ -48,14 +48,14 @@ func ClaimRewards(c *cli.Context) error { // if withdrawableInEth < claimsBalance, then there is an existing utilization position if canClaimRewardsResponse.ClaimsBalance.Cmp(canClaimRewardsResponse.WithdrawableInEth) != 0 { if sdStatus.SdUtilizerLatestBalance.Cmp(big.NewInt(0)) > 0 { - fmt.Printf("You currently have an existing SD Utilization Position of %s. Based on the current Health Factor, you can claim upto %s", eth.DisplayAmountInUnits(sdStatusResponse.SDStatus.SdUtilizerLatestBalance, "sd"), eth.DisplayAmountInUnits(canClaimRewardsResponse.WithdrawableInEth, "eth")) - - fmt.Printf("Note: Please repay your utilized SD by using the following command to claim the remaining ETH: stader-cli sd repay --amount .\n") + fmt.Printf("You currently have an existing SD Utilization Position of %s. Based on the current Health Factor, you can claim %s at the moment, and the remaining ETH can be claimed after closing the Utilization Position", eth.DisplayAmountInUnits(sdStatusResponse.SDStatus.SdUtilizerLatestBalance, "sd"), eth.DisplayAmountInUnits(canClaimRewardsResponse.WithdrawableInEth, "eth")) if !cliutils.Confirm("Do you wish to proceed?\n\n") { fmt.Println("Cancelled.") return nil } + + fmt.Printf("Note: Please repay your utilized SD by using the following command to claim the remaining ETH: stader-cli sd repay --amount .\n") } } diff --git a/stader-cli/node/repay-sd.go b/stader-cli/node/repay-sd.go index 6bdbf53d..4c8eb284 100644 --- a/stader-cli/node/repay-sd.go +++ b/stader-cli/node/repay-sd.go @@ -97,7 +97,7 @@ func repaySD(c *cli.Context) error { } // Prompt for confirmation - if !cliutils.Confirm(fmt.Sprintf("Are you sure you want to repay %s from your Operator Address and close your Utilization Position? ", eth.DisplayAmountInUnits(amountWei, "sd"))) { + if !cliutils.Confirm(fmt.Sprintf("Are you sure you want to repay %s from your Operator Address?", eth.DisplayAmountInUnits(amountWei, "sd"))) { fmt.Printf("Cancelled\n") return nil } diff --git a/stader-cli/node/utilize-sd.go b/stader-cli/node/utilize-sd.go index 0fcb56c4..3c7be51a 100644 --- a/stader-cli/node/utilize-sd.go +++ b/stader-cli/node/utilize-sd.go @@ -40,21 +40,23 @@ func utilizeSD(c *cli.Context) error { } if sdStatusResponse.SDStatus.AlreadyLiquidated { - fmt.Printf("Your node is in liquidation process") + fmt.Printf("Your node is under the liquidation process and you can not utilize SD at the moment.") return nil } healthFactor := eth.WeiToEth(sdStatusResponse.SDStatus.HealthFactor) if healthFactor < 1 { fmt.Printf( - "The Operator has a Health Factor of %.6f. \nNote: Please ensure your Health Factor is greater than 1 to avoid liquidations.\n\n", + "Your node has a Health Factor of %.6f which is less than 1 and you can not utilize SD at the moment. Please repay your utilize SD and ensure your Health Factor is greater than 1 to avoid liquidation.\n\n", healthFactor) + fmt.Printf("Note: Please repay your utilized SD by using the following command: stader-cli sd repay --amount .\n") + return nil } if sdStatusResponse.SDStatus.SdCollateralRequireAmount.Cmp(big.NewInt(0)) == 0 { - fmt.Printf("Please add a validator to your node first before utilizing SD from a Utility Pool. Execute the following command to add a validator to your node: ~/bin/stader-cli validator deposit --num-validators \n") + fmt.Printf("Please add a validator to your node first before utilizing SD from the SD Utility Pool. Execute the following command to add a validator to your node: ~/bin/stader-cli validator deposit --num-validators \n") return nil } @@ -79,7 +81,7 @@ func utilizeSD(c *cli.Context) error { rate := sdStatusResponse.SDStatus.UtilizationRate // Prompt for confirmation if !(c.Bool("yes") || cliutils.Confirm(fmt.Sprintf( - "Are you sure you want to use %s from the utility pool?.\nNote: A Utilization fee of %s%s will be applied to the utilized SD from the utility pool.", eth.DisplayAmountInUnits(amountWei, "sd"), rate.String(), "%"))) { + "Are you sure you want to use %s from the SD Utility Pool?.\nNote: A Utilization fee of %s%s will be applied to the utilized SD from the SD Utility Pool.", eth.DisplayAmountInUnits(amountWei, "sd"), rate.String(), "%"))) { fmt.Println("Cancelled.") return nil } @@ -96,7 +98,7 @@ func utilizeSD(c *cli.Context) error { } // Log & return - fmt.Printf("Successfully deposited %s to the collateral contract by utilizing SD from the Utility Pool.\n", eth.DisplayAmountInUnits(amountWei, "sd")) + fmt.Printf("Successfully deposited %s to the collateral contract by utilizing SD from the SD Utility Pool.\n", eth.DisplayAmountInUnits(amountWei, "sd")) return nil } @@ -126,7 +128,7 @@ func GetMaxUtility(sdStatus *api.SdStatusResponse) *big.Int { func PromptChooseUtilityAmount(sdStatus *api.SdStatusResponse, minUtility, maxUtility *big.Int) (*big.Int, error) { // 1. If the pool had enough SD if minUtility.Cmp(sdStatus.PoolAvailableSDBalance) > 0 { - return nil, errors.New("There is not sufficient free SD in the Utility Pool for utilization at the moment. Please try again later when there is enough free SD in the Utility Pool") + return nil, errors.New("There is not sufficient free SD in the SD Utility Pool for utilization at the moment. Please try again later when there is enough free SD in the SD Utility Pool") } // 2. If user had enough Eth diff --git a/stader-cli/node/withdraw-sd.go b/stader-cli/node/withdraw-sd.go index cdceb77f..660a0a89 100644 --- a/stader-cli/node/withdraw-sd.go +++ b/stader-cli/node/withdraw-sd.go @@ -38,6 +38,7 @@ func WithdrawSd(c *cli.Context) error { } if canWithdrawSdResponse.InsufficientSdCollateral { + //TODO: show 200% in SD fmt.Println("Not enough excess SD collateral to withdraw") return nil } @@ -95,7 +96,7 @@ func WithdrawSd(c *cli.Context) error { // withdraw request amount lesser than the Utilization Position if !hasUtilizePosition { - fmt.Printf("Successfully withdrawn %s Collateral. \n", eth.DisplayAmountInUnits(amountWei, "sd")) + fmt.Printf("Successfully withdrawn %s collateral. \n", eth.DisplayAmountInUnits(amountWei, "sd")) return nil } diff --git a/stader-cli/validator/deposit.go b/stader-cli/validator/deposit.go index 4b7b850b..7fe03a0d 100644 --- a/stader-cli/validator/deposit.go +++ b/stader-cli/validator/deposit.go @@ -145,7 +145,7 @@ func nodeDeposit(c *cli.Context) error { return nil } - fmt.Println("Continue with create validator...") + fmt.Println("Validator creation process initiate, please wait...") } canNodeDepositResponse, err := staderClient.CanNodeDeposit(baseAmount, utilityAmount, big.NewInt(int64(numValidators)), true)