types

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventTypeMint = ModuleName

	AttributeKeyBondedRatio       = "bonded_ratio"
	AttributeKeyInflation         = "inflation"
	AttributeKeyAnnualProvisions  = "annual_provisions"
	AttributeKeyCurrentProvisions = "current_provisions"
)

Minting module event types

View Source
const (
	// ModuleName defines the name of the module
	ModuleName = "mint"

	// default paramspace for params keeper
	DefaultParamspace = ModuleName

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

	// QuerierRoute is the querier route for the minting store.
	QuerierRoute = StoreKey

	// Query endpoints supported by the minting querier
	QueryParameters        = "parameters"
	QueryInflation         = "inflation"
	QueryAnnualProvisions  = "annual_provisions"
	QueryCurrentProvisions = "current_provisions"
)

nolint

Variables

View Source
var (
	KeyMintDenom           = []byte("MintDenom")
	KeyInflationRateChange = []byte("InflationRateChange")
	KeyInflationMax        = []byte("InflationMax")
	KeyInflationMin        = []byte("InflationMin")
	KeyGoalBonded          = []byte("GoalBonded")
	KeyBlocksPerYear       = []byte("BlocksPerYear")
	KeyMaxProvisions       = []byte("MaxProvisions")
)

Parameter store keys

View Source
var MinterKey = []byte{0x00}

MinterKey - the one key to use for the keeper store

View Source
var ModuleCdc *codec.Codec

ModuleCdc generic sealed codec to be used throughout module

Functions

func ParamKeyTable

func ParamKeyTable() params.KeyTable

ParamTable for minting module.

func ValidateGenesis

func ValidateGenesis(data GenesisState) error

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

func ValidateMinter

func ValidateMinter(minter Minter) error

ValidateMinter validates minter

Types

type GenesisState

type GenesisState struct {
	Minter Minter `json:"minter" yaml:"minter"` // minter object
	Params Params `json:"params" yaml:"params"` // inflation params
}

GenesisState - minter state

func DefaultGenesisState

func DefaultGenesisState() GenesisState

DefaultGenesisState creates a default GenesisState object

func NewGenesisState

func NewGenesisState(minter Minter, params Params) GenesisState

NewGenesisState creates a new GenesisState object

type Minter

type Minter struct {
	Inflation         sdk.Dec `json:"inflation" yaml:"inflation"`                 // current annual inflation rate
	AnnualProvisions  sdk.Dec `json:"annual_provisions" yaml:"annual_provisions"` // current annual expected provisions
	CurrentProvisions sdk.Dec `json:"current_provisions" yaml:"current_provisions"`
}

Minter represents the minting state.

func DefaultInitialMinter

func DefaultInitialMinter() Minter

DefaultInitialMinter returns a default initial Minter object for a new chain which uses an inflation rate of 4%.

func InitialMinter

func InitialMinter(inflation sdk.Dec) Minter

InitialMinter returns an initial Minter object with a given inflation value.

func NewMinter

func NewMinter(inflation, annualProvisions, currentProvisions sdk.Dec) Minter

NewMinter returns a new Minter object with the given inflation, provisions values and current provisions

func (Minter) BlockProvision

func (m Minter) BlockProvision(params Params) sdk.Coin

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

func (Minter) NextAnnualProvisions

func (m Minter) NextAnnualProvisions(_ Params, totalSupply sdk.Int) sdk.Dec

NextAnnualProvisions returns the annual provisions based on current total supply and inflation rate.

func (Minter) NextInflationRate

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

NextInflationRate returns the new inflation rate for the next block.

type Params

type Params struct {
	MintDenom           string  `json:"mint_denom" yaml:"mint_denom"`                       // type of coin to mint
	InflationRateChange sdk.Dec `json:"inflation_rate_change" yaml:"inflation_rate_change"` // maximum annual change in inflation rate
	InflationMax        sdk.Dec `json:"inflation_max" yaml:"inflation_max"`                 // maximum inflation rate
	InflationMin        sdk.Dec `json:"inflation_min" yaml:"inflation_min"`                 // minimum inflation rate
	GoalBonded          sdk.Dec `json:"goal_bonded" yaml:"goal_bonded"`                     // goal of percent bonded atoms
	BlocksPerYear       uint64  `json:"blocks_per_year" yaml:"blocks_per_year"`             // expected blocks per year
	MaxProvisions       sdk.Dec `json:"max_provisions" yaml:"max_provisions"`
}

mint parameters

func DefaultParams

func DefaultParams() Params

default minting module parameters

func NewParams

func NewParams(mintDenom string, inflationRateChange, inflationMax,
	inflationMin, goalBonded sdk.Dec, blocksPerYear uint64, maxProvisions sdk.Dec) Params

func (Params) Equal

func (p Params) Equal(p2 Params) bool

Equal returns a boolean determining if two Params types are identical.

func (*Params) ParamSetPairs

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

Implements params.ParamSet

func (Params) String

func (p Params) String() string

func (Params) Validate

func (p Params) Validate() error

validate params

type StakingKeeper

type StakingKeeper interface {
	StakingTokenSupply(ctx sdk.Context) sdk.Int
	BondedRatio(ctx sdk.Context) sdk.Dec
}

StakingKeeper defines the expected staking keeper

type SupplyKeeper

type SupplyKeeper interface {
	GetModuleAddress(name string) sdk.AccAddress

	SetModuleAccount(sdk.Context, exported.ModuleAccountI)

	SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error
	SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) error
	MintCoins(ctx sdk.Context, name string, amt sdk.Coins) error

	GetAllVestings(ctx sdk.Context) (vestings []supply.Vesting)
	RemoveVesting(ctx sdk.Context, address sdk.AccAddress)
}

SupplyKeeper defines the expected supply keeper

Jump to

Keyboard shortcuts

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