Skip to content

Commit

Permalink
Merge pull request #752 from klim0v/m3-dev
Browse files Browse the repository at this point in the history
refactor
  • Loading branch information
Klimov Sergey committed Mar 29, 2022
2 parents 04cdebd + f37c0a6 commit 6c2417a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions coreV2/state/validators/validators.go
Original file line number Diff line number Diff line change
Expand Up @@ -464,13 +464,12 @@ func (v *Validators) PayRewardsV3(height uint64, period int64) (moreRewards *big

safeRewardVariable := big.NewInt(0).Set(reward)
if validator.bus.Accounts().IsX3Mining(stake.Owner, height) {
// todo: move up
safeRewards := big.NewInt(0).Mul(safeReward, big.NewInt(period))
safeRewards.Mul(safeRewards, stake.BipValue)
safeRewards.Div(safeRewards, validator.GetTotalBipStake())
safeRewards.Mul(safeRewards, big.NewInt(3))
safeRewards.Sub(safeRewards, big.NewInt(0).Div(big.NewInt(0).Mul(safeRewards, big.NewInt(int64(developers.Commission+dao.Commission))), big.NewInt(100)))
safeRewards.Sub(safeRewards, big.NewInt(0).Div(big.NewInt(0).Mul(safeRewards, big.NewInt(int64(candidate.Commission))), big.NewInt(100)))
safeRewards.Mul(safeRewards, big.NewInt(3))

calcRewards := big.NewInt(0).Mul(calcReward, big.NewInt(period))
calcRewards.Mul(calcRewards, stake.BipValue)
Expand All @@ -481,6 +480,9 @@ func (v *Validators) PayRewardsV3(height uint64, period int64) (moreRewards *big
feeRewards := big.NewInt(0).Sub(reward, calcRewards)

safeRewardVariable.Set(big.NewInt(0).Add(safeRewards, feeRewards))
if safeRewardVariable.Sign() < 1 {
continue
}

moreRewards.Add(moreRewards, new(big.Int).Sub(safeRewardVariable, reward))
}
Expand Down

0 comments on commit 6c2417a

Please sign in to comment.