mint

package
v0.16.1 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultParamSpace = "mint"
)

default paramspace for params keeper

Variables

View Source
var (
	// params store for inflation params
	KeyInflation = []byte("Inflation")
)

Parameter store key

Functions

func BeginBlocker

func BeginBlocker(ctx sdk.Context, k Keeper) sdk.Tags

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 mint module

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

Register concrete types on codec codec

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 FeeKeeper

type FeeKeeper 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 stake store

func NewKeeper

func NewKeeper(cdc *codec.Codec, key sdk.StoreKey,
	paramSpace params.Subspace, bk bank.Keeper, fk FeeKeeper) Keeper

func (Keeper) GetMinter

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

get the minter

func (Keeper) GetParamSet

func (k Keeper) GetParamSet(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) SetParamSet

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

set inflation params from the global param store

type Minter

type Minter struct {
	LastUpdate    time.Time `json:"last_update"` // time which the last update was made to the minter
	MintDenom     string    `json:"mint_denom"`  // type of coin to mint
	InflationBase sdk.Int   `json:"inflation_basement"`
}

current inflation state

func InitialMinter

func InitialMinter() Minter

minter object for a new chain

func NewMinter

func NewMinter(lastUpdate time.Time, mintDenom string, inflationBase sdk.Int) Minter

Create a new minter object

func (Minter) BlockProvision

func (m Minter) BlockProvision(annualProvisions sdk.Dec) sdk.Coin

get the provisions for a block based on the annual provisions rate

func (Minter) NextAnnualProvisions

func (m Minter) NextAnnualProvisions(params Params) (provisions sdk.Dec)

get the provisions for a block based on the annual provisions rate

type Params

type Params struct {
	Inflation sdk.Dec `json:"inflation"` // inflation rate
}

mint parameters

func DefaultParams

func DefaultParams() Params

default minting module parameters

func (*Params) GetParamSpace

func (p *Params) GetParamSpace() string

Implements params.ParamStruct

func (*Params) KeyValuePairs

func (p *Params) KeyValuePairs() params.KeyValuePairs

func (*Params) ReadOnly

func (p *Params) ReadOnly() bool

func (Params) String

func (p Params) String() string

func (*Params) StringFromBytes

func (p *Params) StringFromBytes(cdc *codec.Codec, key string, bytes []byte) (string, error)

func (*Params) Validate

func (p *Params) Validate(key string, value string) (interface{}, sdk.Error)

Directories

Path Synopsis
nolint
nolint

Jump to

Keyboard shortcuts

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