0g-chain/x/savings/genesis.go
Denali Marsh 8540a5c06f
Savings module scaffold (#1188)
* module files

* proto types

* types and generated proto types

* keeper

* client scaffold

* add savings module to app

* remove placeholder types file

* implement rest and add to module

* update comments

* remove unused imports from proto files

* remove abci

* remove refs to other modules

* remove endblocker call

* genesis init test for module account
2022-03-22 22:13:27 +01:00

28 lines
790 B
Go

package savings
import (
"fmt"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/kava-labs/kava/x/savings/keeper"
"github.com/kava-labs/kava/x/savings/types"
)
// InitGenesis initializes genesis state
func InitGenesis(ctx sdk.Context, k keeper.Keeper, ak types.AccountKeeper, gs types.GenesisState) {
k.SetParams(ctx, gs.Params)
// check if the module account exists
SavingsModuleAccount := ak.GetModuleAccount(ctx, types.ModuleAccountName)
if SavingsModuleAccount == nil {
panic(fmt.Sprintf("%s module account has not been set", SavingsModuleAccount))
}
}
// ExportGenesis returns a GenesisState for a given context and keeper
func ExportGenesis(ctx sdk.Context, k keeper.Keeper) types.GenesisState {
params := k.GetParams(ctx)
return types.NewGenesisState(params)
}