forked from babylonlabs-io/babylon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenesis.go
33 lines (28 loc) · 861 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 epoching
import (
"context"
"github.com/babylonlabs-io/babylon/x/epoching/keeper"
"github.com/babylonlabs-io/babylon/x/epoching/types"
)
// InitGenesis initializes the capability module's state from a provided genesis
// state.
func InitGenesis(ctx context.Context, k keeper.Keeper, genState types.GenesisState) {
// set params for this module
if err := k.SetParams(ctx, genState.Params); err != nil {
panic(err)
}
// init epoch number
k.InitEpoch(ctx)
// init msg queue
k.InitMsgQueue(ctx)
// init validator set
k.InitValidatorSet(ctx)
// init slashed voting power
k.InitSlashedVotingPower(ctx)
}
// ExportGenesis returns the capability module's exported genesis.
func ExportGenesis(ctx context.Context, k keeper.Keeper) *types.GenesisState {
genesis := types.DefaultGenesis()
genesis.Params = k.GetParams(ctx)
return genesis
}