types

package
v0.0.0-...-25b3476 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

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

	// query endpoints supported by the nameservice Querier
	QueryToken     = "token"
	QueryIBCTokens = "ibc_tokens"

	TypeMsgSynGasPrice = "token-syngasprice"

	DefaultStableCoinWeight  = 0
	DefaultNativeTokenWeight = 10
	DefaultIBCTokenWeight    = 20
	DefaultHrc10TokenWeight  = 30
)
View Source
const (
	// ProposalTypeAddToken defines the type for a AddToken
	ProposalTypeAddToken          = "AddToken"
	ProposalTypeTokenParamsChange = "TokenParamsChange"
)

Variables

View Source
var (
	TokenStoreKeyPrefix = []byte{0x01}
	IBCTokenListKey     = []byte{0x02}
)
View Source
var ModuleCdc = codec.New()

Functions

func CalSymbol

func CalSymbol(issuer string, chain sdk.Symbol) sdk.Symbol

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 RegisterCodec

func RegisterCodec(cdc *codec.Codec)

Register concrete types on codec codec

func TokenStoreKey

func TokenStoreKey(symbol sdk.Symbol) []byte

Types

type AddTokenProposal

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

AddTokenProposal add a new token

func NewAddTokenProposal

func NewAddTokenProposal(title, description string, tokenInfo *sdk.IBCToken) 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 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 QueryTokenInfoParams

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

func NewQueryTokenInfoParams

func NewQueryTokenInfoParams(symbol string) QueryTokenInfoParams

type ResToken

type ResToken struct {
	Name                  string        `json:"name"`
	Symbol                string        `json:"symbol"`
	Issuer                string        `json:"issuer"`       //token's issuer
	Chain                 string        `json:"chain"`        //related mainnet token, e.g. ERC20 token's Chain is ETH
	TotalSupply           sdk.Int       `json:"total_supply"` //token's total supply
	MapToken              bool          `json:"map_token"`
	Weight                int           `json:"weight"`
	Decimals              uint64        `json:"decimals"`            //token's decimals, represents by the decimals's
	SendEnabled           bool          `json:"send_enabled"`        //whether send enabled or not
	DepositEnabled        bool          `json:"deposit_enabled"`     //whether send enabled or not
	WithdrawalEnabled     bool          `json:"withdrawal_enabled"`  //whether withdrawal enabled or not
	TokenType             sdk.TokenType `json:"type"`                //token's type
	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"` //confirmation of chain
	IsNonceBased          bool          `json:"is_nonce_based"`
	NeedCollectFee        bool          `json:"need_collect_fee"`
	SysTransferAmount     sdk.Int       `json:"sys_transfer_amount"`
	OpCUSysTransferAmount sdk.Int       `json:"op_cu_sys_transfer_amount"`
	WithdrawalFee         sdk.Int       `json:"withdrawal_fee"`
	CollectFee            sdk.Int       `json:"collect_fee"`
	MappingSymbol         sdk.Symbol    `json:"mapping_symbol"`
}

func NewResToken

func NewResToken(token sdk.Token, collectFeeAmt, withDrawalFeeAmt, chainGasPrice sdk.Int) *ResToken

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