storagenode/heldamount: payuout history updated

Change-Id: I6dc91e9eed51f9b81af3e47a45168c43d254356a
This commit is contained in:
Qweder93 2020-08-04 15:32:47 +03:00 committed by Nikolai Siedov
parent e02adfe5e9
commit f804f03b1f

View File

@ -237,6 +237,7 @@ type PayoutHistory struct {
Held int64 `json:"held"`
AfterHeld int64 `json:"afterHeld"`
Disposed int64 `json:"disposed"`
Paid int64 `json:"paid"`
Receipt string `json:"receipt"`
IsExitComplete bool `json:"isExitComplete"`
}
@ -283,16 +284,20 @@ func (service *Service) PayoutHistoryMonthly(ctx context.Context, period string)
paystub.SurgePercent = 100
}
earned := paystub.CompGetAudit + paystub.CompGet + paystub.CompGetRepair + paystub.CompAtRest
surge := earned * paystub.SurgePercent / 100
payoutHistory.Held = paystub.Held
payoutHistory.Receipt = paystub.Receipt
payoutHistory.AfterHeld = paystub.Paid
payoutHistory.Surge = surge
payoutHistory.AfterHeld = surge - paystub.Held
payoutHistory.Age = int64(date.MonthsCountSince(stats.JoinedAt))
payoutHistory.Disposed = paystub.Disposed
payoutHistory.Surge = paystub.Paid * (paystub.SurgePercent/100 - 1)
payoutHistory.Earned = paystub.Paid
payoutHistory.Earned = earned
payoutHistory.SatelliteID = satelliteIDs[i].String()
payoutHistory.SurgePercent = paystub.SurgePercent
payoutHistory.SatelliteURL = url.Address
payoutHistory.Paid = paystub.Paid
result = append(result, payoutHistory)
}