-
Notifications
You must be signed in to change notification settings - Fork 7
/
genesis.go
30 lines (25 loc) · 904 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
// Copyright 2021 ChainSafe Systems
// SPDX-License-Identifier: MIT
package chainlink
import (
"github.com/ChainSafe/chainlink-cosmos/x/chainlink/keeper"
"github.com/ChainSafe/chainlink-cosmos/x/chainlink/types"
sdk "github.com/cosmos/cosmos-sdk/types"
)
// InitGenesis initializes the chainlink module's state from a provided genesis state.
func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) {
for _, owner := range genState.GetModuleOwners() {
m := types.MsgModuleOwner{
Address: owner.GetAddress(),
PubKey: owner.GetPubKey(),
}
k.SetModuleOwner(ctx, &m)
}
}
// ExportGenesis returns the chainlink module's exported genesis.
func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState {
genesis := types.DefaultGenesis()
moduleOwners := k.GetModuleOwnerList(ctx)
genesis.ModuleOwners = moduleOwners.GetModuleOwner()
return genesis
}