mint

package
v0.25.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// default paramspace for params keeper
	DefaultParamspace = "mint"
)

Variables

View Source
var (

	// params store for inflation params
	ParamStoreKeyParams = []byte("params")
)

Functions

func BeginBlocker

func BeginBlocker(ctx sdk.Context, k Keeper)

Called every block, process inflation on the first block of every hour

func InitGenesis

func InitGenesis(ctx sdk.Context, keeper Keeper, data GenesisState)

new mint genesis

func ParamTypeTable

func ParamTypeTable() params.TypeTable

ParamTable for stake 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

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 NewGenesisState

func NewGenesisState(minter Minter, params Params) GenesisState

func WriteGenesis

func WriteGenesis(ctx sdk.Context, keeper Keeper) GenesisState

WriteGenesis returns a GenesisState for a given context and keeper. The GenesisState will contain the pool, and validator/delegator distribution info's

type Keeper

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

keeper of the stake store

func NewKeeper

func NewKeeper(cdc *codec.Codec, key sdk.StoreKey,
	paramSpace params.Subspace, sk StakeKeeper, fck FeeCollectionKeeper) Keeper

func (Keeper) GetMinter

func (k Keeper) GetMinter(ctx sdk.Context) (minter Minter)

get the minter

func (Keeper) GetParams

func (k Keeper) GetParams(ctx sdk.Context) Params

get inflation params from the global param store

func (Keeper) SetMinter

func (k Keeper) SetMinter(ctx sdk.Context, minter Minter)

set the minter

func (Keeper) SetParams

func (k Keeper) SetParams(ctx sdk.Context, params Params)

set inflation params from the global param store

type Minter

type Minter struct {
	InflationLastTime time.Time `json:"inflation_last_time"` // block time which the last inflation was processed
	Inflation         sdk.Dec   `json:"inflation"`           // current annual inflation rate
}

current inflation state

func InitialMinter

func InitialMinter() Minter

minter object for a new minter

func (Minter) NextInflation

func (m Minter) NextInflation(params Params, bondedRatio sdk.Dec) (inflation sdk.Dec)

get the next inflation rate for the hour

func (Minter) ProcessProvisions

func (m Minter) ProcessProvisions(params Params, totalSupply, bondedRatio sdk.Dec) (
	minter Minter, provisions sdk.Coin)

process provisions for an hour period

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
}

mint parameters

func DefaultParams

func DefaultParams() Params

default minting module parameters

type StakeKeeper

type StakeKeeper interface {
	TotalPower(ctx sdk.Context) sdk.Dec
	BondedRatio(ctx sdk.Context) sdk.Dec
	InflateSupply(ctx sdk.Context, newTokens sdk.Dec)
}

expected stake keeper

Jump to

Keyboard shortcuts

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