func (k Keeper) DeleteLastValidatorPower(ctx sdk.Context, address sdk.ConsAddress) {
	store := ctx.KVStore(k.storeKey)
	store.Delete(types.GetValidatorLastPowerKey(address))
}
Delete validator power.
package keeper
import (
	"fmt"
	"github.com/cosmos/cosmos-sdk/codec"
	sdk "github.com/cosmos/cosmos-sdk/types"
	"github.com/tendermint/tendermint/libs/log"
	"github.com/zigbee-alliance/distributed-compliance-ledger/x/validator/internal/types"
)
type Keeper struct {
	storeKey sdk.StoreKey
	cdc *codec.Codec
}
func NewKeeper(key sdk.StoreKey, cdc *codec.Codec) Keeper {
	return Keeper{
		storeKey: key,
		cdc:      cdc,
	}
}
func (k Keeper) Logger(ctx sdk.Context) log.Logger {
	return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName))
}
func (k Keeper) GetValidator(ctx sdk.Context, addr sdk.ConsAddress) (validator types.Validator) {
	store := ctx.KVStore(k.storeKey)
	value := store.Get(types.GetValidatorKey(addr))
	if value == nil {
		panic(fmt.Sprintf("validator record not found for address: %X\n", addr))
	}
	validator = types.MustUnmarshalBinaryBareValidator(k.cdc, value)
	return validator
}
func (k Keeper) SetValidator(ctx sdk.Context, validator types.Validator) {
	store := ctx.KVStore(k.storeKey)
	bz := types.MustMarshalValidator(k.cdc, validator)
	store.Set(types.GetValidatorKey(validator.Address), bz)
}
func (k Keeper) IsValidatorPresent(ctx sdk.Context, addr sdk.ConsAddress) bool {
	store := ctx.KVStore(k.storeKey)
	return store.Has(types.GetValidatorKey(addr))
}
func (k Keeper) GetAllValidators(ctx sdk.Context) (validators []types.Validator) {
	k.IterateValidators(ctx, func(validator types.Validator) (stop bool) {
		validators = append(validators, validator)
		return false
	})
	return validators
}
func (k Keeper) IterateValidators(ctx sdk.Context, process func(validator types.Validator) (stop bool)) {
	store := ctx.KVStore(k.storeKey)
	iter := sdk.KVStorePrefixIterator(store, types.ValidatorPrefix)
	defer iter.Close()
	for {
		if !iter.Valid() {
			return
		}
		validator := types.MustUnmarshalBinaryBareValidator(k.cdc, iter.Value())
		if process(validator) {
			return
		}
		iter.Next()
	}
}
func (k Keeper) Slash(ctx sdk.Context, consAddr sdk.ConsAddress) {
	validator := k.GetValidator(ctx, consAddr)
	validator.Power = types.ZeroPower
	k.SetValidator(ctx, validator)
}
func (k Keeper) Jail(ctx sdk.Context, consAddr sdk.ConsAddress, reason string) {
	validator := k.GetValidator(ctx, consAddr)
	if validator.Jailed {
		k.Logger(ctx).Error(fmt.Sprintf("Cannot jail already jailed validator, validator: %v\n", validator))
		return
	}
	validator.Jailed = true
	validator.JailedReason = reason
	k.SetValidator(ctx, validator)
}
func (k Keeper) Unjail(ctx sdk.Context, consAddr sdk.ConsAddress) {
	validator := k.GetValidator(ctx, consAddr)
	if !validator.Jailed {
		k.Logger(ctx).Error(fmt.Sprintf("Cannot unjail already unjailed validator, validator: %v\n", validator))
		return
	}
	validator.Jailed = false
	validator.JailedReason = ""
	k.SetValidator(ctx, validator)
}
func (k Keeper) GetLastValidatorPower(ctx sdk.Context, address sdk.ConsAddress) (power types.LastValidatorPower) {
	store := ctx.KVStore(k.storeKey)
	bz := store.Get(types.GetValidatorLastPowerKey(address))
	if bz == nil {
		return power
	}
	k.cdc.MustUnmarshalBinaryLengthPrefixed(bz, &power)
	return power
}
func (k Keeper) SetLastValidatorPower(ctx sdk.Context, validator types.LastValidatorPower) {
	store := ctx.KVStore(k.storeKey)
	bz := k.cdc.MustMarshalBinaryLengthPrefixed(validator)
	store.Set(types.GetValidatorLastPowerKey(validator.ConsensusAddress), bz)
}
func (k Keeper) IsLastValidatorPowerPresent(ctx sdk.Context, address sdk.ConsAddress) bool {
	store := ctx.KVStore(k.storeKey)
	return store.Has(types.GetValidatorLastPowerKey(address))
}