types

package
v0.0.0-...-2c3f891 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	EventTypeMint = ModuleName

	AttributeKeyYear             = "year"
	AttributeKeyAnnualProvisions = "annual_provisions"
)

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"
	QueryAnnualProvisions = "annual_provisions"
)

nolint

Variables

View Source
var (
	KeyMintDenom              = []byte("MintDenom")
	KeyInitalInflationAmount  = []byte("InitalInflationAmount")
	KeyInflationFactorPerYear = []byte("InflationFactorPerYear")
	KeyBlocksPerYear          = []byte("BlocksPerYear")
)

Parameter store keys

View Source
var DefaultInflationFactor = []sdk.Dec{
	sdk.NewDec(1),
	sdk.NewDecWithPrec(85, 2),
	sdk.NewDecWithPrec(85, 2),
	sdk.NewDecWithPrec(85, 2),
	sdk.NewDecWithPrec(9, 1),
}
View Source
var DefaultInitalInflationAmount = sdk.NewDecFromInt(sdk.NewIntWithDecimal(81000000, 18)) //81000000 in the 1st year
View Source
var MinterKey = []byte{0x01}

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 RegisterCodec

func RegisterCodec(cdc *codec.Codec)

func ValidateMinter

func ValidateMinter(minter Minter) error

validate minter

func ValidateParams

func ValidateParams(params Params) error

validate params

Types

type Minter

type Minter struct {
	CurrentYearIndex uint64  `json:"current_year_index" yaml:"current_year_index"` // current year index
	AnnualProvisions sdk.Dec `json:"annual_provisions" yaml:"annual_provisions"`   // current annual expected provisions
}

Minter represents the minting state.

func DefaultInitialMinter

func DefaultInitialMinter(annualProvisions sdk.Dec) Minter

DefaultInitialMinter set the initial minter

func InitialMinter

func InitialMinter(currentYearIndex uint64, annualProvisions sdk.Dec) Minter

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

func NewMinter

func NewMinter(currentYearIndex uint64, annualProvisions sdk.Dec) Minter

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

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

NextAnnualProvisions returns the next annual provisions based

func (Minter) String

func (m Minter) String() string

type Params

type Params struct {
	MintDenom              string    `json:"mint_denom" yaml:"mint_denom"`                               // type of coin to mint
	InitalInflationAmount  sdk.Dec   `json:"initial_inflation_amount" yaml:"initial_inflation_amount"`   //initial amount of minted coins
	InflationFactorPerYear []sdk.Dec `json:"inflation_factor_per_year" yaml:"inflation_factor_per_year"` //
	BlocksPerYear          uint64    `json:"blocks_per_year" yaml:"blocks_per_year"`                     // expected blocks per year
}

mint parameters

func DefaultParams

func DefaultParams() Params

func NewParams

func NewParams(mintDenom string, initalInflationAmount sdk.Dec, inflationFactorPerYear []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 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
	GetModuleAccount(ctx sdk.Context, name string) exported.ModuleAccountI

	// TODO remove with genesis 2-phases refactor https://github.com/pocblockchain/pocc/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

Jump to

Keyboard shortcuts

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