Documentation
¶
Index ¶
- Constants
- Variables
- func BeginBlocker(ctx sdk.Context, k Keeper)
- func InitGenesis(ctx sdk.Context, keeper Keeper, data GenesisState)
- func ParamTypeTable() params.TypeTable
- func ValidateGenesis(data GenesisState) error
- type FeeCollectionKeeper
- type GenesisState
- type Keeper
- type Minter
- type Params
- type StakingKeeper
Constants ¶
const (
// default paramspace for params keeper
DefaultParamspace = "mint"
// StoreKey is the default store key for mint
StoreKey = "mint"
)
Variables ¶
var (
// params store for inflation params
ParamStoreKeyParams = []byte("params")
)
Functions ¶
func BeginBlocker ¶
func BeginBlocker(ctx sdk.Context, k Keeper)
Inflate every block, update inflation parameters once per hour
func InitGenesis ¶
func InitGenesis(ctx sdk.Context, keeper Keeper, data GenesisState)
new mint genesis
func ParamTypeTable ¶ added in v0.25.0
func ParamTypeTable() params.TypeTable
ParamTable for staking module
func ValidateGenesis ¶
func ValidateGenesis(data GenesisState) error
ValidateGenesis validates the provided staking genesis state to ensure the expected invariants holds. (i.e. params in correct bounds, no duplicate validators)
Types ¶
type FeeCollectionKeeper ¶ added in v0.25.0
type FeeCollectionKeeper interface {
AddCollectedFees(sdk.Context, sdk.Coins) sdk.Coins
}
expected fee collection keeper interface
type GenesisState ¶
type GenesisState struct {
Minter Minter `json:"minter"` // minter object
Params Params `json:"params"` // inflation params
}
GenesisState - all distribution state that must be provided at genesis
func DefaultGenesisState ¶
func DefaultGenesisState() GenesisState
get raw genesis raw message for testing
func ExportGenesis ¶
func ExportGenesis(ctx sdk.Context, keeper Keeper) GenesisState
ExportGenesis returns a GenesisState for a given context and keeper. The GenesisState will contain the pool, and validator/delegator distribution info's
func NewGenesisState ¶
func NewGenesisState(minter Minter, params Params) GenesisState
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
keeper of the staking store
func NewKeeper ¶
func NewKeeper(cdc *codec.Codec, key sdk.StoreKey,
paramSpace params.Subspace, sk StakingKeeper, fck FeeCollectionKeeper) Keeper
func (Keeper) GetMinter ¶ added in v0.25.0
func (k Keeper) GetMinter(ctx sdk.Context) (minter Minter)
get the minter
func (Keeper) GetParams ¶ added in v0.25.0
func (k Keeper) GetParams(ctx sdk.Context) Params
get inflation params from the global param store
type Minter ¶
type Minter struct {
Inflation sdk.Dec `json:"inflation"` // current annual inflation rate
AnnualProvisions sdk.Dec `json:"annual_provisions"` // current annual expected provisions
}
Minter represents the minting state
func DefaultInitialMinter ¶
func DefaultInitialMinter() Minter
default initial minter object for a new chain which uses an inflation rate of 13%
func NewMinter ¶
func NewMinter(inflation, annualProvisions sdk.Dec) Minter
Create a new minter object
func (Minter) BlockProvision ¶ added in v0.27.0
func (m Minter) BlockProvision(params Params) sdk.Coin
get the provisions for a block based on the annual provisions rate
func (Minter) NextAnnualProvisions ¶ added in v0.27.0
func (m Minter) NextAnnualProvisions(params Params, totalSupply sdk.Int) (
provisions sdk.Dec)
calculate the annual provisions based on current total supply and inflation rate
func (Minter) NextInflationRate ¶ added in v0.27.0
func (m Minter) NextInflationRate(params Params, bondedRatio sdk.Dec) (
inflation sdk.Dec)
get the new inflation rate for the next hour
type Params ¶
type Params struct {
MintDenom string `json:"mint_denom"` // type of coin to mint
InflationRateChange sdk.Dec `json:"inflation_rate_change"` // maximum annual change in inflation rate
InflationMax sdk.Dec `json:"inflation_max"` // maximum inflation rate
InflationMin sdk.Dec `json:"inflation_min"` // minimum inflation rate
GoalBonded sdk.Dec `json:"goal_bonded"` // goal of percent bonded atoms
BlocksPerYear uint64 `json:"blocks_per_year"` // expected blocks per year
}
mint parameters
type StakingKeeper ¶ added in v0.30.0
type StakingKeeper interface {
TotalPower(ctx sdk.Context) sdk.Int
BondedRatio(ctx sdk.Context) sdk.Dec
InflateSupply(ctx sdk.Context, newTokens sdk.Int)
}
expected staking keeper