Documentation ¶
Index ¶
- Constants
- Variables
- func ErrDelistOwnerNotMatch(msg string) sdk.EnvelopedErr
- func ErrExistOperator(addr sdk.AccAddress) sdk.EnvelopedErr
- func ErrInvalidAsset(message string) sdk.EnvelopedErr
- func ErrInvalidBalanceNotEnough(message string) sdk.EnvelopedErr
- func ErrInvalidProduct(msg string) sdk.EnvelopedErr
- func ErrInvalidWebsiteLength(got, max int) sdk.EnvelopedErr
- func ErrInvalidWebsiteURL(msg string) sdk.EnvelopedErr
- func ErrTokenPairExisted(baseAsset, quoteAsset string) sdk.EnvelopedErr
- func ErrTokenPairNotFound(msg string) sdk.EnvelopedErr
- func ErrUnknownOperator(addr sdk.AccAddress) sdk.EnvelopedErr
- func GetConfirmOwnershipKey(product string) []byte
- func GetKey(it sdk.Iterator) string
- func GetLockProductKey(product string) []byte
- func GetOperatorAddressKey(addr sdk.AccAddress) []byte
- func GetTokenPairAddress(key string) []byte
- func GetUserTokenPairAddress(owner sdk.AccAddress, assertPair string) []byte
- func GetUserTokenPairAddressPrefix(owner sdk.AccAddress) []byte
- func GetWithdrawAddressKey(addr sdk.AccAddress) []byte
- func GetWithdrawTimeAddressKey(completeTime time.Time, addr sdk.AccAddress) []byte
- func GetWithdrawTimeKey(completeTime time.Time) []byte
- func ParamKeyTable() params.KeyTable
- func RegisterCodec(cdc *codec.Codec)
- func SplitWithdrawTimeKey(key []byte) (time.Time, sdk.AccAddress)
- type ConfirmOwnership
- type DEXOperator
- type DEXOperators
- type DelistProposal
- type MsgConfirmOwnership
- type MsgCreateOperator
- type MsgDeposit
- type MsgList
- type MsgTransferOwnership
- type MsgUpdateOperator
- type MsgWithdraw
- type Params
- type QueryDepositParams
- type QueryDexInfoParams
- type QueryDexOperatorParams
- type TokenPair
- type TokenPairs
- type WithdrawInfo
- type WithdrawInfos
Constants ¶
const ( // DefaultMaxPriceDigitSize defines default max price digit size DefaultMaxPriceDigitSize = 4 // DefaultMaxQuantityDigitSize defines default max quantity digit size DefaultMaxQuantityDigitSize = 4 )
const ( // ModuleName is the name of the dex module ModuleName = "dex" // DefaultParamspace defines default param space DefaultParamspace = ModuleName // DefaultCodespace defines default code space DefaultCodespace = ModuleName // QuerierRoute is the querier route for the dex module QuerierRoute = ModuleName // RouterKey is the msg router key for the dex module RouterKey = ModuleName // StoreKey is the string store representation StoreKey = ModuleName // TokenPairStoreKey is the token pair store key TokenPairStoreKey = "token_pair" // QueryProductsDelisting defines delisting query route path QueryProductsDelisting = "products_delisting" // QueryProducts defines products query route path QueryProducts = "products" // QueryDeposits defines deposits query route path QueryDeposits = "deposits" // QueryMatchOrder defines match-order query route path QueryMatchOrder = "match-order" // QueryParameters defines QueryParameters = "params" query route path QueryParameters = "params" // QueryOperator defines operator query route path QueryOperator = "operator" // QueryOperators defines operators query route path QueryOperators = "operators" )
const ( // DefaultPage defines default number of page DefaultPage = 1 // DefaultPerPage defines default number per page DefaultPerPage = 50 )
const DefaultOwnershipConfirmWindow = 24 * time.Hour
DefaultOwnershipConfirmWindow defines default confirm window
const DefaultWithdrawPeriod = time.Hour * 24 * 3
DefaultWithdrawPeriod defines default withdraw period
const (
// TestTokenPairOwner defines owner of token pair, just for test
TestTokenPairOwner = "okexchain10q0rk5qnyag7wfvvt7rtphlw589m7frsku8qc9"
)
Variables ¶
var ( // TokenPairKey is the store key for token pair TokenPairKey = []byte{0x01} // MaxTokenPairIDKey is the store key for token pair max ID MaxTokenPairIDKey = []byte{0x02} // TokenPairLockKeyPrefix is the store key for token pair prefix TokenPairLockKeyPrefix = []byte{0x03} // DEXOperatorKeyPrefix is the store key prefix for DEXOperator DEXOperatorKeyPrefix = []byte{0x04} // DEXOperatorTokenPairCntPrefix is the store key prefix for DEXOperator's tokenpair count DEXOperatorTokenPairCntPrefix = []byte{0x05} // WithdrawAddressKeyPrefix is the store key for withdraw address WithdrawAddressKeyPrefix = []byte{0x53} // WithdrawTimeKeyPrefix is the store key for withdraw time WithdrawTimeKeyPrefix = []byte{0x54} // UserTokenPairKeyPrefix is the store key for user token pair num UserTokenPairKeyPrefix = []byte{0x06} //the prefix of the confirm ownership key PrefixConfirmOwnershipKey = []byte{0x07} )
var DefaultTokenPairDeposit = sdk.NewDecCoin(sdk.DefaultBondDenom, sdk.NewInt(0))
DefaultTokenPairDeposit defines default deposit of token pair
var ModuleCdc *codec.Codec
ModuleCdc represents generic sealed codec to be used throughout this module
Functions ¶
func ErrDelistOwnerNotMatch ¶
func ErrDelistOwnerNotMatch(msg string) sdk.EnvelopedErr
ErrDelistOwnerNotMatch returns delist owner not match error
func ErrExistOperator ¶
func ErrExistOperator(addr sdk.AccAddress) sdk.EnvelopedErr
func ErrInvalidAsset ¶
func ErrInvalidAsset(message string) sdk.EnvelopedErr
ErrInvalidAsset returns invalid asset error
func ErrInvalidBalanceNotEnough ¶
func ErrInvalidBalanceNotEnough(message string) sdk.EnvelopedErr
ErrInvalidBalanceNotEnough returns invalid balance not enough error
func ErrInvalidProduct ¶
func ErrInvalidProduct(msg string) sdk.EnvelopedErr
ErrInvalidProduct returns invalid product error
func ErrInvalidWebsiteLength ¶
func ErrInvalidWebsiteLength(got, max int) sdk.EnvelopedErr
func ErrInvalidWebsiteURL ¶
func ErrInvalidWebsiteURL(msg string) sdk.EnvelopedErr
func ErrTokenPairExisted ¶
func ErrTokenPairExisted(baseAsset, quoteAsset string) sdk.EnvelopedErr
ErrTokenPairExisted returns an error when the token pair is existed during the process of listing ErrTokenPairExisted returns an error when the token pair is existing during the process of listing
func ErrTokenPairNotFound ¶
func ErrTokenPairNotFound(msg string) sdk.EnvelopedErr
ErrTokenPairNotFound returns token pair not found error
func ErrUnknownOperator ¶
func ErrUnknownOperator(addr sdk.AccAddress) sdk.EnvelopedErr
func GetConfirmOwnershipKey ¶ added in v0.13.0
func GetLockProductKey ¶
GetLockProductKey returns key of token pair
func GetOperatorAddressKey ¶
func GetOperatorAddressKey(addr sdk.AccAddress) []byte
GetOperatorAddressKey returns key of operator address
func GetTokenPairAddress ¶
GetTokenPairAddress returns store key of token pair
func GetUserTokenPairAddress ¶
func GetUserTokenPairAddress(owner sdk.AccAddress, assertPair string) []byte
GetUserTokenPairAddress returns token pair address key
func GetUserTokenPairAddressPrefix ¶
func GetUserTokenPairAddressPrefix(owner sdk.AccAddress) []byte
GetUserTokenPairAddressPrefix returns token pair address prefix key
func GetWithdrawAddressKey ¶
func GetWithdrawAddressKey(addr sdk.AccAddress) []byte
GetWithdrawAddressKey returns key of withdraw address
func GetWithdrawTimeAddressKey ¶
func GetWithdrawTimeAddressKey(completeTime time.Time, addr sdk.AccAddress) []byte
GetWithdrawTimeAddressKey returns withdraw time address key
func GetWithdrawTimeKey ¶
GetWithdrawTimeKey returns key of withdraw time
func RegisterCodec ¶
RegisterCodec registers concrete types on the Amino codec
func SplitWithdrawTimeKey ¶
func SplitWithdrawTimeKey(key []byte) (time.Time, sdk.AccAddress)
SplitWithdrawTimeKey splits the key and returns the complete time and address
Types ¶
type ConfirmOwnership ¶ added in v0.13.0
type ConfirmOwnership struct { Product string `json:"product"` FromAddress sdk.AccAddress `json:"from_address"` ToAddress sdk.AccAddress `json:"to_address"` Expire time.Time `json:expire` }
type DEXOperator ¶
type DEXOperator struct { Address sdk.AccAddress `json:"address"` HandlingFeeAddress sdk.AccAddress `json:"handling_fee_address"` Website string `json:"website"` InitHeight int64 `json:"init_height"` TxHash string `json:"tx_hash"` }
OperatorAddress sdk.ValAddress `json:"operator_address" yaml:"operator_address"`
type DEXOperators ¶
type DEXOperators []DEXOperator
func (DEXOperators) String ¶
func (o DEXOperators) String() string
type DelistProposal ¶
type DelistProposal struct { Title string `json:"title" yaml:"title"` Description string `json:"description" yaml:"description"` Proposer sdk.AccAddress `json:"proposer" yaml:"proposer"` BaseAsset string `json:"base_asset" yaml:"base_asset"` QuoteAsset string `json:"quote_asset" yaml:"quote_asset"` }
DelistProposal represents delist proposal object
func NewDelistProposal ¶
func NewDelistProposal(title, description string, proposer sdk.AccAddress, baseAsset, quoteAsset string) DelistProposal
NewDelistProposal create a new delist proposal object
func (DelistProposal) GetDescription ¶
func (drp DelistProposal) GetDescription() string
GetDescription returns description of delist proposal object
func (DelistProposal) GetTitle ¶
func (drp DelistProposal) GetTitle() string
GetTitle returns title of delist proposal object
func (DelistProposal) ProposalRoute ¶
func (DelistProposal) ProposalRoute() string
ProposalRoute returns route key of delist proposal object
func (DelistProposal) ProposalType ¶
func (DelistProposal) ProposalType() string
ProposalType returns type of delist proposal object
func (DelistProposal) String ¶
func (drp DelistProposal) String() string
String converts delist proposal object to string
func (DelistProposal) ValidateBasic ¶
func (drp DelistProposal) ValidateBasic() sdk.Error
ValidateBasic validates delist proposal
type MsgConfirmOwnership ¶ added in v0.13.0
type MsgConfirmOwnership struct { Product string `json:"product"` Address sdk.AccAddress `json:"new_owner"` }
MsgConfirmOwnership - high level transaction of the coin module
func NewMsgConfirmOwnership ¶ added in v0.13.0
func NewMsgConfirmOwnership(newOwner sdk.AccAddress, product string) MsgConfirmOwnership
func (MsgConfirmOwnership) GetSignBytes ¶ added in v0.13.0
func (msg MsgConfirmOwnership) GetSignBytes() []byte
func (MsgConfirmOwnership) GetSigners ¶ added in v0.13.0
func (msg MsgConfirmOwnership) GetSigners() []sdk.AccAddress
func (MsgConfirmOwnership) Route ¶ added in v0.13.0
func (msg MsgConfirmOwnership) Route() string
func (MsgConfirmOwnership) Type ¶ added in v0.13.0
func (msg MsgConfirmOwnership) Type() string
func (MsgConfirmOwnership) ValidateBasic ¶ added in v0.13.0
func (msg MsgConfirmOwnership) ValidateBasic() sdk.Error
type MsgCreateOperator ¶
type MsgCreateOperator struct { Owner sdk.AccAddress `json:"owner"` Website string `json:"website"` HandlingFeeAddress sdk.AccAddress `json:"handling_fee_address"` }
MsgCreateOperator register a new DEXOperator or update it Addr represent an DEXOperator if DEXOperator not exist, register a new DEXOperator else update Website or HandlingFeeAddress
func NewMsgCreateOperator ¶
func NewMsgCreateOperator(website string, owner, handlingFeeAddress sdk.AccAddress) MsgCreateOperator
NewMsgCreateOperator creates a new MsgCreateOperator
func (MsgCreateOperator) GetSignBytes ¶
func (msg MsgCreateOperator) GetSignBytes() []byte
GetSignBytes Implements Msg
func (MsgCreateOperator) GetSigners ¶
func (msg MsgCreateOperator) GetSigners() []sdk.AccAddress
GetSigners Implements Msg
func (MsgCreateOperator) ValidateBasic ¶
func (msg MsgCreateOperator) ValidateBasic() sdk.Error
ValidateBasic Implements Msg
type MsgDeposit ¶
type MsgDeposit struct { Product string `json:"product"` // product for trading pair in full name of the tokens Amount sdk.SysCoin `json:"amount"` // Coins to add to the deposit Depositor sdk.AccAddress `json:"depositor"` // Address of the depositor }
MsgDeposit - high level transaction of the dex module
func NewMsgDeposit ¶
func NewMsgDeposit(product string, amount sdk.SysCoin, depositor sdk.AccAddress) MsgDeposit
NewMsgDeposit creates a new MsgDeposit
func (MsgDeposit) GetSignBytes ¶
func (msg MsgDeposit) GetSignBytes() []byte
GetSignBytes Implements Msg
func (MsgDeposit) GetSigners ¶
func (msg MsgDeposit) GetSigners() []sdk.AccAddress
GetSigners Implements Msg
func (MsgDeposit) ValidateBasic ¶
func (msg MsgDeposit) ValidateBasic() sdk.Error
ValidateBasic Implements Msg
type MsgList ¶
type MsgList struct { Owner sdk.AccAddress `json:"owner"` ListAsset string `json:"list_asset"` // Symbol of asset listed on Dex. QuoteAsset string `json:"quote_asset"` // Symbol of asset quoted by asset listed on Dex. InitPrice sdk.Dec `json:"init_price"` }
MsgList - high level transaction of the dex module
func NewMsgList ¶
NewMsgList creates a new MsgList
func (MsgList) GetSigners ¶
func (msg MsgList) GetSigners() []sdk.AccAddress
GetSigners Implements Msg
func (MsgList) ValidateBasic ¶
ValidateBasic Implements Msg
type MsgTransferOwnership ¶
type MsgTransferOwnership struct { FromAddress sdk.AccAddress `json:"from_address"` ToAddress sdk.AccAddress `json:"to_address"` Product string `json:"product"` }
MsgTransferOwnership - high level transaction of the dex module
func NewMsgTransferOwnership ¶
func NewMsgTransferOwnership(from, to sdk.AccAddress, product string) MsgTransferOwnership
NewMsgTransferOwnership create a new MsgTransferOwnership
func (MsgTransferOwnership) GetSignBytes ¶
func (msg MsgTransferOwnership) GetSignBytes() []byte
GetSignBytes Implements Msg
func (MsgTransferOwnership) GetSigners ¶
func (msg MsgTransferOwnership) GetSigners() []sdk.AccAddress
GetSigners Implements Msg
func (MsgTransferOwnership) Route ¶
func (msg MsgTransferOwnership) Route() string
Route Implements Msg
func (MsgTransferOwnership) Type ¶
func (msg MsgTransferOwnership) Type() string
Type Implements Msg
func (MsgTransferOwnership) ValidateBasic ¶
func (msg MsgTransferOwnership) ValidateBasic() sdk.Error
ValidateBasic Implements Msg
type MsgUpdateOperator ¶
type MsgUpdateOperator struct { Owner sdk.AccAddress `json:"owner"` Website string `json:"website"` HandlingFeeAddress sdk.AccAddress `json:"handling_fee_address"` }
MsgUpdateOperator register a new DEXOperator or update it Addr represent an DEXOperator if DEXOperator not exist, register a new DEXOperator else update Website or HandlingFeeAddress
func NewMsgUpdateOperator ¶
func NewMsgUpdateOperator(website string, owner, handlingFeeAddress sdk.AccAddress) MsgUpdateOperator
NewMsgUpdateOperator creates a new MsgUpdateOperator
func (MsgUpdateOperator) GetSignBytes ¶
func (msg MsgUpdateOperator) GetSignBytes() []byte
GetSignBytes Implements Msg
func (MsgUpdateOperator) GetSigners ¶
func (msg MsgUpdateOperator) GetSigners() []sdk.AccAddress
GetSigners Implements Msg
func (MsgUpdateOperator) ValidateBasic ¶
func (msg MsgUpdateOperator) ValidateBasic() sdk.Error
ValidateBasic Implements Msg
type MsgWithdraw ¶
type MsgWithdraw struct { Product string `json:"product"` // product for trading pair in full name of the tokens Amount sdk.SysCoin `json:"amount"` // Coins to add to the deposit Depositor sdk.AccAddress `json:"depositor"` // Address of the depositor }
MsgWithdraw - high level transaction of the dex module
func NewMsgWithdraw ¶
func NewMsgWithdraw(product string, amount sdk.SysCoin, depositor sdk.AccAddress) MsgWithdraw
NewMsgWithdraw creates a new MsgWithdraw
func (MsgWithdraw) GetSignBytes ¶
func (msg MsgWithdraw) GetSignBytes() []byte
GetSignBytes Implements Msg
func (MsgWithdraw) GetSigners ¶
func (msg MsgWithdraw) GetSigners() []sdk.AccAddress
GetSigners Implements Msg
func (MsgWithdraw) ValidateBasic ¶
func (msg MsgWithdraw) ValidateBasic() sdk.Error
ValidateBasic Implements Msg
type Params ¶
type Params struct { ListFee sdk.SysCoin `json:"list_fee"` TransferOwnershipFee sdk.SysCoin `json:"transfer_ownership_fee"` RegisterOperatorFee sdk.SysCoin `json:"register_operator_fee"` // maximum period for okt holders to deposit on a dex delist proposal DelistMaxDepositPeriod time.Duration `json:"delist_max_deposit_period"` // minimum deposit for a critical dex delist proposal to enter voting period DelistMinDeposit sdk.SysCoins `json:"delist_min_deposit"` // length of the critical voting period for dex delist proposal DelistVotingPeriod time.Duration `json:"delist_voting_period"` WithdrawPeriod time.Duration `json:"withdraw_period"` OwnershipConfirmWindow time.Duration `json:"ownership_confirm_window"` }
Params defines param object
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
type QueryDepositParams ¶
type QueryDepositParams struct { Address string BaseAsset string QuoteAsset string Page int PerPage int }
nolint
func NewQueryDepositParams ¶
func NewQueryDepositParams(address, baseAsset, quoteAsset string, page, perPage int) QueryDepositParams
NewQueryDepositParams creates a new instance of QueryDepositParams
type QueryDexInfoParams ¶
QueryDexInfoParams defines query params of dex info
func NewQueryDexInfoParams ¶
func NewQueryDexInfoParams(owner string, page, perPage int) QueryDexInfoParams
NewQueryDexInfoParams creates query params of dex info
type QueryDexOperatorParams ¶
type QueryDexOperatorParams struct {
Addr sdk.AccAddress
}
func NewQueryDexOperatorParams ¶
func NewQueryDexOperatorParams(addr sdk.AccAddress) QueryDexOperatorParams
creates a new instance of QueryDexOperatorParams
type TokenPair ¶
type TokenPair struct { BaseAssetSymbol string `json:"base_asset_symbol"` QuoteAssetSymbol string `json:"quote_asset_symbol"` InitPrice sdk.Dec `json:"price"` MaxPriceDigit int64 `json:"max_price_digit"` MaxQuantityDigit int64 `json:"max_size_digit"` MinQuantity sdk.Dec `json:"min_trade_size"` ID uint64 `json:"token_pair_id"` Delisting bool `json:"delisting"` Owner sdk.AccAddress `json:"owner"` Deposits sdk.SysCoin `json:"deposits"` BlockHeight int64 `json:"block_height"` }
TokenPair represents token pair object
type TokenPairs ¶
type TokenPairs []*TokenPair
TokenPairs represents token pair slice, support sorting
type WithdrawInfo ¶
type WithdrawInfo struct { Owner sdk.AccAddress `json:"owner"` Deposits sdk.SysCoin `json:"deposits"` CompleteTime time.Time `json:"complete_time"` }
WithdrawInfo represents infos for withdrawing
func (WithdrawInfo) Equal ¶
func (w WithdrawInfo) Equal(other WithdrawInfo) bool
Equal returns boolean for whether two WithdrawInfo are Equal
type WithdrawInfos ¶
type WithdrawInfos []WithdrawInfo
WithdrawInfos defines list of WithdrawInfo
func (WithdrawInfos) Equal ¶
func (ws WithdrawInfos) Equal(other WithdrawInfos) bool
Equal returns boolean for whether two WithdrawInfos are Equal