Documentation ¶
Overview ¶
nolint
Index ¶
- Constants
- Variables
- func DecAccountArrToBaseAccountArr(decAccounts []DecAccount) (baseAccountArr []auth.Account)
- func ErrBlockedRecipient(codespace string, blockedAddr string) sdk.EnvelopedErr
- func ErrInvalidBalanceNotEnough(codespace string, message string) sdk.EnvelopedErr
- func ErrInvalidCommon(codespace string, message string) sdk.EnvelopedErr
- func ErrInvalidDexList(codespace string, message string) sdk.EnvelopedErr
- func ErrInvalidHeight(codespace string, h, ch, max int64) sdk.EnvelopedErr
- func ErrSendDisabled(codespace string) sdk.EnvelopedErr
- func GetConfirmOwnershipKey(symbol string) []byte
- func GetLockAddress(addr sdk.AccAddress) []byte
- func GetLockFeeAddress(addr sdk.AccAddress) []byte
- func GetTokenAddress(symbol string) []byte
- func GetUserTokenKey(owner sdk.AccAddress, symbol string) []byte
- func GetUserTokenPrefix(owner sdk.AccAddress) []byte
- func NotAllowedOriginSymbol(name string) bool
- func ParamKeyTable() params.KeyTable
- func RegisterCodec(cdc *codec.Codec)
- func ValidOriginalSymbol(name string) bool
- func WholeNameCheck(wholeName string) (newName string, isValid bool)
- type AccCoins
- type AccountParam
- type AccountParamV2
- type AccountResponse
- type BaseAccount
- type CoinInfo
- type CoinsInfo
- type ConfirmOwnership
- type Currency
- type DecAccount
- type FeeDetail
- type MsgConfirmOwnership
- type MsgMultiSend
- type MsgSend
- type MsgTokenBurn
- type MsgTokenIssue
- type MsgTokenMint
- type MsgTokenModify
- type MsgTransferOwnership
- type Params
- type Token
- type TokenResp
- type Tokens
- type Transfer
- type TransferUnit
Constants ¶
const ( LockCoinsTypeQuantity = 1 LockCoinsTypeFee = 2 )
const ( CodeInvalidPriceDigit uint32 = 1 CodeInvalidMinTradeSize uint32 = 2 CodeInvalidDexList uint32 = 3 CodeInvalidBalanceNotEnough uint32 = 4 CodeInvalidHeight uint32 = 5 CodeInvalidAsset uint32 = 6 CodeInvalidCommon uint32 = 7 CodeBlockedRecipient uint32 = 8 CodeSendDisabled uint32 = 9 )
const ( // ModuleName is the name of the staking module ModuleName = "token" DefaultParamspace = ModuleName DefaultCodespace = ModuleName // StoreKey is the string store representation StoreKey = ModuleName // QuerierRoute is the querier route for the staking module QuerierRoute = ModuleName // RouterKey is the msg router key for the staking module RouterKey = ModuleName KeyLock = "lock" KeyMint = "mint" // query endpoints supported by the governance Querier QueryInfo = "info" QueryTokens = "tokens" QueryParameters = "params" QueryCurrency = "currency" QueryAccount = "accounts" QueryKeysNum = "store" QueryAccountV2 = "accountsV2" QueryTokensV2 = "tokensV2" QueryTokenV2 = "tokenV2" )
const ( DescLenLimit = 256 MultiSendLimit = 1000 // 90 billion TotalSupplyUpperbound = int64(9 * 1e10) )
const ( DefaultFeeIssue = "2500" DefaultFeeMint = "10" DefaultFeeBurn = "10" DefaultFeeModify = "0" DefaultFeeChown = "10" )
const DefaultOwnershipConfirmWindow = 24 * time.Hour
DefaultOwnershipConfirmWindow defines default confirm window
Variables ¶
var ( TokenKey = []byte{0x00} // the address prefix of the token's symbol TokenNumberKey = []byte{0x01} // key for token number address LockKey = []byte{0x02} // the address prefix of the locked coins PrefixUserTokenKey = []byte{0x03} // the address prefix of the user-token relationship LockedFeeKey = []byte{0x04} // the address prefix of the locked order fee coins PrefixConfirmOwnershipKey = []byte{0x05} // the prefix of the confirm ownership key )
var ( KeyFeeIssue = []byte("FeeIssue") KeyFeeMint = []byte("FeeMint") KeyFeeBurn = []byte("FeeBurn") KeyFeeModify = []byte("FeeModify") KeyFeeChown = []byte("FeeChown") KeyOwnershipConfirmWindow = []byte("OwnershipConfirmWindow") )
var ModuleCdc *codec.Codec
generic sealed codec to be used throughout this module
Functions ¶
func DecAccountArrToBaseAccountArr ¶
func DecAccountArrToBaseAccountArr(decAccounts []DecAccount) (baseAccountArr []auth.Account)
func ErrBlockedRecipient ¶
func ErrBlockedRecipient(codespace string, blockedAddr string) sdk.EnvelopedErr
ErrBlockedRecipient returns an error when a transfer is tried on a blocked recipient
func ErrInvalidBalanceNotEnough ¶
func ErrInvalidBalanceNotEnough(codespace string, message string) sdk.EnvelopedErr
func ErrInvalidCommon ¶
func ErrInvalidCommon(codespace string, message string) sdk.EnvelopedErr
func ErrInvalidDexList ¶
func ErrInvalidDexList(codespace string, message string) sdk.EnvelopedErr
func ErrInvalidHeight ¶
func ErrInvalidHeight(codespace string, h, ch, max int64) sdk.EnvelopedErr
func ErrSendDisabled ¶
func ErrSendDisabled(codespace string) sdk.EnvelopedErr
ErrSendDisabled returns an error when the transaction sending is disabled in bank module
func GetConfirmOwnershipKey ¶
func GetLockAddress ¶
func GetLockAddress(addr sdk.AccAddress) []byte
func GetLockFeeAddress ¶
func GetLockFeeAddress(addr sdk.AccAddress) []byte
GetLockFeeAddress gets the key for the lock fee information with address
func GetTokenAddress ¶
func GetUserTokenKey ¶
func GetUserTokenKey(owner sdk.AccAddress, symbol string) []byte
func GetUserTokenPrefix ¶
func GetUserTokenPrefix(owner sdk.AccAddress) []byte
func NotAllowedOriginSymbol ¶ added in v0.12.1
func RegisterCodec ¶
RegisterCodec registers concrete types on the Amino codec
func ValidOriginalSymbol ¶
func WholeNameCheck ¶
Types ¶
type AccCoins ¶
type AccCoins struct { Acc sdk.AccAddress `json:"address"` Coins sdk.SysCoins `json:"coins"` }
type AccountParam ¶
type AccountParamV2 ¶
type AccountResponse ¶
type AccountResponse struct { Address string `json:"address"` Currencies CoinsInfo `json:"currencies"` }
func NewAccountResponse ¶
func NewAccountResponse(addr string) AccountResponse
type BaseAccount ¶
type CoinInfo ¶
type CoinInfo struct { Symbol string `json:"symbol" v2:"currency"` Available string `json:"available" v2:"available"` Locked string `json:"locked" v2:"locked"` }
func NewCoinInfo ¶
type ConfirmOwnership ¶
type ConfirmOwnership struct { Symbol string `json:"symbol"` Address sdk.AccAddress `json:"address"` Expire time.Time `json:expire` }
type Currency ¶
type DecAccount ¶
type DecAccount struct { Address sdk.AccAddress `json:"address"` Coins sdk.SysCoins `json:"coins"` PubKey crypto.PubKey `json:"public_key"` AccountNumber uint64 `json:"account_number"` Sequence uint64 `json:"sequence"` }
func BaseAccountToDecAccount ¶
func BaseAccountToDecAccount(account auth.BaseAccount) DecAccount
func (*DecAccount) ToBaseAccount ¶
func (acc *DecAccount) ToBaseAccount() *auth.BaseAccount
type FeeDetail ¶
type FeeDetail struct { Address string `gorm:"index;type:varchar(80)" json:"address" v2:"address"` Receiver string `gorm:"index;type:varchar(80)" json:"receiver" v2:"receiver"` // added for opendex Fee string `gorm:"type:varchar(40)" json:"fee" v2:"fee"` FeeType string `gorm:"index;type:varchar(20)" json:"fee_type" v2:"fee_type"` // defined in order/types/const.go Timestamp int64 `gorm:"type:bigint" json:"timestamp" v2:"timestamp"` }
nolint
type MsgConfirmOwnership ¶
type MsgConfirmOwnership struct { Symbol string `json:"symbol"` Address sdk.AccAddress `json:"new_owner"` }
MsgConfirmOwnership - high level transaction of the coin module
func NewMsgConfirmOwnership ¶
func NewMsgConfirmOwnership(newOwner sdk.AccAddress, symbol string) MsgConfirmOwnership
func (MsgConfirmOwnership) GetSignBytes ¶
func (msg MsgConfirmOwnership) GetSignBytes() []byte
func (MsgConfirmOwnership) GetSigners ¶
func (msg MsgConfirmOwnership) GetSigners() []sdk.AccAddress
func (MsgConfirmOwnership) Route ¶
func (msg MsgConfirmOwnership) Route() string
func (MsgConfirmOwnership) Type ¶
func (msg MsgConfirmOwnership) Type() string
func (MsgConfirmOwnership) ValidateBasic ¶
func (msg MsgConfirmOwnership) ValidateBasic() sdk.Error
type MsgMultiSend ¶
type MsgMultiSend struct { From sdk.AccAddress `json:"from"` Transfers []TransferUnit `json:"transfers"` }
func NewMsgMultiSend ¶
func NewMsgMultiSend(from sdk.AccAddress, transfers []TransferUnit) MsgMultiSend
func (MsgMultiSend) GetSignBytes ¶
func (msg MsgMultiSend) GetSignBytes() []byte
func (MsgMultiSend) GetSigners ¶
func (msg MsgMultiSend) GetSigners() []sdk.AccAddress
func (MsgMultiSend) Route ¶
func (msg MsgMultiSend) Route() string
func (MsgMultiSend) Type ¶
func (msg MsgMultiSend) Type() string
func (MsgMultiSend) ValidateBasic ¶
func (msg MsgMultiSend) ValidateBasic() sdk.Error
type MsgSend ¶
type MsgSend struct { FromAddress sdk.AccAddress `json:"from_address"` ToAddress sdk.AccAddress `json:"to_address"` Amount sdk.SysCoins `json:"amount"` }
MsgSend - high level transaction of the coin module
func NewMsgTokenSend ¶
func NewMsgTokenSend(from, to sdk.AccAddress, coins sdk.SysCoins) MsgSend
func (MsgSend) GetSignBytes ¶
func (MsgSend) GetSigners ¶
func (msg MsgSend) GetSigners() []sdk.AccAddress
func (MsgSend) ValidateBasic ¶
type MsgTokenBurn ¶
type MsgTokenBurn struct { Amount sdk.SysCoin `json:"amount"` Owner sdk.AccAddress `json:"owner"` }
func NewMsgTokenBurn ¶
func NewMsgTokenBurn(amount sdk.SysCoin, owner sdk.AccAddress) MsgTokenBurn
func (MsgTokenBurn) GetSignBytes ¶
func (msg MsgTokenBurn) GetSignBytes() []byte
func (MsgTokenBurn) GetSigners ¶
func (msg MsgTokenBurn) GetSigners() []sdk.AccAddress
func (MsgTokenBurn) Route ¶
func (msg MsgTokenBurn) Route() string
func (MsgTokenBurn) Type ¶
func (msg MsgTokenBurn) Type() string
func (MsgTokenBurn) ValidateBasic ¶
func (msg MsgTokenBurn) ValidateBasic() sdk.Error
type MsgTokenIssue ¶
type MsgTokenIssue struct { Description string `json:"description"` Symbol string `json:"symbol"` OriginalSymbol string `json:"original_symbol"` WholeName string `json:"whole_name"` TotalSupply string `json:"total_supply"` Owner sdk.AccAddress `json:"owner"` Mintable bool `json:"mintable"` }
func NewMsgTokenIssue ¶
func NewMsgTokenIssue(tokenDescription, symbol, originalSymbol, wholeName, totalSupply string, owner sdk.AccAddress, mintable bool) MsgTokenIssue
func (MsgTokenIssue) GetSignBytes ¶
func (msg MsgTokenIssue) GetSignBytes() []byte
func (MsgTokenIssue) GetSigners ¶
func (msg MsgTokenIssue) GetSigners() []sdk.AccAddress
func (MsgTokenIssue) Route ¶
func (msg MsgTokenIssue) Route() string
func (MsgTokenIssue) Type ¶
func (msg MsgTokenIssue) Type() string
func (MsgTokenIssue) ValidateBasic ¶
func (msg MsgTokenIssue) ValidateBasic() sdk.Error
type MsgTokenMint ¶
type MsgTokenMint struct { Amount sdk.SysCoin `json:"amount"` Owner sdk.AccAddress `json:"owner"` }
func NewMsgTokenMint ¶
func NewMsgTokenMint(amount sdk.SysCoin, owner sdk.AccAddress) MsgTokenMint
func (MsgTokenMint) GetSignBytes ¶
func (msg MsgTokenMint) GetSignBytes() []byte
func (MsgTokenMint) GetSigners ¶
func (msg MsgTokenMint) GetSigners() []sdk.AccAddress
func (MsgTokenMint) Route ¶
func (msg MsgTokenMint) Route() string
func (MsgTokenMint) Type ¶
func (msg MsgTokenMint) Type() string
func (MsgTokenMint) ValidateBasic ¶
func (msg MsgTokenMint) ValidateBasic() sdk.Error
type MsgTokenModify ¶
type MsgTokenModify struct { Owner sdk.AccAddress `json:"owner"` Symbol string `json:"symbol"` Description string `json:"description"` WholeName string `json:"whole_name"` IsDescriptionModified bool `json:"description_modified"` IsWholeNameModified bool `json:"whole_name_modified"` }
func NewMsgTokenModify ¶
func NewMsgTokenModify(symbol, desc, wholeName string, isDescEdit, isWholeNameEdit bool, owner sdk.AccAddress) MsgTokenModify
func (MsgTokenModify) GetSignBytes ¶
func (msg MsgTokenModify) GetSignBytes() []byte
func (MsgTokenModify) GetSigners ¶
func (msg MsgTokenModify) GetSigners() []sdk.AccAddress
func (MsgTokenModify) Route ¶
func (msg MsgTokenModify) Route() string
func (MsgTokenModify) Type ¶
func (msg MsgTokenModify) Type() string
func (MsgTokenModify) ValidateBasic ¶
func (msg MsgTokenModify) ValidateBasic() sdk.Error
type MsgTransferOwnership ¶
type MsgTransferOwnership struct { FromAddress sdk.AccAddress `json:"from_address"` ToAddress sdk.AccAddress `json:"to_address"` Symbol string `json:"symbol"` }
MsgTransferOwnership - high level transaction of the coin module
func NewMsgTransferOwnership ¶
func NewMsgTransferOwnership(from, to sdk.AccAddress, symbol string) MsgTransferOwnership
func (MsgTransferOwnership) GetSignBytes ¶
func (msg MsgTransferOwnership) GetSignBytes() []byte
func (MsgTransferOwnership) GetSigners ¶
func (msg MsgTransferOwnership) GetSigners() []sdk.AccAddress
func (MsgTransferOwnership) Route ¶
func (msg MsgTransferOwnership) Route() string
func (MsgTransferOwnership) Type ¶
func (msg MsgTransferOwnership) Type() string
func (MsgTransferOwnership) ValidateBasic ¶
func (msg MsgTransferOwnership) ValidateBasic() sdk.Error
type Params ¶
type Params struct { FeeIssue sdk.SysCoin `json:"issue_fee"` FeeMint sdk.SysCoin `json:"mint_fee"` FeeBurn sdk.SysCoin `json:"burn_fee"` FeeModify sdk.SysCoin `json:"modify_fee"` FeeChown sdk.SysCoin `json:"transfer_ownership_fee"` OwnershipConfirmWindow time.Duration `json:"ownership_confirm_window"` }
mint parameters
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 Token ¶
type Token struct { Description string `json:"description" v2:"description"` // e.g. "OK Group Global Utility Token" Symbol string `json:"symbol" v2:"symbol"` // e.g. "okt" OriginalSymbol string `json:"original_symbol" v2:"original_symbol"` // e.g. "OKT" WholeName string `json:"whole_name" v2:"whole_name"` // e.g. "OKT" OriginalTotalSupply sdk.Dec `json:"original_total_supply" v2:"original_total_supply"` // e.g. 1000000000.00000000 Type int `json:"type"` //e.g. 1 common token, 2 interest token Owner sdk.AccAddress `json:"owner" v2:"owner"` // e.g. okexchain1hw4r48aww06ldrfeuq2v438ujnl6alsz0685a0 Mintable bool `json:"mintable" v2:"mintable"` // e.g. false }
type TokenResp ¶
type TokenResp struct { Description string `json:"description" v2:"description"` Symbol string `json:"symbol" v2:"symbol"` OriginalSymbol string `json:"original_symbol" v2:"original_symbol"` WholeName string `json:"whole_name" v2:"whole_name"` OriginalTotalSupply sdk.Dec `json:"original_total_supply" v2:"original_total_supply"` Type int `json:"type"` Owner sdk.AccAddress `json:"owner" v2:"owner"` Mintable bool `json:"mintable" v2:"mintable"` TotalSupply sdk.Dec `json:"total_supply" v2:"total_supply"` }
func GenTokenResp ¶
type TransferUnit ¶
type TransferUnit struct { To sdk.AccAddress `json:"to"` Coins sdk.SysCoins `json:"coins"` }
func StrToTransfers ¶
func StrToTransfers(str string) (transfers []TransferUnit, err error)
Convert a formatted json string into a TransferUnit array e.g.) [{"to": "addr", "amount": "1BNB,2BTC"}, ...]