mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-11-14 03:55:19 +00:00
73bc32a183
* Update incentive test to use beginblocker instead manual accumulation * Update integration test suite * Add base integration test, wip staking reward calculation * Get actual staking reward amounts from BeginBlocker events, calculate expected indexes * Simplify event parsing * Add initial earn accum test with real keepers * Add the rest of the accum integration tests with real keepers * Check if delegation rewards are zero before transferring * Update staking integration test to use updated methods
39 lines
989 B
Go
39 lines
989 B
Go
package testutil
|
|
|
|
import (
|
|
"github.com/cosmos/cosmos-sdk/codec"
|
|
"github.com/kava-labs/kava/app"
|
|
|
|
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
|
|
)
|
|
|
|
// StakingGenesisBuilder is a tool for creating a staking genesis state.
|
|
// Helper methods add values onto a default genesis state.
|
|
// All methods are immutable and return updated copies of the builder.
|
|
type StakingGenesisBuilder struct {
|
|
stakingtypes.GenesisState
|
|
}
|
|
|
|
var _ GenesisBuilder = (*StakingGenesisBuilder)(nil)
|
|
|
|
func NewStakingGenesisBuilder() StakingGenesisBuilder {
|
|
gen := stakingtypes.DefaultGenesisState()
|
|
gen.Params.BondDenom = "ukava"
|
|
|
|
return StakingGenesisBuilder{
|
|
GenesisState: *gen,
|
|
}
|
|
}
|
|
|
|
func (builder StakingGenesisBuilder) Build() stakingtypes.GenesisState {
|
|
return builder.GenesisState
|
|
}
|
|
|
|
func (builder StakingGenesisBuilder) BuildMarshalled(cdc codec.JSONCodec) app.GenesisState {
|
|
built := builder.Build()
|
|
|
|
return app.GenesisState{
|
|
stakingtypes.ModuleName: cdc.MustMarshalJSON(&built),
|
|
}
|
|
}
|