types

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2020 License: Apache-2.0 Imports: 8 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 (
	EventTypeSyncGasPrice                     = "sync_gas_price"
	EventTypeExecuteAddTokenProposal          = "execute_add_token_proposal"
	EventTypeExecuteTokenParamsChangeProposal = "execute_token_params_change_proposal"
	EventTypeExecuteDisableTokenProposal      = "execute_disable_token_proposal"

	AttributeKeyFrom            = "from"
	AttributeKeyTokeninfo       = "token_info"
	AttributeKeyGasPrice        = "gas_price"
	AttributeKeyToken           = "token"
	AttributeKeyTokenParam      = "param"
	AttributeKeyTokenParamValue = "value"
	AttributeKeyHeight          = "height"

	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 gov
	RouterKey = ModuleName

	// QuerierRoute is the querier route for gov
	QuerierRoute = ModuleName

	// Parameter store default parameter store
	DefaultParamspace = ModuleName

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

	TypeMsgSynGasPrice = "token-syngasprice"
)
View Source
const (
	// ProposalTypeAddToken defines the type for a AddToken
	ProposalTypeAddToken          = "AddToken"
	ProposalTypeTokenParamsChange = "TokenParamsChange"
	ProposalTypeDisableToken      = "DisableToken"
)
View Source
const (
	DefaultTokenCacheSize uint64 = 32 //cache size for token
)

Default parameter values

Variables

View Source
var (
	KeyTokenCacheSize  = []byte("TokenCacheSize")
	KeyReservedSymbols = []byte("ReservedSymbols")
)

Parameter keys

View Source
var DefaultReservedSymbols = []string{"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 ModuleCdc = codec.New()

Functions

func ErrDuplicatedKey

func ErrDuplicatedKey(codespace sdk.CodespaceType) sdk.Error

func ErrEmptyKey

func ErrEmptyKey(codespace sdk.CodespaceType) sdk.Error

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

func ErrEmptyValue

func ErrEmptyValue(codespace sdk.CodespaceType) sdk.Error

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

func ErrInvalidParameter

func ErrInvalidParameter(codespace sdk.CodespaceType, key, value string) sdk.Error

func ErrInvalidProposalTokenInfo

func ErrInvalidProposalTokenInfo(codespace sdk.CodespaceType) sdk.Error

func NewGasPriceVoteBox

func NewGasPriceVoteBox(confirmThreshold int) evidence.VoteBox

func ParamKeyTable

func ParamKeyTable() params.KeyTable

ParamKeyTable for auth module

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

Register concrete types on codec codec

Types

type AddTokenProposal

type AddTokenProposal struct {
	Title       string        `json:"title" yaml:"title"`
	Description string        `json:"description" yaml:"description"`
	TokenInfo   sdk.TokenInfo `json:"token_info" yaml:"token_info"`
}

AddTokenProposal add a new token

func NewAddTokenProposal

func NewAddTokenProposal(title, description string, tokenInfo sdk.TokenInfo) AddTokenProposal

NewAddTokenProposal creates a new add token proposal.

func (AddTokenProposal) GetDescription

func (atp AddTokenProposal) GetDescription() string

GetDescription returns the description of a community pool spend proposal.

func (AddTokenProposal) GetTitle

func (atp AddTokenProposal) GetTitle() string

GetTitle returns the title of a community pool spend proposal.

func (AddTokenProposal) ProposalRoute

func (atp AddTokenProposal) ProposalRoute() string

GetDescription returns the routing key of a community pool spend proposal.

func (AddTokenProposal) ProposalToken

func (atp AddTokenProposal) ProposalToken() string

func (AddTokenProposal) ProposalType

func (atp AddTokenProposal) ProposalType() string

ProposalType returns the type of a community pool spend proposal.

func (AddTokenProposal) String

func (atp AddTokenProposal) String() string

String implements the Stringer interface.

func (AddTokenProposal) ValidateBasic

func (atp AddTokenProposal) ValidateBasic() sdk.Error

ValidateBasic runs basic stateless validity checks

type CodeType

type CodeType = sdk.CodeType
const (
	DefaultCodespace  sdk.CodespaceType = "token"
	CodeInvalidInput  CodeType          = 103
	CodeEmptyData     CodeType          = 104
	CodeDuplicatedKey CodeType          = 105
)

type DisableTokenProposal

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

ModifyTokenProposal modify a token's variable parameter

func NewDisableTokenProposal

func NewDisableTokenProposal(title, description, sybmol string) DisableTokenProposal

NewAddTokenProposal creates a new add token proposal.

func (DisableTokenProposal) GetDescription

func (dtp DisableTokenProposal) GetDescription() string

GetDescription returns the description of a community pool spend proposal.

func (DisableTokenProposal) GetTitle

func (dtp DisableTokenProposal) GetTitle() string

GetTitle returns the title of a community pool spend proposal.

func (DisableTokenProposal) ProposalRoute

func (dtp DisableTokenProposal) ProposalRoute() string

GetDescription returns the routing key of a community pool spend proposal.

func (DisableTokenProposal) ProposalToken

func (dtp DisableTokenProposal) ProposalToken() string

func (DisableTokenProposal) ProposalType

func (dtp DisableTokenProposal) ProposalType() string

ProposalType returns the type of a community pool spend 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 GasPriceVoteBox

type GasPriceVoteBox struct {
	ConfirmThreshold int                 `json:"confirm_threshold"`
	VoteItems        []*GasPriceVoteItem `json:"vote_items"`
	Confirmed        bool                `json:"confirmed"`
	ConfirmedMedian  sdk.Int             `json:"confirmed_median"`
}

func (*GasPriceVoteBox) AddVote

func (v *GasPriceVoteBox) AddVote(voter sdk.CUAddress, vote evidence.Vote) bool

func (*GasPriceVoteBox) HasConfirmed

func (v *GasPriceVoteBox) HasConfirmed() bool

func (*GasPriceVoteBox) ValidVotes

func (v *GasPriceVoteBox) ValidVotes() []*evidence.VoteItem

type GasPriceVoteItem

type GasPriceVoteItem struct {
	Price sdk.Int       `json:"price"`
	Voter sdk.CUAddress `json:"voter"`
}

type MsgSynGasPrice

type MsgSynGasPrice struct {
	From     string               `json:"from"`
	Height   uint64               `json:"height"`
	GasPrice []sdk.TokensGasPrice `json:"gas_price"`
}

func NewMsgSynGasPrice

func NewMsgSynGasPrice(from string, height uint64, tokensgasprice []sdk.TokensGasPrice) MsgSynGasPrice

NewMsgNewToken is a constructor function for MsgTokenNew

func (MsgSynGasPrice) GetSignBytes

func (msg MsgSynGasPrice) GetSignBytes() []byte

func (MsgSynGasPrice) GetSigners

func (msg MsgSynGasPrice) GetSigners() []sdk.CUAddress

func (MsgSynGasPrice) IsSettleOnlyMsg

func (msg MsgSynGasPrice) IsSettleOnlyMsg() bool

func (MsgSynGasPrice) Route

func (msg MsgSynGasPrice) Route() string

func (MsgSynGasPrice) Type

func (msg MsgSynGasPrice) Type() string

func (MsgSynGasPrice) ValidateBasic

func (msg MsgSynGasPrice) ValidateBasic() sdk.Error

ValidateBasic runs stateless checks on the message

type ParamChange

type ParamChange struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

func NewParamChange

func NewParamChange(key, value string) ParamChange

type Params

type Params struct {
	TokenCacheSize  uint64   `json:"token_cache_size"`
	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.

type QueryDecimals

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

type QueryResDecimals

type QueryResDecimals struct {
	Decimals uint64 `json:"decimals"` //token's decimals, represents by the decimals's
}

type QueryResToken types.TokenInfo

func (QueryResDecimals) String

func (r QueryResDecimals) String() string

type QueryResSymbols

type QueryResSymbols []string

func (QueryResSymbols) String

func (r QueryResSymbols) String() string

type QueryResToken

type QueryResToken struct {
	Symbol              sdk.Symbol `json:"symbol"`
	Issuer              string     `json:"issuer"`                //token's issuer
	Chain               string     `json:"chain"`                 //related mainnet token, e.g. ERC20 token's Chain is ETH
	TokenType           uint64     `json:"type"`                  //token's type
	IsSendEnabled       bool       `json:"is_send_enabled"`       //whether send enabled or not
	IsDepositEnabled    bool       `json:"is_deposit_enabled"`    //whether send enabled or not
	IsWithdrawalEnabled bool       `json:"is_withdrawal_enabled"` //whether withdrawal enabled or not
	Decimals            uint64     `json:"decimals"`              //token's decimals, represents by the decimals's
	TotalSupply         sdk.Int    `json:"total_supply"`          //token's total supply
	CollectThreshold    sdk.Int    `json:"collect_threshold"`     // token's collect threshold == account threshold
	DepositThreshold    sdk.Int    `json:"deposit_threshold"`     // token's deposit threshold
	OpenFee             sdk.Int    `json:"open_fee"`              // token's open fee for custodianunit address
	SysOpenFee          sdk.Int    `json:"sys_open_fee"`          // token's open fee for external address
	WithdrawalFeeRate   sdk.Dec    `json:"withdrawal_fee_rate"`   // token's WithdrawalFeeRate
	MaxOpCUNumber       uint64     `json:"max_op_cu_number"`
	SysTransferNum      sdk.Int    `json:"sys_transfer_num"`       // 给user反向打币每次限额
	OpCUSysTransferNum  sdk.Int    `json:"op_cu_sys_transfer_num"` // 给 opcu之间转gas的每次限额
	GasLimit            sdk.Int    `json:"gas_limit"`
	GasPrice            sdk.Int    `json:"gas_price"`
	Confirmations       uint64     `json:"confirmations" yaml:"confirmations"` //confirmation of chain
	IsNonceBased        bool       `json:"is_nonce_based" yaml:"is_nonce_based"`
}

type QueryResToken types.TokenInfo

func (QueryResToken) String

func (r QueryResToken) String() string

type QueryResTokens

type QueryResTokens []QueryResToken

func (QueryResTokens) String

func (qs QueryResTokens) String() string

type QueryTokenInfo

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

func NewQueryTokenInfo

func NewQueryTokenInfo(symbol string) QueryTokenInfo

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"`
}

ModifyTokenProposal modify a token's variable parameter

func NewTokenParamsChangeProposal

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

NewAddTokenProposal creates a new add token proposal.

func (TokenParamsChangeProposal) GetDescription

func (ctpp TokenParamsChangeProposal) GetDescription() string

GetDescription returns the description of a community pool spend proposal.

func (TokenParamsChangeProposal) GetTitle

func (ctpp TokenParamsChangeProposal) GetTitle() string

GetTitle returns the title of a community pool spend proposal.

func (TokenParamsChangeProposal) ProposalRoute

func (ctpp TokenParamsChangeProposal) ProposalRoute() string

GetDescription returns the routing key of a community pool spend proposal.

func (TokenParamsChangeProposal) ProposalToken

func (ctpp TokenParamsChangeProposal) ProposalToken() string

func (TokenParamsChangeProposal) ProposalType

func (ctpp TokenParamsChangeProposal) ProposalType() string

ProposalType returns the type of a community pool spend 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