types

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventTypeMint                                = ModuleName
	EventExecuteInflationParameterChangeProposal = "execute_inflation_parameter_change_proposal"

	AttributeKeyInflation        = "inflation"
	AttributeKeyInitialPrice     = "initial_price"
	AttributeKeyCurrentPrice     = "current_price"
	AttributeKeyNodeCostPerMonth = "node_cost_per_month"
)

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

	//RouterKey
	RouterKey = ModuleName

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

nolint

View Source
const (
	NativeTokenDecimals = 18 //TODO(Keep), should retrieve from token
)

Variables

View Source
var (
	KeyMintDenom    = []byte("MintDenom")
	KeyInflation    = []byte("Inflation")
	KeyMintPerBlock = []byte("MintPerBlock")
)

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 ErrInvalidProposalInflation

func ErrInvalidProposalInflation(codespace sdk.CodespaceType) sdk.Error

func ErrInvalidProposalNodeCostPerMonth

func ErrInvalidProposalNodeCostPerMonth(codespace sdk.CodespaceType) sdk.Error

func ErrInvalidProposalPrice

func ErrInvalidProposalPrice(codespace sdk.CodespaceType) sdk.Error

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 CodeType

type CodeType = sdk.CodeType
const (
	DefaultCodespace sdk.CodespaceType = "mint"
	CodeInvalidInput CodeType          = 103
)

type Minter

type Minter struct{}

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() Minter

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

func NewMinter

func NewMinter() Minter

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

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
	Inflation    sdk.Dec `json:"inflation" yaml:"inflation"`           //target inflation, default=3%
	MintPerBlock sdk.Int `json:"mint_per_block" yaml:"mint_per_block"` //target inflation, default=3%
}

mint parameters

func DefaultParams

func DefaultParams() Params

default minting module parameters

func NewParams

func NewParams(mintDenom string, inflation sdk.Dec, mintPerBlock sdk.Int) 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
	TotalBondedTokens(ctx sdk.Context) sdk.Int
	GetLastValidators(ctx sdk.Context) (validators []stakingtypes.Validator)
}

StakingKeeper defines the expected staking keeper

type SupplyKeeper

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

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

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

SupplyKeeper defines the expected supply keeper

type TokenKeeper

type TokenKeeper interface {
	GetDecimals(ctx sdk.Context, symbol sdk.Symbol) uint64
}

Jump to

Keyboard shortcuts

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