mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-11-14 03:55:19 +00:00
016eecfcc0
* use kavamint in incentive to calculate staking apy * use kavamint minting: rewards_earn_staking_integration_test * update incentive tests to mint only with kavamint * remove x/mint from incentive tests * remove x/mint from kava app * fix minting in x/auction tests * replace simapp fund calls with test helper * remove mint state from genesis.json
60 lines
1.6 KiB
Go
60 lines
1.6 KiB
Go
package testutil
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/cosmos/cosmos-sdk/codec"
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
"github.com/kava-labs/kava/app"
|
|
|
|
kavaminttypes "github.com/kava-labs/kava/x/kavamint/types"
|
|
)
|
|
|
|
// KavamintGenesisBuilder is a tool for creating a mint genesis state.
|
|
// Helper methods add values onto a default genesis state.
|
|
// All methods are immutable and return updated copies of the builder.
|
|
type KavamintGenesisBuilder struct {
|
|
kavaminttypes.GenesisState
|
|
}
|
|
|
|
var _ GenesisBuilder = (*KavamintGenesisBuilder)(nil)
|
|
|
|
func NewKavamintGenesisBuilder() KavamintGenesisBuilder {
|
|
gen := kavaminttypes.DefaultGenesisState()
|
|
gen.Params.CommunityPoolInflation = sdk.ZeroDec()
|
|
gen.Params.StakingRewardsApy = sdk.ZeroDec()
|
|
|
|
return KavamintGenesisBuilder{
|
|
GenesisState: *gen,
|
|
}
|
|
}
|
|
|
|
func (builder KavamintGenesisBuilder) Build() kavaminttypes.GenesisState {
|
|
return builder.GenesisState
|
|
}
|
|
|
|
func (builder KavamintGenesisBuilder) BuildMarshalled(cdc codec.JSONCodec) app.GenesisState {
|
|
built := builder.Build()
|
|
|
|
return app.GenesisState{
|
|
kavaminttypes.ModuleName: cdc.MustMarshalJSON(&built),
|
|
}
|
|
}
|
|
|
|
func (builder KavamintGenesisBuilder) WithPreviousBlockTime(t time.Time) KavamintGenesisBuilder {
|
|
builder.PreviousBlockTime = t
|
|
return builder
|
|
}
|
|
|
|
func (builder KavamintGenesisBuilder) WithStakingRewardsApy(apy sdk.Dec) KavamintGenesisBuilder {
|
|
builder.Params.StakingRewardsApy = apy
|
|
return builder
|
|
}
|
|
|
|
func (builder KavamintGenesisBuilder) WithCommunityPoolInflation(
|
|
inflation sdk.Dec,
|
|
) KavamintGenesisBuilder {
|
|
builder.Params.CommunityPoolInflation = inflation
|
|
return builder
|
|
}
|