refactor: move x/auth, x/authz, x/slashing and x/mint Init/Export genesis to keeper (#11871)
This commit is contained in:
@@ -1,20 +1,19 @@
|
||||
package mint
|
||||
package keeper
|
||||
|
||||
import (
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/mint/keeper"
|
||||
"github.com/cosmos/cosmos-sdk/x/mint/types"
|
||||
)
|
||||
|
||||
// InitGenesis new mint genesis
|
||||
func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, ak types.AccountKeeper, data *types.GenesisState) {
|
||||
func (keeper Keeper) InitGenesis(ctx sdk.Context, ak types.AccountKeeper, data *types.GenesisState) {
|
||||
keeper.SetMinter(ctx, data.Minter)
|
||||
keeper.SetParams(ctx, data.Params)
|
||||
ak.GetModuleAccount(ctx, types.ModuleName)
|
||||
}
|
||||
|
||||
// ExportGenesis returns a GenesisState for a given context and keeper.
|
||||
func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) *types.GenesisState {
|
||||
func (keeper Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState {
|
||||
minter := keeper.GetMinter(ctx)
|
||||
params := keeper.GetParams(ctx)
|
||||
return types.NewGenesisState(minter, params)
|
||||
+2
-2
@@ -136,14 +136,14 @@ func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.
|
||||
var genesisState types.GenesisState
|
||||
cdc.MustUnmarshalJSON(data, &genesisState)
|
||||
|
||||
InitGenesis(ctx, am.keeper, am.authKeeper, &genesisState)
|
||||
am.keeper.InitGenesis(ctx, am.authKeeper, &genesisState)
|
||||
return []abci.ValidatorUpdate{}
|
||||
}
|
||||
|
||||
// ExportGenesis returns the exported genesis state as raw bytes for the mint
|
||||
// module.
|
||||
func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage {
|
||||
gs := ExportGenesis(ctx, am.keeper)
|
||||
gs := am.keeper.ExportGenesis(ctx)
|
||||
return cdc.MustMarshalJSON(gs)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user