Jürgen Eckel a29f394bc4
192 migrate config params to on chain module params (#307)
* initial refactoring commit
* added config passing to network creation for some test suits
* fixed refactoring issues
* adjusted params

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2024-01-30 16:12:04 +01:00

36 lines
767 B
Go

package util
import (
"math"
)
var PopsPerCycle float64
func init() {
PopsPerCycle = 1051200.0
}
func GetPopNumber(blockHeight int64, popEpochs int64) float64 {
return float64(blockHeight) / float64(popEpochs)
}
func GetPopReward(blockHeight int64, popEpochs int64) (total uint64, challenger uint64, challengee uint64) {
PopNumber := GetPopNumber(blockHeight, popEpochs)
exactCycleID := PopNumber / PopsPerCycle
switch cycleID := math.Floor(exactCycleID); cycleID {
case 0:
return 7990867578, 1997716894, 5993150684
case 1:
return 3995433789, 998858447, 2996575342
case 2:
return 1997716894, 499429223, 1498287671
case 3:
return 998858446, 249714611, 749143835
case 4:
return 499429222, 124857305, 374571917
default:
return 0, 0, 0
}
}