types

package
v0.0.0-...-cf049ad Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventTypeMint = ModuleName

	AttributeKeyRemainedTokens  = "remained_tokens"
	AttributeKeyUnfreezenTokens = "unfreezen_tokens"
)

Minting module event types

View Source
const (
	// module name
	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"
	QueryRemainAmount = "remained_amount"
)

nolint

Variables

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

Parameter store keys

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

the one key to use for the keeper store

View Source
var ModuleCdc *codec.Codec

generic sealed codec to be used throughout this module

Functions

func ParamKeyTable

func ParamKeyTable() params.KeyTable

ParamTable for minting module.

func UpdatedParamKeyTable

func UpdatedParamKeyTable() params.KeyTable

ParamTable for minting module.

func ValidateMinter

func ValidateMinter(minter Minter) error

validate minter

func ValidateParams

func ValidateParams(params Params) error

validate params

func ValidateUpdatedParams

func ValidateUpdatedParams(params UpdatedParams) error

validate params

Types

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
	RemainedTokens   sdk.Coins `json:"remained_tokens" yaml:"remained_tokens"`
}

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 13%.

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 sdk.Dec) Minter

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

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
}

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) Params

func (*Params) ParamSetPairs

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

Implements params.ParamSet

func (Params) String

func (p Params) String() string

type SupplyKeeper

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

	// TODO remove with genesis 2-phases refactor https://github.com/cosmos/cosmos-sdk/issues/2862
	SetModuleAccount(sdk.Context, exported.ModuleAccountI)

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

SupplyKeeper defines the expected supply keeper

type UpdatedParams

type UpdatedParams struct {
	MintDenom              string `json:"mint_denom" yaml:"mint_denom"`
	UnfreezeAmountPerBlock int64  `json:"unfreeze_amount_per_block" yaml:"unfreeze_amount_per_block"`
}

func DefaultUpdatedParams

func DefaultUpdatedParams() UpdatedParams

default minting module parameters

func NewUpdatedParams

func NewUpdatedParams(mintDenom string, unfreezeAmountPerBlock int64) UpdatedParams

func (*UpdatedParams) ParamSetPairs

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

Implements params.ParamSet

func (UpdatedParams) String

func (p UpdatedParams) String() string

Jump to

Keyboard shortcuts

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