Skip to content

Commit 37dafda

Browse files
committed
Fixed struct tags, added saturn check to pre-saturn rplStakeThreshold calc
1 parent 825070a commit 37dafda

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

rocketpool/api/node/status.go

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -510,15 +510,16 @@ func getStatus(c *cli.Context) (*api.NodeStatusResponse, error) {
510510
return nil, err
511511
}
512512

513-
// Calculate the *real* maximum, including the pending bond reductions
514-
trueRplStakeThreshold := eth.EthToWei(32)
515-
trueRplStakeThreshold.Mul(trueRplStakeThreshold, big.NewInt(int64(totalActiveValidators)))
516-
trueRplStakeThreshold.Sub(trueRplStakeThreshold, response.EthBorrowed)
517-
trueRplStakeThreshold.Sub(trueRplStakeThreshold, response.PendingBorrowAmount) // (32 * totalActiveValidators - ethBorrowed - pendingBorrow)
518-
trueRplStakeThreshold.Mul(trueRplStakeThreshold, rplStakeThresholdFraction)
519-
trueRplStakeThreshold.Div(trueRplStakeThreshold, rplPrice)
520-
521-
response.RplStakeThreshold = trueRplStakeThreshold
513+
if !saturnDeployed {
514+
// Calculate the *real* maximum, including the pending bond reductions
515+
trueRplStakeThreshold := eth.EthToWei(32)
516+
trueRplStakeThreshold.Mul(trueRplStakeThreshold, big.NewInt(int64(totalActiveValidators)))
517+
trueRplStakeThreshold.Sub(trueRplStakeThreshold, response.EthBorrowed)
518+
trueRplStakeThreshold.Sub(trueRplStakeThreshold, response.PendingBorrowAmount) // (32 * totalActiveValidators - ethBorrowed - pendingBorrow)
519+
trueRplStakeThreshold.Mul(trueRplStakeThreshold, rplStakeThresholdFraction)
520+
trueRplStakeThreshold.Div(trueRplStakeThreshold, rplPrice)
521+
response.RplStakeThreshold = trueRplStakeThreshold
522+
}
522523

523524
response.BondedCollateralRatio = eth.WeiToEth(rplPrice) * eth.WeiToEth(response.TotalRplStake) / (float64(totalActiveValidators)*32.0 - eth.WeiToEth(response.EthBorrowed) - eth.WeiToEth(response.PendingBorrowAmount))
524525
response.BorrowedCollateralRatio = eth.WeiToEth(rplPrice) * eth.WeiToEth(response.TotalRplStake) / (eth.WeiToEth(response.EthBorrowed) + eth.WeiToEth(response.PendingBorrowAmount))

shared/types/api/node.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ type NodeStatusResponse struct {
4040
TotalRplStake *big.Int `json:"totalRplStake"`
4141
RplStakeMegapool *big.Int `json:"rplStakeMegapool"`
4242
RplStakeLegacy *big.Int `json:"rplStakeLegacy"`
43-
RplStakeThreshold *big.Int `json:"maximumRplStake"`
44-
RplStakeThresholdFraction float64 `json:"maximumStakeFraction"`
43+
RplStakeThreshold *big.Int `json:"rplStakeThreshold"`
44+
RplStakeThresholdFraction float64 `json:"rplStakeThresholdFraction"`
4545
BorrowedCollateralRatio float64 `json:"borrowedCollateralRatio"`
4646
BondedCollateralRatio float64 `json:"bondedCollateralRatio"`
4747
PendingMinimumRplStake *big.Int `json:"pendingMinimumRplStake"`

0 commit comments

Comments
 (0)