0g-chain/x/validator-vesting/genesis.go

25 lines
914 B
Go
Raw Normal View History

2019-09-23 18:23:00 +00:00
package validatorvesting
import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth"
"github.com/cosmos/cosmos-sdk/x/validator-vesting/internal/types"
)
// InitGenesis stores the account address of each ValidatorVestingAccount in the validator vesting keeper, for faster lookup.
2019-09-27 18:48:57 +00:00
// CONTRACT: Accounts created by the account keeper must have already been initialized/created by AccountKeeper
2019-10-01 02:53:14 +00:00
func InitGenesis(ctx sdk.Context, keeper Keeper, data GenesisState) {
2019-09-23 18:23:00 +00:00
data.Accounts = auth.SanitizeGenesisAccounts(data.Accounts)
for _, a := range data.Accounts {
vv, ok := a.(ValidatorVestingAccount)
if ok {
keeper.SetValidatorVestingAccountKey(ctx, vv.Address)
}
}
}
2019-10-01 02:53:14 +00:00
// ExportGenesis returns empty genesis state because auth exports all the genesis state we need.
func ExportGenesis(ctx sdk.Context, keeper Keeper) types.GenesisState {
return types.DefaultGenesisState()
}