Add simple WriteGenesis for stake & cool modules
This commit is contained in:
parent
ff66629b68
commit
f71191e402
|
@ -113,7 +113,7 @@ func (app *GaiaApp) initChainer(ctx sdk.Context, req abci.RequestInitChain) abci
|
|||
}
|
||||
|
||||
// load the initial stake information
|
||||
stake.InitGenesis(ctx, app.stakeKeeper, genesisState.StakeData)
|
||||
app.stakeKeeper.InitGenesis(ctx, genesisState.StakeData)
|
||||
|
||||
return abci.ResponseInitChain{}
|
||||
}
|
||||
|
|
|
@ -48,3 +48,9 @@ func (k Keeper) InitGenesis(ctx sdk.Context, data Genesis) error {
|
|||
k.setTrend(ctx, data.Trend)
|
||||
return nil
|
||||
}
|
||||
|
||||
// WriteGenesis - output the genesis trend
|
||||
func (k Keeper) WriteGenesis(ctx sdk.Context) Genesis {
|
||||
trend := k.GetTrend(ctx)
|
||||
return Genesis{trend}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ func NewEndBlocker(k Keeper) sdk.EndBlocker {
|
|||
//_____________________________________________________________________
|
||||
|
||||
// InitGenesis - store genesis parameters
|
||||
func InitGenesis(ctx sdk.Context, k Keeper, data GenesisState) {
|
||||
func (k Keeper) InitGenesis(ctx sdk.Context, data GenesisState) {
|
||||
k.setPool(ctx, data.Pool)
|
||||
k.setParams(ctx, data.Params)
|
||||
for _, candidate := range data.Candidates {
|
||||
|
@ -57,6 +57,13 @@ func InitGenesis(ctx sdk.Context, k Keeper, data GenesisState) {
|
|||
}
|
||||
}
|
||||
|
||||
// WriteGenesis - output genesis parameters
|
||||
func (k Keeper) WriteGenesis(ctx sdk.Context) GenesisState {
|
||||
pool := k.GetPool(ctx)
|
||||
params := k.GetParams(ctx)
|
||||
return GenesisState{pool, params}
|
||||
}
|
||||
|
||||
//_____________________________________________________________________
|
||||
|
||||
// These functions assume everything has been authenticated,
|
||||
|
|
Loading…
Reference in New Issue