You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.4 KiB
40 lines
1.4 KiB
package reward
|
|
|
|
import (
|
|
"math/big"
|
|
"testing"
|
|
|
|
shardingconfig "github.com/woop-chain/woop/internal/configs/sharding"
|
|
"github.com/woop-chain/woop/numeric"
|
|
)
|
|
|
|
func TestFiveSecondsBaseStakedReward(t *testing.T) {
|
|
expectedNewReward := StakedBlocks.Mul(numeric.MustNewDecFromStr("5")).Quo(numeric.MustNewDecFromStr("8"))
|
|
|
|
if !expectedNewReward.Equal(FiveSecStakedBlocks) {
|
|
t.Errorf(
|
|
"Expected: %s, Got: %s", FiveSecStakedBlocks.String(), expectedNewReward.String(),
|
|
)
|
|
}
|
|
|
|
expectedNewReward = StakedBlocks.Mul(numeric.MustNewDecFromStr("2")).Quo(numeric.MustNewDecFromStr("8"))
|
|
if !expectedNewReward.Equal(TwoSecStakedBlocks) {
|
|
t.Errorf(
|
|
"Expected: %s, Got: %s", TwoSecStakedBlocks.String(), expectedNewReward.String(),
|
|
)
|
|
}
|
|
}
|
|
|
|
func TestGetPreStakingRewardsFromBlockNumber(t *testing.T) {
|
|
refMainnetRewards, _ := new(big.Int).SetString("319237464000000000000000000", 10)
|
|
mainnetRewards := getTotalPreStakingNetworkRewards(shardingconfig.MainNet)
|
|
if refMainnetRewards.Cmp(mainnetRewards) != 0 {
|
|
t.Errorf("Expected mainnet rewards to be %v NOT %v", refMainnetRewards, mainnetRewards)
|
|
}
|
|
|
|
refTestnetRewards, _ := new(big.Int).SetString("7104000000000000000000", 10)
|
|
testnetRewards := getTotalPreStakingNetworkRewards(shardingconfig.TestNet)
|
|
if refTestnetRewards.Cmp(testnetRewards) != 0 {
|
|
t.Errorf("Expected testnet rewards to be %v NOT %v", refTestnetRewards, testnetRewards)
|
|
}
|
|
}
|
|
|