keeper

package
v1.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 21, 2020 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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
)
View Source
var TestAmount = sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(100)))
View Source
var TestBlockRewardsPool = sdk.NewDecCoins(sdk.NewCoins(sdk.Coin{Amount: sdk.NewInt(100000), Denom: "stake"}))
View Source
var TestFunder, _ = sdk.AccAddressFromBech32("cosmos1lwmppctrr6ssnrmuyzu554dzf50apkfvd53jx0")
View Source
var TestValidator = staking.NewValidator(valAddr, pubKey, staking.Description{})

Functions

func NewHandler

func NewHandler(keeper Keeper) sdk.Handler

func NewQuerier

func NewQuerier(keeper Keeper) sdk.Querier

Types

type Keeper

type Keeper struct {
	// contains filtered or unexported fields
}

func NewKeeper

func NewKeeper(cdc *codec.Codec, storeKey sdk.StoreKey, dk distribution.Keeper, sk supply.Keeper) Keeper

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

func (k Keeper) GetTotalRewardPool(ctx sdk.Context) sdk.DecCoins

GetTotalRewardPool returns the current total rewards pool amount

func (Keeper) GetYearNumber

func (k Keeper) GetYearNumber(ctx sdk.Context) (year int64)

GetYearNumber returns the current year number

func (Keeper) GetYearlyRewardPool

func (k Keeper) GetYearlyRewardPool(ctx sdk.Context) (pool sdk.DecCoins)

GetYearlyRewardPool returns the reward pool that has been assigned for the current year or rewards

func (Keeper) MintVBRTokens added in v1.5.0

func (k Keeper) MintVBRTokens(ctx sdk.Context, coins sdk.Coins) error

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

func (k Keeper) SetTotalRewardPool(ctx sdk.Context, updatedPool sdk.DecCoins)

SetTotalRewardPool allows to set the value of the total rewards pool that has left

func (Keeper) SetYearNumber

func (k Keeper) SetYearNumber(ctx sdk.Context, year int64)

SetYearNumber set the given year to be the current year number

func (Keeper) SetYearlyRewardPool

func (k Keeper) SetYearlyRewardPool(ctx sdk.Context, yearlyPool sdk.DecCoins)

SetYearlyRewardPool sets the given yearlyPool to be the current year's reward pool

func (Keeper) UpdateYearlyPool

func (k Keeper) UpdateYearlyPool(ctx sdk.Context, blockHeight int64)

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL