2019-09-23 18:23:00 +00:00
|
|
|
package validatorvesting
|
|
|
|
|
|
|
|
import (
|
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
2020-04-30 14:13:31 +00:00
|
|
|
|
2020-04-04 23:26:15 +00:00
|
|
|
"github.com/kava-labs/kava/x/validator-vesting/types"
|
2019-09-23 18:23:00 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// InitGenesis stores the account address of each ValidatorVestingAccount in the validator vesting keeper, for faster lookup.
|
2019-10-02 13:10:28 +00:00
|
|
|
// CONTRACT: Accounts must have already been initialized/created by AccountKeeper
|
|
|
|
func InitGenesis(ctx sdk.Context, keeper Keeper, accountKeeper types.AccountKeeper, data GenesisState) {
|
|
|
|
|
|
|
|
accounts := accountKeeper.GetAllAccounts(ctx)
|
|
|
|
for _, a := range accounts {
|
2019-10-03 19:13:38 +00:00
|
|
|
vv, ok := a.(*ValidatorVestingAccount)
|
2019-09-23 18:23:00 +00:00
|
|
|
if ok {
|
|
|
|
keeper.SetValidatorVestingAccountKey(ctx, vv.Address)
|
|
|
|
}
|
|
|
|
}
|
2019-10-02 13:10:28 +00:00
|
|
|
keeper.SetPreviousBlockTime(ctx, data.PreviousBlockTime)
|
2019-09-23 18:23:00 +00:00
|
|
|
}
|
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 {
|
2019-10-02 13:10:28 +00:00
|
|
|
prevBlockTime := keeper.GetPreviousBlockTime(ctx)
|
2020-02-25 15:11:09 +00:00
|
|
|
return NewGenesisState(prevBlockTime)
|
2019-10-01 02:53:14 +00:00
|
|
|
}
|