Documentation
¶
Overview ¶
* ******************************************************************* * @项目名称: types * @文件名称: querier.go * @Date: 2019/06/05 * @Author: Keep * @Copyright(C): 2019 BlueHelix Inc. All rights reserved. * 注意:本内容仅限于内部传阅,禁止外泄以及用于其他的商业目的. * *******************************************************************
Index ¶
- Constants
- Variables
- func ErrDuplicatedKey() sdk.Error
- func ErrEmptyKey() sdk.Error
- func ErrEmptyValue() sdk.Error
- func ErrInvalidParameter(key, value string) sdk.Error
- func ErrInvalidSymbol(symbol string) sdk.Error
- func ErrNonExistSymbol(symbol string) sdk.Error
- func ErrSymbolReserved(msg string) sdk.Error
- func ParamKeyTable() params.KeyTable
- func RegisterCodec(cdc *codec.Codec)
- type AccountKeeper
- type CodeType
- type DisableTokenProposal
- func (dtp DisableTokenProposal) GetDescription() string
- func (dtp DisableTokenProposal) GetTitle() string
- func (dtp DisableTokenProposal) ProposalRoute() string
- func (dtp DisableTokenProposal) ProposalType() string
- func (dtp DisableTokenProposal) String() string
- func (dtp DisableTokenProposal) ValidateBasic() sdk.Error
- type DistrKeeper
- type MsgBurnToken
- type MsgInflateToken
- type MsgNewToken
- type ParamChange
- type Params
- type QueryResSymbols
- type QueryResToken
- type QueryResTokens
- type QueryTokenInfo
- type SupplyKeeper
- type TokenParamsChangeProposal
- func (ctpp TokenParamsChangeProposal) GetDescription() string
- func (ctpp TokenParamsChangeProposal) GetTitle() string
- func (ctpp TokenParamsChangeProposal) ProposalRoute() string
- func (ctpp TokenParamsChangeProposal) ProposalType() string
- func (ctpp TokenParamsChangeProposal) String() string
- func (ctpp TokenParamsChangeProposal) ValidateBasic() sdk.Error
Constants ¶
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 )
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" )
const ( // ProposalTypeAddToken defines the type for a AddToken ProposalTypeTokenParamsChange = "TokenParamsChange" ProposalTypeDisableToken = "DisableToken" )
const (
DefaultTokenCacheSize uint64 = 32 //cache size for token
)
Default parameter values
Variables ¶
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"} )
var ( KeyTokenCacheSize = []byte("TokenCacheSize") KeyNewTokenFee = []byte("NewTokenFee") KeyReservedSymbols = []byte("ReservedSymbols") )
Parameter keys
var ModuleCdc *codec.Codec
Functions ¶
func ErrDuplicatedKey ¶
ErrDuplicatedKey returns an error for when duplicated keys appear
func ErrEmptyKey ¶
ErrEmptyKey returns an error for when an empty key is given.
func ErrEmptyValue ¶
ErrEmptyValue returns an error for when an empty key is given.
func ErrInvalidParameter ¶
ErrEmptyValue returns an error for when an invalid parameter
func ErrInvalidSymbol ¶
ErrInvalidSymbol returns an error for when duplicated keys appear
func ErrNonExistSymbol ¶
ErrNonExistSymbol returns an error for when a symbol doesn't exist
func ErrSymbolReserved ¶
ErrSymbolReserved returns an error for when a symbol is reserved
func RegisterCodec ¶
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 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) 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) 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 ¶
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 (*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
type QueryResSymbols ¶
type QueryResSymbols []string
QueryResSymbols
func (QueryResSymbols) String ¶
func (qs QueryResSymbols) String() string
type QueryResToken ¶
QueryResToken
func (QueryResToken) String ¶
func (qs QueryResToken) String() string
type QueryResTokens ¶
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