mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-26 00:05:18 +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
41 lines
1.1 KiB
Go
41 lines
1.1 KiB
Go
package testutil
|
|
|
|
import (
|
|
"github.com/cosmos/cosmos-sdk/codec"
|
|
"github.com/kava-labs/kava/app"
|
|
|
|
earntypes "github.com/kava-labs/kava/x/earn/types"
|
|
)
|
|
|
|
// EarnGenesisBuilder is a tool for creating a earn genesis state.
|
|
// Helper methods add values onto a default genesis state.
|
|
// All methods are immutable and return updated copies of the builder.
|
|
type EarnGenesisBuilder struct {
|
|
earntypes.GenesisState
|
|
}
|
|
|
|
var _ GenesisBuilder = (*EarnGenesisBuilder)(nil)
|
|
|
|
func NewEarnGenesisBuilder() EarnGenesisBuilder {
|
|
return EarnGenesisBuilder{
|
|
GenesisState: earntypes.DefaultGenesisState(),
|
|
}
|
|
}
|
|
|
|
func (builder EarnGenesisBuilder) Build() earntypes.GenesisState {
|
|
return builder.GenesisState
|
|
}
|
|
|
|
func (builder EarnGenesisBuilder) BuildMarshalled(cdc codec.JSONCodec) app.GenesisState {
|
|
built := builder.Build()
|
|
|
|
return app.GenesisState{
|
|
earntypes.ModuleName: cdc.MustMarshalJSON(&built),
|
|
}
|
|
}
|
|
|
|
func (builder EarnGenesisBuilder) WithAllowedVaults(vault ...earntypes.AllowedVault) EarnGenesisBuilder {
|
|
builder.Params.AllowedVaults = append(builder.Params.AllowedVaults, vault...)
|
|
return builder
|
|
}
|