github.com/KiraCore/sekai@v0.3.43/app/export.go (about) 1 package app 2 3 import ( 4 "encoding/json" 5 6 customstaking "github.com/KiraCore/sekai/x/staking" 7 tmproto "github.com/cometbft/cometbft/proto/tendermint/types" 8 servertypes "github.com/cosmos/cosmos-sdk/server/types" 9 ) 10 11 // ExportAppStateAndValidators export the state of Sekai for a genesis file 12 func (app *SekaiApp) ExportAppStateAndValidators( 13 forZeroHeight bool, jailAllowedAddrs []string, 14 ) (servertypes.ExportedApp, error) { 15 16 ctx := app.NewContext(true, tmproto.Header{Height: app.LastBlockHeight()}) 17 18 // TODO: handle zero height upgrades 19 height := app.LastBlockHeight() + 1 20 21 genState := app.mm.ExportGenesis(ctx, app.appCodec) 22 appState, err := json.MarshalIndent(genState, "", " ") 23 if err != nil { 24 return servertypes.ExportedApp{}, err 25 } 26 27 validators, err := customstaking.WriteValidators(ctx, app.CustomStakingKeeper) 28 return servertypes.ExportedApp{ 29 AppState: appState, 30 Validators: validators, 31 Height: height, 32 ConsensusParams: app.BaseApp.GetConsensusParams(ctx), 33 }, err 34 }