ac8685f701
Some checks failed
Build / build (pull_request) Successful in 3m7s
Protobuf / lint (pull_request) Successful in 23s
Integration Tests / test-integration (pull_request) Successful in 3m0s
E2E Tests / test-e2e (pull_request) Successful in 4m44s
Unit Tests / test-unit (pull_request) Successful in 2m40s
SDK Tests / sdk_tests_nameservice_expiry (pull_request) Successful in 8m29s
SDK Tests / sdk_tests (pull_request) Failing after 10m13s
SDK Tests / sdk_tests_auctions (pull_request) Successful in 14m29s
44 lines
1.1 KiB
Go
44 lines
1.1 KiB
Go
package keeper
|
|
|
|
import (
|
|
"context"
|
|
|
|
"git.vdb.to/cerc-io/laconicd/x/onboarding"
|
|
)
|
|
|
|
// InitGenesis initializes the module state from a genesis state.
|
|
func (k *Keeper) InitGenesis(ctx context.Context, data *onboarding.GenesisState) error {
|
|
if err := k.Params.Set(ctx, data.Params); err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, participant := range data.Participants {
|
|
if err := k.Participants.Set(ctx, participant.LaconicAddress, participant); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// ExportGenesis exports the module state to a genesis state.
|
|
func (k *Keeper) ExportGenesis(ctx context.Context) (*onboarding.GenesisState, error) {
|
|
params, err := k.Params.Get(ctx)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
var participants []onboarding.Participant
|
|
if err := k.Participants.Walk(ctx, nil, func(laconicAddress string, participant onboarding.Participant) (bool, error) {
|
|
participants = append(participants, participant)
|
|
return false, nil
|
|
}); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &onboarding.GenesisState{
|
|
Params: params,
|
|
Participants: participants,
|
|
}, nil
|
|
}
|