-
Notifications
You must be signed in to change notification settings - Fork 581
/
genesis.go
33 lines (29 loc) · 909 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 keeper
import (
"github.com/osmosis-labs/osmosis/v20/x/lockup/types"
sdk "github.com/cosmos/cosmos-sdk/types"
)
// InitGenesis initializes the capability module's state from a provided genesis
// state.
func (k Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState) {
k.SetParams(ctx, types.DefaultParams())
k.SetLastLockID(ctx, genState.LastLockId)
if err := k.InitializeAllLocks(ctx, genState.Locks); err != nil {
return
}
if err := k.InitializeAllSyntheticLocks(ctx, genState.SyntheticLocks); err != nil {
return
}
}
// ExportGenesis returns the capability module's exported genesis.
func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState {
locks, err := k.GetPeriodLocks(ctx)
if err != nil {
panic(err)
}
return &types.GenesisState{
LastLockId: k.GetLastLockID(ctx),
Locks: locks,
SyntheticLocks: k.GetAllSyntheticLockups(ctx),
}
}