-
Notifications
You must be signed in to change notification settings - Fork 39
/
genesis.go
33 lines (26 loc) · 975 Bytes
/
genesis.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package market
import (
"fmt"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/classic-terra/core/v2/x/market/keeper"
"github.com/classic-terra/core/v2/x/market/types"
)
// InitGenesis initialize default parameters
// and the keeper's address to pubkey map
func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, data *types.GenesisState) {
keeper.SetParams(ctx, data.Params)
keeper.SetTerraPoolDelta(ctx, data.TerraPoolDelta)
// check if the module account exists
moduleAcc := keeper.GetMarketAccount(ctx)
if moduleAcc == nil {
panic(fmt.Sprintf("%s module account has not been set", types.ModuleName))
}
}
// ExportGenesis writes the current store values
// to a genesis file, which can be imported again
// with InitGenesis
func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) (data *types.GenesisState) {
params := keeper.GetParams(ctx)
terraPoolDelta := keeper.GetTerraPoolDelta(ctx)
return types.NewGenesisState(terraPoolDelta, params)
}