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: 9 Imported by: 0

Documentation

Overview

* ******************************************************************* * @项目名称: types * @文件名称: querier.go * @Date: 2019/06/05 * @Author: Keep * @Copyright(C): 2019 BlueHelix Inc. All rights reserved. * 注意:本内容仅限于内部传阅,禁止外泄以及用于其他的商业目的. * *******************************************************************

Index

Constants

View Source
const (
	EventTypeExecuteTokenParamsChangeProposal = "execute_token_params_change_proposal"
	EventTypeExecuteDisableTokenProposal      = "execute_disable_token_proposal"
	EventTypeNewToken                         = "new_token"
	EventTypeBurnToken                        = "burn_token"
	EventTypeInflateToken                     = "inflate_token"

	AttributeKeyTokenParam      = "param"
	AttributeKeyTokenParamValue = "value"
	AttributeKeyToken           = "token"
	AttributeKeyIssuer          = "issuer"
	AttributeKeyRecipient       = "recipient"
	AttributeKeySymbol          = "symbol"
	AttributeKeyAmount          = "amount"
	AttributeKeyIssueFee        = "issue_fee"
	AttributeKeyBurner          = "burner"

	AttributeValueCategory = ModuleName
)
View Source
const (
	// module name
	ModuleName = "token"

	// StoreKey to be used when creating the KVStore
	StoreKey = ModuleName

	// RouterKey is the message route for token
	RouterKey = ModuleName

	// Parameter store default paramter store
	DefaultParamspace = ModuleName

	// query endpoints supported by the nameservice Querier
	QueryToken      = "token"
	QuerySymbols    = "symbols"
	QueryTokens     = "tokens"
	QueryParameters = "parameters"

	// MsgNewToken
	TypeMsgNewToken     = "new"
	TypeMsgInflateToken = "inflate"
	TypeMsgBurnToken    = "burn"
)
View Source
const (
	// ProposalTypeAddToken defines the type for a AddToken
	ProposalTypeTokenParamsChange = "TokenParamsChange"
	ProposalTypeDisableToken      = "DisableToken"
)
View Source
const (
	DefaultTokenCacheSize uint64 = 32 //cache size for token
)

Default parameter values

Variables

View Source
var (
	DefaultNewTokenFee     = sdk.TokensFromConsensusPower(1000) //1000poc
	DefaultReservedSymbols = []string{"btc", "eth", "eos", "usdt", "bch", "bsv", "ltc", "bnb", "xrp", "okb", "ht", "dash", "etc", "neo", "atom", "zec", "ont", "doge", "tusd", "bat", "qtum", "vsys", "iost", "dcr", "zrx", "beam", "grin"}
)
View Source
var (
	KeyTokenCacheSize  = []byte("TokenCacheSize")
	KeyNewTokenFee     = []byte("NewTokenFee")
	KeyReservedSymbols = []byte("ReservedSymbols")
)

Parameter keys

View Source
var ModuleCdc *codec.Codec

Functions

func ErrDuplicatedKey

func ErrDuplicatedKey() sdk.Error

ErrDuplicatedKey returns an error for when duplicated keys appear

func ErrEmptyKey

func ErrEmptyKey() sdk.Error

ErrEmptyKey returns an error for when an empty key is given.

func ErrEmptyValue

func ErrEmptyValue() sdk.Error

ErrEmptyValue returns an error for when an empty key is given.

func ErrInvalidParameter

func ErrInvalidParameter(key, value string) sdk.Error

ErrEmptyValue returns an error for when an invalid parameter

func ErrInvalidSymbol

func ErrInvalidSymbol(symbol string) sdk.Error

ErrInvalidSymbol returns an error for when duplicated keys appear

func ErrNonExistSymbol

func ErrNonExistSymbol(symbol string) sdk.Error

ErrNonExistSymbol returns an error for when a symbol doesn't exist

func ErrSymbolReserved

func ErrSymbolReserved(msg string) sdk.Error

ErrSymbolReserved returns an error for when a symbol is reserved

func ParamKeyTable

func ParamKeyTable() params.KeyTable

ParamKeyTable for auth module

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

RegisterCodec register concrete types on codec codec

Types

type AccountKeeper

type AccountKeeper interface {
	GetAccount(ctx sdk.Context, addr sdk.AccAddress) exported.Account
	GetAllAccounts(ctx sdk.Context) []exported.Account
	SetAccount(ctx sdk.Context, acc exported.Account)
}

AccountKeeper defines the account contract that must be fulfilled when creating a x/bank keeper.

type CodeType

type CodeType = sdk.CodeType
const (
	DefaultCodespace   sdk.CodespaceType = "token"
	CodeInvalidInput   CodeType          = 103
	CodeEmptyData      CodeType          = 104
	CodeDuplicatedKey  CodeType          = 105
	CodeInvalidSymbol  CodeType          = 106
	CodeNonExistSymbol CodeType          = 107
	CodeSymbolReserved CodeType          = 108
)

type DisableTokenProposal

type DisableTokenProposal struct {
	Title       string `json:"title" yaml:"title"`
	Description string `json:"description" yaml:"description"`
	Symbol      string `json:"symbol" yaml:"symbol"`
}

DisableTokenProposal modify a token's variable parameter

func NewDisableTokenProposal

func NewDisableTokenProposal(title, description, sybmol string) DisableTokenProposal

NewDisableTokenProposal creates a new disable token proposal.

func (DisableTokenProposal) GetDescription

func (dtp DisableTokenProposal) GetDescription() string

GetDescription returns the description of a disable token proposal..

func (DisableTokenProposal) GetTitle

func (dtp DisableTokenProposal) GetTitle() string

GetTitle returns the title of a disable token proposal..

func (DisableTokenProposal) ProposalRoute

func (dtp DisableTokenProposal) ProposalRoute() string

GetDescription returns the routing key of a disable token proposal..

func (DisableTokenProposal) ProposalType

func (dtp DisableTokenProposal) ProposalType() string

ProposalType returns the type of a disable token proposal.

func (DisableTokenProposal) String

func (dtp DisableTokenProposal) String() string

String implements the Stringer interface.

func (DisableTokenProposal) ValidateBasic

func (dtp DisableTokenProposal) ValidateBasic() sdk.Error

ValidateBasic runs basic stateless validity checks

type DistrKeeper

type DistrKeeper interface {
	AddCoinsFromAccountToFeePool(ctx sdk.Context, senderAddr sdk.AccAddress, amount sdk.Coins) sdk.Error
}

DistrKeeper defines the distribution Keeper for module token

type MsgBurnToken

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

MsgBurnToken burn coins from account

func NewMsgBurnToken

func NewMsgBurnToken(fromAddr sdk.AccAddress, amount sdk.Coins) MsgBurnToken

NewMsgBurnToken - burn coins msg

func (MsgBurnToken) GetSignBytes

func (msg MsgBurnToken) GetSignBytes() []byte

GetSignBytes Implements Msg.

func (MsgBurnToken) GetSigners

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

GetSigners Implements Msg.

func (MsgBurnToken) Route

func (msg MsgBurnToken) Route() string

Route Implements Msg.

func (MsgBurnToken) Type

func (msg MsgBurnToken) Type() string

Type Implements Msg.

func (MsgBurnToken) ValidateBasic

func (msg MsgBurnToken) ValidateBasic() sdk.Error

ValidateBasic Implements Msg.

type MsgInflateToken

type MsgInflateToken struct {
	From   sdk.AccAddress `json:"from" yaml:"from"`
	To     sdk.AccAddress `json:"to" yaml:"to"`
	Amount sdk.Coins      `json:"amount" yaml:"amount"`
}

MsgInflateToken ...

func NewMsgInflateToken

func NewMsgInflateToken(from, to sdk.AccAddress, amount sdk.Coins) MsgInflateToken

NewMsgInflateToken is a constructor function for MsgInflateToken

func (MsgInflateToken) GetSignBytes

func (msg MsgInflateToken) GetSignBytes() []byte

GetSignBytes implements Msg.

func (MsgInflateToken) GetSigners

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

GetSigners implements Msg.

func (MsgInflateToken) Route

func (msg MsgInflateToken) Route() string

func (MsgInflateToken) Type

func (msg MsgInflateToken) Type() string

func (MsgInflateToken) ValidateBasic

func (msg MsgInflateToken) ValidateBasic() sdk.Error

ValidateBasic runs stateless checks on the message

type MsgNewToken

type MsgNewToken struct {
	From        sdk.AccAddress `json:"from" yaml:"from"`
	To          sdk.AccAddress `json:"to" yaml:"to"`
	Symbol      sdk.Symbol     `json:"symbol" yaml:"symbol"`
	Decimals    uint64         `json:"decimals" yaml:"decimals"`
	TotalSupply sdk.Int        `json:"total_supply" yaml:"total_supply"`
}

MsgNewToken ...

func NewMsgNewToken

func NewMsgNewToken(from, to sdk.AccAddress, symbol string, decimals uint64, totalSupply sdk.Int) MsgNewToken

NewMsgNewToken is a constructor function for MsgTokenNew

func (MsgNewToken) GetSignBytes

func (msg MsgNewToken) GetSignBytes() []byte

GetSignBytes ...

func (MsgNewToken) GetSigners

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

GetSigners ...

func (MsgNewToken) Route

func (msg MsgNewToken) Route() string

func (MsgNewToken) Type

func (msg MsgNewToken) Type() string

func (MsgNewToken) ValidateBasic

func (msg MsgNewToken) ValidateBasic() sdk.Error

ValidateBasic runs stateless checks on the message

type ParamChange

type ParamChange struct {
	Key   string
	Value string
}

func NewParamChange

func NewParamChange(key, value string) ParamChange

NewParamChange create a paramchange(k,v)

type Params

type Params struct {
	TokenCacheSize  uint64   `json:"token_cache_size"`
	NewTokenFee     sdk.Int  `json:"new_token_fee"`
	ReservedSymbols []string `json:"reserved_symbols"`
}

Params defines the parameters for the auth module.

func DefaultParams

func DefaultParams() Params

DefaultParams returns a default set of parameters.

func (Params) Equal

func (p Params) Equal(p2 Params) bool

Equal returns a boolean determining if two Params types are identical.

func (*Params) ParamSetPairs

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

ParamSetPairs implements the ParamSet interface and returns all the key/value pairs pairs of auth module's parameters. nolint

func (Params) String

func (p Params) String() string

String implements the stringer interface.

func (Params) Validate

func (p Params) Validate() error

type QueryResSymbols

type QueryResSymbols []string

QueryResSymbols

func (QueryResSymbols) String

func (qs QueryResSymbols) String() string

type QueryResToken

type QueryResToken sdk.TokenInfo

QueryResToken

func (QueryResToken) String

func (qs QueryResToken) String() string

type QueryResTokens

type QueryResTokens []sdk.TokenInfo

QueryResTokens

func (QueryResTokens) String

func (qs QueryResTokens) String() string

type QueryTokenInfo

type QueryTokenInfo struct {
	Symbol string `json:"symbol"`
}

QueryTokenInfo

func NewQueryTokenInfo

func NewQueryTokenInfo(symbol string) QueryTokenInfo

type SupplyKeeper

type SupplyKeeper interface {
	GetSupply(ctx sdk.Context) (supply supplyexported.SupplyI) //for get total supply from supply module
	SetSupply(ctx sdk.Context, supply supplyexported.SupplyI)
	GetModuleAddress(name string) sdk.AccAddress
	GetModuleAccount(ctx sdk.Context, name string) supplyexported.ModuleAccountI

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

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

SupplyKeeper defines the supply Keeper for module accounts

type TokenParamsChangeProposal

type TokenParamsChangeProposal struct {
	Title       string        `json:"title" yaml:"title"`
	Description string        `json:"description" yaml:"description"`
	Symbol      string        `json:"symbol" yaml:"symbol"`
	Changes     []ParamChange `json:"changes" yaml:"changes"`
}

TokenParamsChangeProposal modify a token's variable parameter

func NewTokenParamsChangeProposal

func NewTokenParamsChangeProposal(title, description, sybmol string, changes []ParamChange) TokenParamsChangeProposal

NewTokenParamsChangeProposal creates a new add token proposal.

func (TokenParamsChangeProposal) GetDescription

func (ctpp TokenParamsChangeProposal) GetDescription() string

GetDescription returns the description of a token parameter change proposal.

func (TokenParamsChangeProposal) GetTitle

func (ctpp TokenParamsChangeProposal) GetTitle() string

GetTitle returns the title of a token parameter change proposal.

func (TokenParamsChangeProposal) ProposalRoute

func (ctpp TokenParamsChangeProposal) ProposalRoute() string

GetDescription returns the routing key of a token parameter change proposal.

func (TokenParamsChangeProposal) ProposalType

func (ctpp TokenParamsChangeProposal) ProposalType() string

ProposalType returns the type of a token parameter change proposal.

func (TokenParamsChangeProposal) String

func (ctpp TokenParamsChangeProposal) String() string

String implements the Stringer interface.

func (TokenParamsChangeProposal) ValidateBasic

func (ctpp TokenParamsChangeProposal) ValidateBasic() sdk.Error

ValidateBasic runs basic stateless validity checks

Jump to

Keyboard shortcuts

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