Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions rocketpool-cli/auction/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ func getStatus(c *cli.Context) error {
// Print & return
fmt.Printf(
"A total of %.6f RPL is up for auction, with %.6f RPL currently allotted and %.6f RPL remaining.\n",
math.RoundDown(eth.WeiToEth(status.TotalRPLBalance), 6),
math.RoundDown(eth.WeiToEth(status.AllottedRPLBalance), 6),
math.RoundDown(eth.WeiToEth(status.RemainingRPLBalance), 6))
math.RoundDown(eth.WeiToEth(&status.TotalRPLBalance), 6),
math.RoundDown(eth.WeiToEth(&status.AllottedRPLBalance), 6),
math.RoundDown(eth.WeiToEth(&status.RemainingRPLBalance), 6))
if status.LotCounts.ClaimAvailable > 0 {
fmt.Printf("%d lot(s) you have bid on have RPL available to claim!\n", status.LotCounts.ClaimAvailable)
}
Expand Down
4 changes: 2 additions & 2 deletions rocketpool-cli/faucet/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ func getStatus(c *cli.Context) error {
}

// Print status & return
fmt.Printf("The faucet has a balance of %.6f legacy RPL.\n", math.RoundDown(eth.WeiToEth(status.Balance), 6))
fmt.Printf("The faucet has a balance of %.6f legacy RPL.\n", math.RoundDown(eth.WeiToEth(&status.Balance), 6))
if status.WithdrawableAmount.Cmp(big.NewInt(0)) > 0 {
fmt.Printf("You can withdraw %.6f legacy RPL (requires a %.6f GoETH fee)!\n", math.RoundDown(eth.WeiToEth(status.WithdrawableAmount), 6), math.RoundDown(eth.WeiToEth(status.WithdrawalFee), 6))
fmt.Printf("You can withdraw %.6f legacy RPL (requires a %.6f GoETH fee)!\n", math.RoundDown(eth.WeiToEth(&status.WithdrawableAmount), 6), math.RoundDown(eth.WeiToEth(&status.WithdrawalFee), 6))
} else {
fmt.Println("You cannot withdraw legacy RPL right now.")
}
Expand Down
2 changes: 1 addition & 1 deletion rocketpool-cli/faucet/withdraw-rpl.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func withdrawRpl(c *cli.Context) error {
}

// Log & return
fmt.Printf("Successfully withdrew %.6f legacy RPL from the faucet.\n", math.RoundDown(eth.WeiToEth(response.Amount), 6))
fmt.Printf("Successfully withdrew %.6f legacy RPL from the faucet.\n", math.RoundDown(eth.WeiToEth(&response.Amount), 6))
return nil

}
16 changes: 8 additions & 8 deletions rocketpool-cli/minipool/close.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func closeMinipools(c *cli.Context) error {
if mp.MinipoolVersion < 3 {
versionTooLowMinipools = append(versionTooLowMinipools, mp)
}
if mp.Balance.Cmp(mp.Refund) == -1 {
if mp.Balance.Cmp(&mp.Refund) == -1 {
balanceLessThanRefundMinipools = append(balanceLessThanRefundMinipools, mp)
}
if mp.MinipoolStatus != types.Dissolved &&
Expand Down Expand Up @@ -114,9 +114,9 @@ func closeMinipools(c *cli.Context) error {
options[0] = "All available minipools"
for mi, minipool := range closableMinipools {
if minipool.MinipoolStatus == types.Dissolved {
options[mi+1] = fmt.Sprintf("%s (%.6f ETH will be returned)", minipool.Address.Hex(), math.RoundDown(eth.WeiToEth(minipool.Balance), 6))
options[mi+1] = fmt.Sprintf("%s (%.6f ETH will be returned)", minipool.Address.Hex(), math.RoundDown(eth.WeiToEth(&minipool.Balance), 6))
} else {
options[mi+1] = fmt.Sprintf("%s (%.6f ETH available, %.6f ETH is yours plus a refund of %.6f ETH)", minipool.Address.Hex(), math.RoundDown(eth.WeiToEth(minipool.Balance), 6), math.RoundDown(eth.WeiToEth(minipool.NodeShare), 6), math.RoundDown(eth.WeiToEth(minipool.Refund), 6))
options[mi+1] = fmt.Sprintf("%s (%.6f ETH available, %.6f ETH is yours plus a refund of %.6f ETH)", minipool.Address.Hex(), math.RoundDown(eth.WeiToEth(&minipool.Balance), 6), math.RoundDown(eth.WeiToEth(&minipool.NodeShare), 6), math.RoundDown(eth.WeiToEth(&minipool.Refund), 6))
}
}
selected, _ := cliutils.Select("Please select a minipool to close:", options)
Expand Down Expand Up @@ -153,11 +153,11 @@ func closeMinipools(c *cli.Context) error {
yellowThreshold := eth.EthToWei(31.5)
thirtyTwo := eth.EthToWei(32)
for _, minipool := range selectedMinipools {
distributableBalance := big.NewInt(0).Sub(minipool.Balance, minipool.Refund)
distributableBalance := big.NewInt(0).Sub(&minipool.Balance, &minipool.Refund)
if distributableBalance.Cmp(eight) >= 0 {
if distributableBalance.Cmp(minipool.UserDepositBalance) < 0 {
if distributableBalance.Cmp(&minipool.UserDepositBalance) < 0 {
// Less than the user deposit balance, ETH + RPL will be slashed
fmt.Printf("%sWARNING: Minipool %s has a distributable balance of %.6f ETH which is lower than the amount borrowed from the staking pool (%.6f ETH).\nPlease visit the Rocket Pool Discord's #support channel (https://discord.gg/rocketpool) if you are not expecting this.%s\n", colorRed, minipool.Address.Hex(), math.RoundDown(eth.WeiToEth(distributableBalance), 6), math.RoundDown(eth.WeiToEth(minipool.UserDepositBalance), 6), colorReset)
fmt.Printf("%sWARNING: Minipool %s has a distributable balance of %.6f ETH which is lower than the amount borrowed from the staking pool (%.6f ETH).\nPlease visit the Rocket Pool Discord's #support channel (https://discord.gg/rocketpool) if you are not expecting this.%s\n", colorRed, minipool.Address.Hex(), math.RoundDown(eth.WeiToEth(distributableBalance), 6), math.RoundDown(eth.WeiToEth(&minipool.UserDepositBalance), 6), colorReset)
if !c.Bool("confirm-slashing") {
fmt.Printf("\n%sIf you are *sure* you want to close the minipool anyway, rerun this command with the `--confirm-slashing` flag. Doing so WILL RESULT in both your ETH bond and your RPL collateral being slashed.%s\n", colorRed, colorReset)
return nil
Expand All @@ -169,13 +169,13 @@ func closeMinipools(c *cli.Context) error {
}
} else if distributableBalance.Cmp(yellowThreshold) < 0 {
// More than the user deposit balance but less than 31.5, ETH will be slashed with a red warning
if !cliutils.ConfirmWithIAgree(fmt.Sprintf("%sWARNING: Minipool %s has a distributable balance of %.6f ETH. Closing it in this state WILL RESULT in a loss of ETH. You will only receive %.6f ETH back. Please confirm you understand this and want to continue closing the minipool.%s", colorRed, minipool.Address.Hex(), math.RoundDown(eth.WeiToEth(distributableBalance), 6), math.RoundDown(eth.WeiToEth(minipool.NodeShare), 6), colorReset)) {
if !cliutils.ConfirmWithIAgree(fmt.Sprintf("%sWARNING: Minipool %s has a distributable balance of %.6f ETH. Closing it in this state WILL RESULT in a loss of ETH. You will only receive %.6f ETH back. Please confirm you understand this and want to continue closing the minipool.%s", colorRed, minipool.Address.Hex(), math.RoundDown(eth.WeiToEth(distributableBalance), 6), math.RoundDown(eth.WeiToEth(&minipool.NodeShare), 6), colorReset)) {
fmt.Println("Cancelled.")
return nil
}
} else if distributableBalance.Cmp(thirtyTwo) < 0 {
// More than 31.5 but less than 32, ETH will be slashed with a yellow warning
if !cliutils.Confirm(fmt.Sprintf("%sWARNING: Minipool %s has a distributable balance of %.6f ETH. Closing it in this state WILL RESULT in a loss of ETH. You will only receive %.6f ETH back. Please confirm you understand this and want to continue closing the minipool.%s", colorYellow, minipool.Address.Hex(), math.RoundDown(eth.WeiToEth(distributableBalance), 6), math.RoundDown(eth.WeiToEth(minipool.NodeShare), 6), colorReset)) {
if !cliutils.Confirm(fmt.Sprintf("%sWARNING: Minipool %s has a distributable balance of %.6f ETH. Closing it in this state WILL RESULT in a loss of ETH. You will only receive %.6f ETH back. Please confirm you understand this and want to continue closing the minipool.%s", colorYellow, minipool.Address.Hex(), math.RoundDown(eth.WeiToEth(distributableBalance), 6), math.RoundDown(eth.WeiToEth(&minipool.NodeShare), 6), colorReset)) {
fmt.Println("Cancelled.")
return nil
}
Expand Down
16 changes: 8 additions & 8 deletions rocketpool-cli/minipool/distribute.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ func distributeBalance(c *cli.Context) error {
if mp.MinipoolVersion < 3 {
versionTooLowMinipools = append(versionTooLowMinipools, mp)
}
if mp.Balance.Cmp(mp.Refund) == -1 {
if mp.Balance.Cmp(&mp.Refund) == -1 {
balanceLessThanRefundMinipools = append(balanceLessThanRefundMinipools, mp)
}
effectiveBalance := big.NewInt(0).Sub(mp.Balance, mp.Refund)
effectiveBalance := big.NewInt(0).Sub(&mp.Balance, &mp.Refund)
if effectiveBalance.Cmp(finalizationAmount) >= 0 {
balanceTooBigMinipools = append(balanceTooBigMinipools, mp)
}
Expand Down Expand Up @@ -106,11 +106,11 @@ func distributeBalance(c *cli.Context) error {
for _, minipool := range eligibleMinipools {
if minipool.Status == types.Dissolved {
// Dissolved minipools are a special case
totalEthShare.Add(totalEthShare, minipool.Balance)
totalEthShare.Add(totalEthShare, &minipool.Balance)
} else {
totalEthAvailable.Add(totalEthAvailable, minipool.Balance)
totalEthShare.Add(totalEthShare, minipool.NodeShareOfBalance)
totalRefund.Add(totalRefund, minipool.Refund)
totalEthAvailable.Add(totalEthAvailable, &minipool.Balance)
totalEthShare.Add(totalEthShare, &minipool.NodeShareOfBalance)
totalRefund.Add(totalRefund, &minipool.Refund)
}
}

Expand All @@ -120,9 +120,9 @@ func distributeBalance(c *cli.Context) error {
for mi, minipool := range eligibleMinipools {
if minipool.Status == types.Dissolved {
// Dissolved minipools are a special case
options[mi+1] = fmt.Sprintf("%s (%.6f ETH available, all of which goes to you)", minipool.Address.Hex(), math.RoundDown(eth.WeiToEth(minipool.Balance), 6))
options[mi+1] = fmt.Sprintf("%s (%.6f ETH available, all of which goes to you)", minipool.Address.Hex(), math.RoundDown(eth.WeiToEth(&minipool.Balance), 6))
} else {
options[mi+1] = fmt.Sprintf("%s (%.6f ETH available, %.6f ETH goes to you plus a refund of %.6f ETH)", minipool.Address.Hex(), math.RoundDown(eth.WeiToEth(minipool.Balance), 6), math.RoundDown(eth.WeiToEth(minipool.NodeShareOfBalance), 6), math.RoundDown(eth.WeiToEth(minipool.Refund), 6))
options[mi+1] = fmt.Sprintf("%s (%.6f ETH available, %.6f ETH goes to you plus a refund of %.6f ETH)", minipool.Address.Hex(), math.RoundDown(eth.WeiToEth(&minipool.Balance), 6), math.RoundDown(eth.WeiToEth(&minipool.NodeShareOfBalance), 6), math.RoundDown(eth.WeiToEth(&minipool.Refund), 6))
}
}
selected, _ := cliutils.Select("Please select a minipool to distribute the balance of:", options)
Expand Down
8 changes: 4 additions & 4 deletions rocketpool-cli/minipool/reduce-bond.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ func beginReduceBondAmount(c *cli.Context) error {
gasInfo = canResponse.GasInfo
totalGas += canResponse.GasInfo.EstGasLimit
totalSafeGas += canResponse.GasInfo.SafeGasLimit
totalMatchRequest.Add(totalMatchRequest, canResponse.MatchRequest)
totalMatchRequest.Add(totalMatchRequest, &canResponse.MatchRequest)
}
}
gasInfo.EstGasLimit = totalGas
Expand All @@ -178,8 +178,8 @@ func beginReduceBondAmount(c *cli.Context) error {
if err != nil {
return fmt.Errorf("error checking the node's total collateral: %w", err)
}
totalMatchAvailable := big.NewInt(0).Sub(collateralResponse.EthMatchedLimit, collateralResponse.EthMatched)
totalMatchAvailable.Sub(totalMatchAvailable, collateralResponse.PendingMatchAmount)
totalMatchAvailable := big.NewInt(0).Sub(&collateralResponse.EthMatchedLimit, &collateralResponse.EthMatched)
totalMatchAvailable.Sub(totalMatchAvailable, &collateralResponse.PendingMatchAmount)
if totalMatchAvailable.Cmp(totalMatchRequest) < 0 {
fmt.Printf("You do not have enough RPL staked to support all of the selected bond reductions.\nYou can borrow %.6f more ETH, but are requesting %.6f ETH with these bond reductions.\nIn total, they would bring you below the minimum RPL staking requirement (including the RPL required for any pending bond reductions you've already started).\nYou will have to stake more RPL first.\n", eth.WeiToEth(totalMatchAvailable), eth.WeiToEth(totalMatchRequest))
return nil
Expand Down Expand Up @@ -370,7 +370,7 @@ func forceFeeDistribution(c *cli.Context, rp *rocketpool.Client) error {
return err
}

balance := eth.WeiToEth(canDistributeResponse.Balance)
balance := eth.WeiToEth(&canDistributeResponse.Balance)
if balance == 0 {
fmt.Println("Your fee distributor does not have any ETH and does not need to be distributed.\n")
return nil
Expand Down
4 changes: 2 additions & 2 deletions rocketpool-cli/minipool/rescue-dissolved.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func rescueDissolved(c *cli.Context) error {

for mi, minipool := range rescuableMinipools {
localRescueAmount := big.NewInt(0)
localRescueAmount.Sub(fullDepositAmount, minipool.BeaconBalance)
localRescueAmount.Sub(fullDepositAmount, &minipool.BeaconBalance)
rescueAmounts[mi] = localRescueAmount
rescueAmountFloats[mi] = math.RoundDown(eth.WeiToEth(localRescueAmount), 6)
options[mi] = fmt.Sprintf("%s (requires %.6f more ETH)", minipool.Address.Hex(), rescueAmountFloats[mi])
Expand All @@ -151,7 +151,7 @@ func rescueDissolved(c *cli.Context) error {
if bytes.Equal(minipool.Address.Bytes(), selectedAddress.Bytes()) {
selectedMinipool = &rescuableMinipools[i]
rescueAmount = big.NewInt(0)
rescueAmount.Sub(fullDepositAmount, selectedMinipool.BeaconBalance)
rescueAmount.Sub(fullDepositAmount, &selectedMinipool.BeaconBalance)
rescueAmountFloat = math.RoundDown(eth.WeiToEth(rescueAmount), 6)
break
}
Expand Down
8 changes: 4 additions & 4 deletions rocketpool-cli/minipool/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,15 @@ func printMinipoolDetails(minipool api.MinipoolDetails, latestDelegate common.Ad

// RP ETH deposit details - prelaunch & staking minipools
if minipool.Status.Status == types.Prelaunch || minipool.Status.Status == types.Staking {
totalRewards := big.NewInt(0).Add(minipool.NodeShareOfETHBalance, minipool.Node.RefundBalance)
totalRewards := big.NewInt(0).Add(&minipool.NodeShareOfETHBalance, minipool.Node.RefundBalance)
if minipool.User.DepositAssigned {
fmt.Printf("RP ETH assigned: %s\n", minipool.User.DepositAssignedTime.Format(TimeFormat))
fmt.Printf("RP deposit: %.6f ETH\n", math.RoundDown(eth.WeiToEth(minipool.User.DepositBalance), 6))
} else {
fmt.Printf("RP ETH assigned: no\n")
}
fmt.Printf("Minipool Balance (EL): %.6f ETH\n", math.RoundDown(eth.WeiToEth(minipool.Balances.ETH), 6))
fmt.Printf("Your portion: %.6f ETH\n", math.RoundDown(eth.WeiToEth(minipool.NodeShareOfETHBalance), 6))
fmt.Printf("Your portion: %.6f ETH\n", math.RoundDown(eth.WeiToEth(&minipool.NodeShareOfETHBalance), 6))
fmt.Printf("Available refund: %.6f ETH\n", math.RoundDown(eth.WeiToEth(minipool.Node.RefundBalance), 6))
fmt.Printf("Total EL rewards: %.6f ETH\n", math.RoundDown(eth.WeiToEth(totalRewards), 6))
}
Expand All @@ -194,8 +194,8 @@ func printMinipoolDetails(minipool api.MinipoolDetails, latestDelegate common.Ad
} else {
fmt.Printf("Validator active: no\n")
}
fmt.Printf("Beacon balance (CL): %.6f ETH\n", math.RoundDown(eth.WeiToEth(minipool.Validator.Balance), 6))
fmt.Printf("Your portion: %.6f ETH\n", math.RoundDown(eth.WeiToEth(minipool.Validator.NodeBalance), 6))
fmt.Printf("Beacon balance (CL): %.6f ETH\n", math.RoundDown(eth.WeiToEth(&minipool.Validator.Balance), 6))
fmt.Printf("Your portion: %.6f ETH\n", math.RoundDown(eth.WeiToEth(&minipool.Validator.NodeBalance), 6))
} else {
fmt.Printf("Validator seen: no\n")
}
Expand Down
2 changes: 1 addition & 1 deletion rocketpool-cli/network/rpl-price.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func getRplPrice(c *cli.Context) error {
}

// Print & return
fmt.Printf("The current network RPL price is %.6f ETH.\n", math.RoundDown(eth.WeiToEth(response.RplPrice), 6))
fmt.Printf("The current network RPL price is %.6f ETH.\n", math.RoundDown(eth.WeiToEth(&response.RplPrice), 6))
fmt.Printf("Prices last updated at block: %d\n", response.RplPriceBlock)
return nil

Expand Down
Loading