types

package
v0.15.0-testnet Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

nolint

Index

Constants

View Source
const (
	LockCoinsTypeQuantity = 1
	LockCoinsTypeFee      = 2
)
View Source
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
)
View Source
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"
)
View Source
const (
	DescLenLimit   = 256
	MultiSendLimit = 1000

	// 90 billion
	TotalSupplyUpperbound = int64(9 * 1e10)
)
View Source
const (
	DefaultFeeIssue  = "2500"
	DefaultFeeMint   = "10"
	DefaultFeeBurn   = "10"
	DefaultFeeModify = "0"
	DefaultFeeChown  = "10"
)
View Source
const DefaultOwnershipConfirmWindow = 24 * time.Hour

DefaultOwnershipConfirmWindow defines default confirm window

Variables

View Source
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
)
View Source
var (
	KeyFeeIssue               = []byte("FeeIssue")
	KeyFeeMint                = []byte("FeeMint")
	KeyFeeBurn                = []byte("FeeBurn")
	KeyFeeModify              = []byte("FeeModify")
	KeyFeeChown               = []byte("FeeChown")
	KeyOwnershipConfirmWindow = []byte("OwnershipConfirmWindow")
)
View Source
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 GetConfirmOwnershipKey(symbol string) []byte

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 GetTokenAddress(symbol string) []byte

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 NotAllowedOriginSymbol(name string) bool

func ParamKeyTable

func ParamKeyTable() params.KeyTable

ParamKeyTable for auth module

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

RegisterCodec registers concrete types on the Amino codec

func ValidOriginalSymbol

func ValidOriginalSymbol(name string) bool

func WholeNameCheck

func WholeNameCheck(wholeName string) (newName string, isValid bool)

Types

type AccCoins

type AccCoins struct {
	Acc   sdk.AccAddress `json:"address"`
	Coins sdk.SysCoins   `json:"coins"`
}

type AccountParam

type AccountParam struct {
	Symbol string `json:"symbol"`
	Show   string `json:"show"`
}

type AccountParamV2

type AccountParamV2 struct {
	Currency string `json:"currency"`
	HideZero string `json:"hide_zero"`
}

type AccountResponse

type AccountResponse struct {
	Address    string    `json:"address"`
	Currencies CoinsInfo `json:"currencies"`
}

func NewAccountResponse

func NewAccountResponse(addr string) AccountResponse

type BaseAccount

type BaseAccount struct {
	Address       sdk.AccAddress `json:"address"`
	Coins         sdk.Coins      `json:"coins"`
	PubKey        crypto.PubKey  `json:"public_key"`
	AccountNumber uint64         `json:"account_number"`
	Sequence      uint64         `json:"sequence"`
}

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

func NewCoinInfo(symbol, available, locked string) *CoinInfo

type CoinsInfo

type CoinsInfo []CoinInfo

func MergeCoinInfo

func MergeCoinInfo(availableCoins, lockedCoins sdk.SysCoins) (coinsInfo CoinsInfo)

func (CoinsInfo) Len

func (d CoinsInfo) Len() int

func (CoinsInfo) Less

func (d CoinsInfo) Less(i, j int) bool

func (CoinsInfo) Swap

func (d CoinsInfo) Swap(i, j int)

type ConfirmOwnership

type ConfirmOwnership struct {
	Symbol  string         `json:"symbol"`
	Address sdk.AccAddress `json:"address"`
	Expire  time.Time      `json:expire`
}

type Currency

type Currency struct {
	Description string  `json:"description"`
	Symbol      string  `json:"symbol"`
	TotalSupply sdk.Dec `json:"total_supply"`
}

func (Currency) String

func (currency Currency) String() string

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) String

func (acc DecAccount) String() string

String implements fmt.Stringer

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 (msg MsgSend) GetSignBytes() []byte

func (MsgSend) GetSigners

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

func (MsgSend) Route

func (msg MsgSend) Route() string

func (MsgSend) Type

func (msg MsgSend) Type() string

func (MsgSend) ValidateBasic

func (msg MsgSend) ValidateBasic() sdk.Error

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 DefaultParams

func DefaultParams() Params

DefaultParams returns a default set of 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

func (Params) String

func (p Params) String() string

String implements the stringer interface.

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
}

func (Token) String

func (token Token) String() string

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

func GenTokenResp(token Token) TokenResp

func (TokenResp) String

func (token TokenResp) String() string

type Tokens

type Tokens []TokenResp

func (Tokens) String

func (tokens Tokens) String() string

type Transfer

type Transfer struct {
	To     string `json:"to"`
	Amount string `json:"amount"`
}

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"}, ...]

Jump to

Keyboard shortcuts

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