-
Notifications
You must be signed in to change notification settings - Fork 2
/
genesis.go
36 lines (30 loc) · 906 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
34
35
36
package feesplit
import (
sdk "github.com/fibonacci-chain/fbc/libs/cosmos-sdk/types"
"github.com/fibonacci-chain/fbc/x/feesplit/keeper"
"github.com/fibonacci-chain/fbc/x/feesplit/types"
)
// InitGenesis import module genesis
func InitGenesis(
ctx sdk.Context,
k keeper.Keeper,
data types.GenesisState,
) {
k.SetParams(ctx, data.Params)
for _, feeSplit := range data.FeeSplits {
contract := feeSplit.ContractAddress
deployer := feeSplit.DeployerAddress
withdrawer := feeSplit.WithdrawerAddress
// Set initial contracts receiving transaction fees
k.SetFeeSplit(ctx, feeSplit)
k.SetDeployerMap(ctx, deployer, contract)
k.SetWithdrawerMap(ctx, withdrawer, contract)
}
}
// ExportGenesis export module state
func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState {
return &types.GenesisState{
Params: k.GetParams(ctx),
FeeSplits: k.GetFeeSplits(ctx),
}
}