-
Notifications
You must be signed in to change notification settings - Fork 12
/
genesis.go
37 lines (28 loc) · 1.04 KB
/
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
34
35
36
37
package regulator
import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/allinbits/cosmos-cash/v2/x/regulator/keeper"
"github.com/allinbits/cosmos-cash/v2/x/regulator/types"
)
// DefaultGenesis returns the default issuer genesis state
func DefaultGenesis(addresses ...string) *types.GenesisState {
return &types.GenesisState{
Regulators: &types.Regulators{
Addresses: addresses,
},
}
}
// InitGenesis initializes the capability module's state from a provided genesis
// state.
func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) {
// get the regulator parameters and store them on chain
rp := genState.GetRegulators()
k.SetRegulators(ctx, rp)
}
// ExportGenesis returns the capability module's exported genesis.
func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState {
genesis := types.DefaultGenesis(k.GetRegulatorsAddresses(ctx)...)
// this line is used by starport scaffolding # genesis/module/export
// this line is used by starport scaffolding # ibc/genesis/export
return genesis
}