Documentation ¶
Index ¶
- Variables
- func CreateValidators(ctx sdk.Context, sk staking.Keeper, powers []int64)
- func MakeTestCodec() *codec.Codec
- func NewQuerier(keeper Keeper) sdk.Querier
- func ValidatorVestingDelegatorTestAccount(startTime time.Time) *types.ValidatorVestingAccount
- func ValidatorVestingTestAccount() *types.ValidatorVestingAccount
- func ValidatorVestingTestAccounts(numAccounts int) []*types.ValidatorVestingAccount
- type Keeper
- func (k Keeper) AccountIsVesting(ctx sdk.Context, addr sdk.AccAddress) bool
- func (k Keeper) AddDebt(ctx sdk.Context, addr sdk.AccAddress, amount sdk.Coins)
- func (k Keeper) GetAccountFromAuthKeeper(ctx sdk.Context, addr sdk.AccAddress) *types.ValidatorVestingAccount
- func (k Keeper) GetAllAccountKeys(ctx sdk.Context) (keys [][]byte)
- func (k Keeper) GetPeriodEndTimes(ctx sdk.Context, addr sdk.AccAddress) []int64
- func (k Keeper) GetPreviousBlockTime(ctx sdk.Context) (blockTime time.Time)
- func (k Keeper) HandleVestingDebt(ctx sdk.Context, addr sdk.AccAddress, blockTime time.Time)
- func (k Keeper) IterateAccountKeys(ctx sdk.Context, cb func(accountKey []byte) (stop bool))
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) ResetCurrentPeriodProgress(ctx sdk.Context, addr sdk.AccAddress)
- func (k Keeper) ResetDebt(ctx sdk.Context, addr sdk.AccAddress)
- func (k Keeper) SetPreviousBlockTime(ctx sdk.Context, blockTime time.Time)
- func (k Keeper) SetValidatorVestingAccountKey(ctx sdk.Context, addr sdk.AccAddress)
- func (k Keeper) SetVestingProgress(ctx sdk.Context, addr sdk.AccAddress, period int, success bool)
- func (k Keeper) UpdateMissingSignCount(ctx sdk.Context, addr sdk.AccAddress, missedBlock bool)
- func (k Keeper) UpdateVestedCoinsProgress(ctx sdk.Context, addr sdk.AccAddress, period int)
Constants ¶
This section is empty.
Variables ¶
var ( ValOpPk1 = ed25519.GenPrivKey().PubKey() ValOpPk2 = ed25519.GenPrivKey().PubKey() ValOpPk3 = ed25519.GenPrivKey().PubKey() ValOpAddr1 = sdk.ValAddress(ValOpPk1.Address()) ValOpAddr2 = sdk.ValAddress(ValOpPk2.Address()) ValOpAddr3 = sdk.ValAddress(ValOpPk3.Address()) ValConsPk11 = ed25519.GenPrivKey().PubKey() ValConsPk12 = ed25519.GenPrivKey().PubKey() ValConsPk13 = ed25519.GenPrivKey().PubKey() ValConsAddr1 = sdk.ConsAddress(ValConsPk11.Address()) ValConsAddr2 = sdk.ConsAddress(ValConsPk12.Address()) ValConsAddr3 = sdk.ConsAddress(ValConsPk13.Address()) // TODO move to common testing package for all modules // test addresses TestAddrs = []sdk.AccAddress{ delAddr1, delAddr2, delAddr3, valAccAddr1, valAccAddr2, valAccAddr3, } )
nolint: deadcode unused
Functions ¶
func MakeTestCodec ¶
func NewQuerier ¶
NewQuerier returns a new querier function
func ValidatorVestingDelegatorTestAccount ¶
func ValidatorVestingDelegatorTestAccount(startTime time.Time) *types.ValidatorVestingAccount
func ValidatorVestingTestAccount ¶
func ValidatorVestingTestAccount() *types.ValidatorVestingAccount
func ValidatorVestingTestAccounts ¶
func ValidatorVestingTestAccounts(numAccounts int) []*types.ValidatorVestingAccount
Types ¶
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper of the validatorvesting store
func CreateTestInput ¶
func NewKeeper ¶
func NewKeeper(cdc *codec.Codec, key sdk.StoreKey, ak types.AccountKeeper, bk types.BankKeeper, sk types.SupplyKeeper, stk types.StakingKeeper) Keeper
NewKeeper creates a new Keeper instance
func (Keeper) AccountIsVesting ¶
AccountIsVesting returns true if all vesting periods is complete and there is no debt
func (Keeper) GetAccountFromAuthKeeper ¶
func (k Keeper) GetAccountFromAuthKeeper(ctx sdk.Context, addr sdk.AccAddress) *types.ValidatorVestingAccount
GetAccountFromAuthKeeper returns a ValidatorVestingAccount from the auth keeper
func (Keeper) GetAllAccountKeys ¶
GetAllAccountKeys returns all account keys in the validator vesting keeper.
func (Keeper) GetPeriodEndTimes ¶
GetPeriodEndTimes returns an array of the times when each period ends
func (Keeper) GetPreviousBlockTime ¶
GetPreviousBlockTime get the blocktime for the previous block
func (Keeper) HandleVestingDebt ¶
HandleVestingDebt removes coins after a vesting period in which the vesting threshold was not met. Sends/Burns tokens if there is enough spendable tokens, otherwise unbonds all existing tokens.
func (Keeper) IterateAccountKeys ¶
IterateAccountKeys iterates over all the stored account keys and performs a callback function
func (Keeper) ResetCurrentPeriodProgress ¶
func (k Keeper) ResetCurrentPeriodProgress(ctx sdk.Context, addr sdk.AccAddress)
ResetCurrentPeriodProgress resets CurrentPeriodProgress to zero values
func (Keeper) ResetDebt ¶
func (k Keeper) ResetDebt(ctx sdk.Context, addr sdk.AccAddress)
ResetDebt sets DebtAfterFailedVesting to zero
func (Keeper) SetPreviousBlockTime ¶
SetPreviousBlockTime set the time of the previous block
func (Keeper) SetValidatorVestingAccountKey ¶
func (k Keeper) SetValidatorVestingAccountKey(ctx sdk.Context, addr sdk.AccAddress)
SetValidatorVestingAccountKey stores the account key in the store. This is useful for when we want to iterate over all ValidatorVestingAcounts, so we can avoid iterating over any other accounts stored in the auth keeper.
func (Keeper) SetVestingProgress ¶
SetVestingProgress sets VestingPeriodProgress for the input period
func (Keeper) UpdateMissingSignCount ¶
UpdateMissingSignCount increments the count of blocks missed during the current period
func (Keeper) UpdateVestedCoinsProgress ¶
UpdateVestedCoinsProgress sets the VestingPeriodProgress variable (0 = coins did not vest for the period, 1 = coins did vest for the period) for the given address and period. If coins did not vest, those coins are added to DebtAfterFailedVesting. Finally, MissingSignCount is reset to [0,0], representing that the next period has started and no blocks have been missed.