feat: Integrating POB into sim-app base app. (#130)
Co-authored-by: Aleksandr Bezobchuk <aleks.bezobchuk@gmail.com>
This commit is contained in:
co-authored by
Aleksandr Bezobchuk
parent
e96831c244
commit
4da95939f5
@@ -1,5 +1,11 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
)
|
||||
|
||||
// NewGenesisState creates a new GenesisState instance.
|
||||
func NewGenesisState(params Params) *GenesisState {
|
||||
return &GenesisState{
|
||||
@@ -18,3 +24,15 @@ func DefaultGenesisState() *GenesisState {
|
||||
func (gs GenesisState) Validate() error {
|
||||
return gs.Params.Validate()
|
||||
}
|
||||
|
||||
// GetGenesisStateFromAppState returns x/builder GenesisState given raw application
|
||||
// genesis state.
|
||||
func GetGenesisStateFromAppState(cdc codec.Codec, appState map[string]json.RawMessage) GenesisState {
|
||||
var genesisState GenesisState
|
||||
|
||||
if appState[ModuleName] != nil {
|
||||
cdc.MustUnmarshalJSON(appState[ModuleName], &genesisState)
|
||||
}
|
||||
|
||||
return genesisState
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user