Documentation ¶
Index ¶
- Constants
- Variables
- func BuildAllTotalMintQOSKey() []byte
- func BuildFirstBlockTimeKey() []byte
- func BuildInflationPhrasesKey() []byte
- func BuildTotalQOSKey() []byte
- func RegisterCodec(cdc *amino.Codec)
- func ValidateGenesis(gs GenesisState) error
- type GenesisState
- type InflationPhrase
- type InflationPhrases
- func (phrases InflationPhrases) Adapt(oldPhrases InflationPhrases) (newPhrase InflationPhrases)
- func (phrases InflationPhrases) ApplyQOS(phraseEndTime time.Time, amount types.BigInt) (newPhrase InflationPhrases)
- func (phrases InflationPhrases) Equals(ips InflationPhrases) bool
- func (phrases InflationPhrases) GetPhrase(time time.Time) (phrase *InflationPhrase, exists bool)
- func (phrases InflationPhrases) GetPrePhrase(time time.Time) (phrase *InflationPhrase, exists bool)
- func (phrases InflationPhrases) TotalAmount() types.BigInt
- func (phrases InflationPhrases) Valid() error
- func (phrases InflationPhrases) ValidNewPhrases(newTotal, totalApplied types.BigInt, newPhrases InflationPhrases) error
Constants ¶
View Source
const (
MapperName = "mint"
)
Variables ¶
View Source
var ( // 事件类型 EventTypeMint = "mint" // 通胀 // 事件参数 AttributeKeyHeight = "height" // 区块高度 AttributeKeyTokens = "tokens" // tokens量 )
View Source
var Cdc = baseabci.MakeQBaseCodec()
View Source
var (
InflationPhrasesKey = []byte("phrases")
)
Functions ¶
func BuildAllTotalMintQOSKey ¶
func BuildAllTotalMintQOSKey() []byte
func BuildFirstBlockTimeKey ¶
func BuildFirstBlockTimeKey() []byte
func BuildInflationPhrasesKey ¶
func BuildInflationPhrasesKey() []byte
func BuildTotalQOSKey ¶
func BuildTotalQOSKey() []byte
func RegisterCodec ¶
func RegisterCodec(cdc *amino.Codec)
func ValidateGenesis ¶
func ValidateGenesis(gs GenesisState) error
Types ¶
type GenesisState ¶
type GenesisState struct { InflationPhrases InflationPhrases `json:"inflation_phrases"` // 通胀阶段 FirstBlockTime int64 `json:"first_block_time"` // UTC().UNIX() AppliedQOSAmount types.BigInt `json:"applied_qos_amount"` // 总流通QOS TotalQOSAmount types.BigInt `json:"total_qos_amount"` // QOS总量 }
创世状态
func DefaultGenesisState ¶
func DefaultGenesisState() GenesisState
func NewGenesisState ¶
func NewGenesisState(inflationPhrases InflationPhrases, firstBlockTime int64, appliedQOSAmount, totalQOSAmount types.BigInt) GenesisState
type InflationPhrase ¶
type InflationPhrase struct { EndTime time.Time `json:"end_time"` // 结束时间 TotalAmount types.BigInt `json:"total_amount"` // 通胀总量 AppliedAmount types.BigInt `json:"applied_amount"` // 已发行总量 }
通胀阶段
func (InflationPhrase) Equals ¶
func (phrase InflationPhrase) Equals(p InflationPhrase) bool
两通胀阶段是否相等:通胀时间,通胀总量和已发行均相等
type InflationPhrases ¶
type InflationPhrases []InflationPhrase
通胀规则
func DefaultInflationPhrases ¶
func DefaultInflationPhrases() InflationPhrases
func (InflationPhrases) Adapt ¶
func (phrases InflationPhrases) Adapt(oldPhrases InflationPhrases) (newPhrase InflationPhrases)
适配旧通胀规则,填充已发行
func (InflationPhrases) ApplyQOS ¶
func (phrases InflationPhrases) ApplyQOS(phraseEndTime time.Time, amount types.BigInt) (newPhrase InflationPhrases)
释放通胀
func (InflationPhrases) Equals ¶
func (phrases InflationPhrases) Equals(ips InflationPhrases) bool
通胀规则相等,对应所有通胀阶段均相等
func (InflationPhrases) GetPhrase ¶
func (phrases InflationPhrases) GetPhrase(time time.Time) (phrase *InflationPhrase, exists bool)
获取时间点对应通胀阶段
func (InflationPhrases) GetPrePhrase ¶
func (phrases InflationPhrases) GetPrePhrase(time time.Time) (phrase *InflationPhrase, exists bool)
获取前一通胀阶段
func (InflationPhrases) TotalAmount ¶ added in v0.0.8
func (phrases InflationPhrases) TotalAmount() types.BigInt
获取通胀总量
func (InflationPhrases) ValidNewPhrases ¶
func (phrases InflationPhrases) ValidNewPhrases(newTotal, totalApplied types.BigInt, newPhrases InflationPhrases) error
校验新通胀规则
Click to show internal directories.
Click to hide internal directories.