types

package
v0.0.0-...-607fb14 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2020 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventTypeMint = ModuleName

	AttributeKeyCurrentDayProvisions    = "current_day_provisions"
	AttributeKeyNextPeriodDayProvisions = "next_period_day_provisions"

	EventTypeTransfer = "burn"

	AttributeKeyRecipient = "recipient"
	AttributeKeySender    = "burner"

	AttributeValueCategory = ModuleName
)

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"
	QueryStatus     = "status"
	QueryBonus      = "bonus"
)

nolint

View Source
const RouterKey = ModuleName

RouterKey is they name of the mint module

Variables

View Source
var (
	KeyMintDenom     = []byte("MintDenom")
	KeyBlocksPerDay  = []byte("BlocksPerDay")
	KeyMintStartTime = []byte("MintStartTime")
)

Parameter store keys

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

the one key to use for the keeper store

View Source
var ModuleCdc *codec.Codec

module codec

Functions

func ParamKeyTable

func ParamKeyTable() params.KeyTable

ParamTable for minting module.

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

Register concrete types on codec codec

func ValidateMinter

func ValidateMinter(minter Minter) error

validate minter

func ValidateParams

func ValidateParams(params Params) error

validate params

Types

type MintPlan

type MintPlan struct {
	Period         int     `json:"period" yaml:"period"`
	TotalPerPeriod sdk.Int `json:"total_per_period" yaml:"total_per_period"`
	TotalPerDay    sdk.Int `json:"total_per_day" yaml:"total_per_day"`
}

MintPlan output plan

func DefaultMintPlans

func DefaultMintPlans() []MintPlan

DefaultMintPlans create

type Minter

type Minter struct {
	MintPlans []MintPlan `json:"mint_plans" yaml:"mint_plans"` // mint plan
	Status    Status     `json:"status" yaml:"status"`         // mint status
}

Minter represents the minting state.

func DefaultInitialMinter

func DefaultInitialMinter() Minter

DefaultInitialMinter returns a default initial Minter object for a new chain

func InitialMinter

func InitialMinter(mintPlans []MintPlan) Minter

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

func NewMinter

func NewMinter(mintPlans []MintPlan) Minter

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

func (Minter) BlockProvision

func (m Minter) BlockProvision(params Params, totalMintedSupply sdk.Int) sdk.Coin

BlockProvision returns the provisions for a block based on the MintPlans.

func (Minter) CurrentDayProvisions

func (m Minter) CurrentDayProvisions(totalSupply sdk.Int) sdk.Dec

当日产量

func (Minter) NextPeriodDayProvisions

func (m Minter) NextPeriodDayProvisions(totalMintedSupply sdk.Int) sdk.Dec

NextPeriodProvisions returns the period provisions based on current total supply and mintplans. 下一次减产日产量

func (Minter) NextPeroidStartTime

func (m Minter) NextPeroidStartTime(params Params, totalMintedSupply sdk.Int) int64

下一次减产时间多少秒之后

func (Minter) String

func (m Minter) String() string

type MsgBurn

type MsgBurn struct {
	FromAddress sdk.AccAddress `json:"from_address" yaml:"from_address"`
	Amount      sdk.Coins      `json:"amount" yaml:"amount"`
}

MsgBurn - high level transaction of the coin module

func NewMsgBurn

func NewMsgBurn(fromAddr sdk.AccAddress, amount sdk.Coins) MsgBurn

NewMsgSend - construct arbitrary multi-in, multi-out send msg.

func (MsgBurn) GetSignBytes

func (msg MsgBurn) GetSignBytes() []byte

GetSignBytes Implements Msg.

func (MsgBurn) GetSigners

func (msg MsgBurn) GetSigners() []sdk.AccAddress

GetSigners Implements Msg.

func (MsgBurn) Route

func (msg MsgBurn) Route() string

Route Implements Msg.

func (MsgBurn) Type

func (msg MsgBurn) Type() string

Type Implements Msg.

func (MsgBurn) ValidateBasic

func (msg MsgBurn) ValidateBasic() sdk.Error

ValidateBasic Implements Msg.

type MsgIssue

type MsgIssue struct {
	Sender    sdk.AccAddress `json:"sender" yaml:"sender"`
	ToAddress sdk.AccAddress `json:"to_address" yaml:"to_address"`
	Amount    sdk.Coins      `json:"amount" yaml:"amount"`
}

MsgIssue - high level transaction of the coin module

func NewMsgIssue

func NewMsgIssue(sender sdk.AccAddress, toAddr sdk.AccAddress, amount sdk.Coins) MsgIssue

NewMsgIssue - construct arbitrary multi-in, multi-out issue msg.

func (MsgIssue) GetSignBytes

func (msg MsgIssue) GetSignBytes() []byte

GetSignBytes Implements Msg.

func (MsgIssue) GetSigners

func (msg MsgIssue) GetSigners() []sdk.AccAddress

GetSigners Implements Msg.

func (MsgIssue) Route

func (msg MsgIssue) Route() string

Route Implements Msg.

func (MsgIssue) Type

func (msg MsgIssue) Type() string

Type Implements Msg.

func (MsgIssue) ValidateBasic

func (msg MsgIssue) ValidateBasic() sdk.Error

ValidateBasic Implements Msg.

type Params

type Params struct {
	MintDenom     string `json:"mint_denom" yaml:"mint_denom"`            // type of coin to mint
	BlocksPerDay  uint64 `json:"blocks_per_day" yaml:"blocks_per_day""`   // expected blocks per day
	MintStartTime int64  `json:"mint_start_time" yaml:"mint_start_time""` //mint proces start time
}

mint parameters

func DefaultParams

func DefaultParams() Params

default minting module parameters

func NewParams

func NewParams(mintDenom string, blocksPerDay uint64, mintStartTime int64) 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 {
	BondDenom(sdk.Context) string
}

StakingKeeper expected staking keeper (Validator and Delegator sets)

type Status

type Status struct {
	TotalMintedSupply       sdk.Int   `json:"total_minted_supply" yaml:"total_minted_supply"`
	TotalMintingSupply      sdk.Int   `json:"total_minting_supply" yaml:"total_minting_supply"`
	TotalDistrSupply        sdk.Int   `json:"total_distr_supply" yaml:"total_distr_supply"`
	StatBurnCoins           sdk.Coins `json:"stat_burn_coins" yaml:"stat_burn_coins"`
	CurrentDayProvisions    sdk.Dec   `json:"current_day_provisions" yaml:"current_day_provisions"`
	NextPeriodDayProvisions sdk.Dec   `json:"next_period_day_provisions" yaml:"next_period_day_provisions"`
	NextPeroidStartTime     int64     `json:"next_peroid_startTime" yaml:"next_peroid_startTime"`
	BlockProvision          sdk.Coin  `json:"block_provision" yaml:"block_provision"`
}

type SupplyKeeper

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

	GetSupply(sdk.Context) exported.SupplyI

	GetBalance(sdk.Context, sdk.AccAddress) sdk.Coins

	SetModuleAccount(sdk.Context, exported.ModuleAccountI)

	GetModuleAccount(sdk.Context, string) exported.ModuleAccountI

	SendCoinsFromAccountToModule(sdk.Context, sdk.AccAddress, string, sdk.Coins) sdk.Error
	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