Documentation ¶
Index ¶
- Variables
- func NewHandler(keeper Keeper) sdk.Handler
- func NewQuerier(keeper Keeper) sdk.Querier
- type Keeper
- func (k Keeper) ComputeProposerReward(ctx sdk.Context, validatorsCount int64, proposer exported.ValidatorI, ...) sdk.DecCoins
- func (k Keeper) DistributeBlockRewards(ctx sdk.Context, validator exported.ValidatorI, reward sdk.DecCoins) error
- func (k Keeper) GetPreviousProposerConsAddr(ctx sdk.Context) sdk.ConsAddress
- func (k Keeper) GetTotalRewardPool(ctx sdk.Context) sdk.DecCoins
- func (k Keeper) GetYearNumber(ctx sdk.Context) (year int64)
- func (k Keeper) GetYearlyRewardPool(ctx sdk.Context) (pool sdk.DecCoins)
- func (k Keeper) MintVBRTokens(ctx sdk.Context, coins sdk.Coins) error
- func (k Keeper) SetPreviousProposerConsAddr(ctx sdk.Context, addr sdk.ConsAddress)
- func (k Keeper) SetTotalRewardPool(ctx sdk.Context, updatedPool sdk.DecCoins)
- func (k Keeper) SetYearNumber(ctx sdk.Context, year int64)
- func (k Keeper) SetYearlyRewardPool(ctx sdk.Context, yearlyPool sdk.DecCoins)
- func (k Keeper) UpdateYearlyPool(ctx sdk.Context, blockHeight int64)
- func (k Keeper) VbrAccount(ctx sdk.Context) supplyExported.ModuleAccountI
Constants ¶
This section is empty.
Variables ¶
var ( DPY = sdk.NewDecWithPrec(36525, 2) // Days Per Year HPD = sdk.NewDecWithPrec(24, 0) // Hours Per Day MPH = sdk.NewDecWithPrec(60, 0) // Minutes Per Hour BPM = sdk.NewDecWithPrec(12, 0) // Blocks Per Minutes BPY = DPY.Mul(HPD).Mul(MPH).Mul(BPM) // Blocks Per Year )
var TestBlockRewardsPool = sdk.NewDecCoins(sdk.NewCoins(sdk.Coin{Amount: sdk.NewInt(100000), Denom: "stake"}))
var TestFunder, _ = sdk.AccAddressFromBech32("cosmos1lwmppctrr6ssnrmuyzu554dzf50apkfvd53jx0")
var TestValidator = staking.NewValidator(valAddr, pubKey, staking.Description{})
Functions ¶
func NewHandler ¶
func NewQuerier ¶
Types ¶
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
func SetupTestInput ¶
func SetupTestInput(emptyPool bool) (cdc *codec.Codec, ctx sdk.Context, keeper Keeper, accKeeper auth.AccountKeeper, bankKeeper bank.BaseKeeper)
func (Keeper) ComputeProposerReward ¶
func (k Keeper) ComputeProposerReward(ctx sdk.Context, validatorsCount int64, proposer exported.ValidatorI, totalStakedTokens sdk.Int) sdk.DecCoins
ComputeProposerReward computes the final reward for the validator block's proposer
func (Keeper) DistributeBlockRewards ¶
func (k Keeper) DistributeBlockRewards(ctx sdk.Context, validator exported.ValidatorI, reward sdk.DecCoins) error
DistributeBlockRewards distributes the computed reward to the block proposer
func (Keeper) GetPreviousProposerConsAddr ¶
func (k Keeper) GetPreviousProposerConsAddr(ctx sdk.Context) sdk.ConsAddress
get the proposer public key for this block
func (Keeper) GetTotalRewardPool ¶
GetTotalRewardPool returns the current total rewards pool amount
func (Keeper) GetYearNumber ¶
GetYearNumber returns the current year number
func (Keeper) GetYearlyRewardPool ¶
GetYearlyRewardPool returns the reward pool that has been assigned for the current year or rewards
func (Keeper) MintVBRTokens ¶ added in v1.5.0
MintVBRTokens mints coins into the vbr's ModuleAccount
func (Keeper) SetPreviousProposerConsAddr ¶
func (k Keeper) SetPreviousProposerConsAddr(ctx sdk.Context, addr sdk.ConsAddress)
set the proposer public key for this block
func (Keeper) SetTotalRewardPool ¶
SetTotalRewardPool allows to set the value of the total rewards pool that has left
func (Keeper) SetYearNumber ¶
SetYearNumber set the given year to be the current year number
func (Keeper) SetYearlyRewardPool ¶
SetYearlyRewardPool sets the given yearlyPool to be the current year's reward pool
func (Keeper) UpdateYearlyPool ¶
UpdateYearlyPool allows to update the current yearly pool based on whenever we are now in a new year or not. If we are in the same year, we do nothing. Otherwise, we set the new year's pool to be the 20% of the total reward pool.
func (Keeper) VbrAccount ¶ added in v1.5.0
func (k Keeper) VbrAccount(ctx sdk.Context) supplyExported.ModuleAccountI
VbrAccount returns vbr's ModuleAccount