Skip to content

Commit

Permalink
Fixed init genesis methods
Browse files Browse the repository at this point in the history
See PR #346
  • Loading branch information
RiccardoM authored Jan 19, 2021
1 parent 5b1ceca commit 1cd2bc6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
7 changes: 5 additions & 2 deletions x/posts/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,13 @@ func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sd

// InitGenesis performs genesis initialization for the posts module.
// It returns no validator updates.
func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONMarshaler, data json.RawMessage) []abci.ValidatorUpdate {
func (am AppModule) InitGenesis(ctx sdk.Context, _ codec.JSONMarshaler, data json.RawMessage) []abci.ValidatorUpdate {
var genesisState types.GenesisState
err := json.Unmarshal(data, &genesisState)
if err != nil {
panic(err)
}

cdc.MustUnmarshalJSON(data, &genesisState)
am.keeper.InitGenesis(ctx, genesisState)
return []abci.ValidatorUpdate{}
}
Expand Down
6 changes: 4 additions & 2 deletions x/profiles/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,10 @@ func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sd
// It returns no validator updates.
func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONMarshaler, data json.RawMessage) []abci.ValidatorUpdate {
var genesisState types.GenesisState

cdc.MustUnmarshalJSON(data, &genesisState)
err := json.Unmarshal(data, &genesisState)
if err != nil {
panic(err)
}
am.keeper.InitGenesis(ctx, genesisState)
return []abci.ValidatorUpdate{}
}
Expand Down
6 changes: 4 additions & 2 deletions x/reports/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,10 @@ func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sd
// InitGenesis performs genesis initialization for the reports module. It returns no validator updates.
func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONMarshaler, data json.RawMessage) []abci.ValidatorUpdate {
var genesisState types.GenesisState

cdc.MustUnmarshalJSON(data, &genesisState)
err := json.Unmarshal(data, &genesisState)
if err != nil {
panic(err)
}
am.keeper.InitGenesis(ctx, genesisState)
return []abci.ValidatorUpdate{}
}
Expand Down

0 comments on commit 1cd2bc6

Please sign in to comment.