Skip to content

Commit

Permalink
Inlcuded SdUtilizerLatestBalance in self bond flow
Browse files Browse the repository at this point in the history
  • Loading branch information
batphonghan committed Jan 10, 2024
1 parent 94f3953 commit 3a4632c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions stader-cli/node/utilize-sd.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,15 @@ Maximum utilization amount: %s

func PromptChooseSelfBondAmount(sdStatus *api.SdStatusResponse) (*big.Int, error) {

Check failure on line 149 in stader-cli/node/utilize-sd.go

View workflow job for this annotation

GitHub Actions / build

unnecessary leading newline (whitespace)

amountToCollateralRemain := new(big.Int).Sub(sdStatus.SdCollateralRequireAmount, sdStatus.SdCollateralCurrentAmount)
totalCollateral := new(big.Int).Add(sdStatus.SdCollateralCurrentAmount, sdStatus.SdUtilizerLatestBalance)

sdRewardEligibleRemain := new(big.Int).Sub(sdStatus.SdRewardEligible, sdStatus.SdCollateralCurrentAmount)
amountToCollateralRemain := new(big.Int).Sub(sdStatus.SdCollateralRequireAmount, totalCollateral)

sdRewardEligibleRemain := new(big.Int).Sub(sdStatus.SdRewardEligible, totalCollateral)

if amountToCollateralRemain.Cmp(big.NewInt(0)) < 0 {
amountToCollateralRemain = big.NewInt(0)
}

minSd := eth.WeiToEth(amountToCollateralRemain)
maxSd := eth.WeiToEth(sdRewardEligibleRemain)
Expand Down

0 comments on commit 3a4632c

Please sign in to comment.