mint

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ModuleName is the name of the module
	ModuleName = "minting"

	// default paramspace for params keeper
	DefaultParamspace = "mint"

	// StoreKey is the default store key for mint
	StoreKey = "mint"

	// QuerierRoute is the querier route for the minting store.
	QuerierRoute = StoreKey
)
View Source
const (
	QueryParameters = "parameters"
	QueryMinter     = "minter"
)

Query endpoints supported by the minting querier

Variables

View Source
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 NewQuerier

func NewQuerier(k Keeper) sdk.Querier

NewQuerier returns a minting Querier handler.

func ParamKeyTable

func ParamKeyTable() params.KeyTable

ParamTable for staking module

func ValidateGenesis

func ValidateGenesis(data GenesisState) error

ValidateGenesis validates the provided genesis state to ensure the expected invariants holds.

Types

type BankKeeper

type BankKeeper interface {
	SubtractCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) (sdk.Coins, sdk.Error)
}

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 - minter state

func DefaultGenesisState

func DefaultGenesisState() GenesisState

DefaultGenesisState creates a default GenesisState object

func ExportGenesis

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

ExportGenesis returns a GenesisState for a given context and keeper.

func NewGenesisState

func NewGenesisState(minter Minter, params Params) GenesisState

NewGenesisState creates a new GenesisState object

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, bankKeeper BankKeeper) 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 {
	MintDenom     string `json:"mint_denom"`      // type of coin to mint
	BlocksPerYear uint64 `json:"blocks_per_year"` // expected blocks per year
}

Minter represents the minting state.

func DefaultMinter

func DefaultMinter() Minter

DefaultMinter returns a default initial Minter object for a new chain

func NewMinter

func NewMinter(mintDenom string, blocksPerYear uint64) Minter

NewMinter returns a new Minter object with the given inflation and annual provisions values.

func (Minter) BlockProvision

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

BlockProvision returns the provisions for a block based on the annual provisions rate.

func (Minter) NextAnnualProvisions

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

NextAnnualProvisions returns the annual provisions based on inflation base and inflation rate.

func (Minter) String

func (p Minter) String() string

type Params

type Params struct {
	Inflation         sdk.Dec        `json:"inflation"` // inflation rate
	InflationBase     sdk.Int        `json:"inflation_base"`
	FoundationAddress sdk.AccAddress `json:"foundation_address"`
}

mint parameters

func DefaultParams

func DefaultParams() Params

default minting module parameters

func NewParams

func NewParams(inflation sdk.Dec, inflationBase sdk.Int, foundationAddress sdk.AccAddress) Params

func (Params) String

func (p Params) String() string

type StakingKeeper

type StakingKeeper interface {
	TotalTokens(ctx sdk.Context) sdk.Int
	BondedRatio(ctx sdk.Context) sdk.Dec
	InflateSupply(ctx sdk.Context, newTokens sdk.Int)
}

expected staking keeper

Directories

Path Synopsis
cli

Jump to

Keyboard shortcuts

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