types

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// DefaultMaxPriceDigitSize defines default max price digit size
	DefaultMaxPriceDigitSize = 4
	// DefaultMaxQuantityDigitSize defines default max quantity digit size
	DefaultMaxQuantityDigitSize = 4
)
View Source
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"
)
View Source
const (
	// DefaultPage defines default number of page
	DefaultPage = 1
	// DefaultPerPage defines default number per page
	DefaultPerPage = 50
)
View Source
const DefaultWithdrawPeriod = time.Hour * 24 * 3

DefaultWithdrawPeriod defines default withdraw period

View Source
const (
	// TestTokenPairOwner defines owner of token pair, just for test
	TestTokenPairOwner = "okexchain10q0rk5qnyag7wfvvt7rtphlw589m7frsku8qc9"
)

Variables

View Source
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}
)
View Source
var DefaultTokenPairDeposit = sdk.NewDecCoin(sdk.DefaultBondDenom, sdk.NewInt(0))

DefaultTokenPairDeposit defines default deposit of token pair

View Source
var ModuleCdc *codec.Codec

ModuleCdc represents generic sealed codec to be used throughout this module

Functions

func ErrDelistOwnerNotMatch

func ErrDelistOwnerNotMatch(msg string) sdk.Error

ErrDelistOwnerNotMatch returns delist owner not match error

func ErrExistOperator

func ErrExistOperator(addr sdk.AccAddress) sdk.Error

func ErrInvalidAsset

func ErrInvalidAsset(message string) sdk.Error

ErrInvalidAsset returns invalid asset error

func ErrInvalidBalanceNotEnough

func ErrInvalidBalanceNotEnough(message string) sdk.Error

ErrInvalidBalanceNotEnough returns invalid balance not enough error

func ErrInvalidProduct

func ErrInvalidProduct(msg string) sdk.Error

ErrInvalidProduct returns invalid product error

func ErrInvalidWebsiteLength

func ErrInvalidWebsiteLength(got, max int) sdk.Error

func ErrInvalidWebsiteURL

func ErrInvalidWebsiteURL(msg string) sdk.Error

func ErrTokenPairExisted

func ErrTokenPairExisted(baseAsset, quoteAsset string) sdk.Error

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.Error

ErrTokenPairNotFound returns token pair not found error

func ErrUnknownOperator

func ErrUnknownOperator(addr sdk.AccAddress) sdk.Error

func GetKey

func GetKey(it sdk.Iterator) string

GetKey returns keys between index 1 to the end

func GetLockProductKey

func GetLockProductKey(product string) []byte

GetLockProductKey returns key of token pair

func GetOperatorAddressKey

func GetOperatorAddressKey(addr sdk.AccAddress) []byte

GetOperatorAddressKey returns key of operator address

func GetTokenPairAddress

func GetTokenPairAddress(key string) []byte

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

func GetWithdrawTimeKey(completeTime time.Time) []byte

GetWithdrawTimeKey returns key of withdraw time

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 SplitWithdrawTimeKey

func SplitWithdrawTimeKey(key []byte) (time.Time, sdk.AccAddress)

SplitWithdrawTimeKey splits the key and returns the complete time and address

Types

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

func (DEXOperator) String

func (o DEXOperator) String() string

nolint

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

func (msg MsgCreateOperator) Route() string

Route Implements Msg

func (MsgCreateOperator) Type

func (msg MsgCreateOperator) Type() string

Type 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.DecCoin    `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.DecCoin, 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) Route

func (msg MsgDeposit) Route() string

Route Implements Msg

func (MsgDeposit) Type

func (msg MsgDeposit) Type() string

Type 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

func NewMsgList(owner sdk.AccAddress, listAsset, quoteAsset string, initPrice sdk.Dec) MsgList

NewMsgList creates a new MsgList

func (MsgList) GetSignBytes

func (msg MsgList) GetSignBytes() []byte

GetSignBytes Implements Msg

func (MsgList) GetSigners

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

GetSigners Implements Msg

func (MsgList) Route

func (msg MsgList) Route() string

Route Implements Msg

func (MsgList) Type

func (msg MsgList) Type() string

Type Implements Msg

func (MsgList) ValidateBasic

func (msg MsgList) ValidateBasic() sdk.Error

ValidateBasic Implements Msg

type MsgTransferOwnership

type MsgTransferOwnership struct {
	FromAddress sdk.AccAddress    `json:"from_address"`
	ToAddress   sdk.AccAddress    `json:"to_address"`
	Product     string            `json:"product"`
	ToSignature auth.StdSignature `json:"to_signature"`
}

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

func (msg MsgUpdateOperator) Route() string

Route Implements Msg

func (MsgUpdateOperator) Type

func (msg MsgUpdateOperator) Type() string

Type 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.DecCoin    `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.DecCoin, 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) Route

func (msg MsgWithdraw) Route() string

Route Implements Msg

func (MsgWithdraw) Type

func (msg MsgWithdraw) Type() string

Type Implements Msg

func (MsgWithdraw) ValidateBasic

func (msg MsgWithdraw) ValidateBasic() sdk.Error

ValidateBasic Implements Msg

type Params

type Params struct {
	ListFee              sdk.DecCoin `json:"list_fee"`
	TransferOwnershipFee sdk.DecCoin `json:"transfer_ownership_fee"`
	RegisterOperatorFee  sdk.DecCoin `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.DecCoins `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"`
}

Params defines param object

func DefaultParams

func DefaultParams() *Params

DefaultParams returns a default set of parameters.

func (*Params) ParamSetPairs

func (p *Params) ParamSetPairs() subspace.ParamSetPairs

ParamSetPairs implements the ParamSet interface and returns all the key/value pairs

func (Params) String

func (p Params) String() string

String implements the stringer interface.

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

type QueryDexInfoParams struct {
	Owner   string
	Page    int
	PerPage int
}

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.DecCoin    `json:"deposits"`
	BlockHeight      int64          `json:"block_height"`
}

TokenPair represents token pair object

func (*TokenPair) IsGT

func (tp *TokenPair) IsGT(other *TokenPair) bool

IsGT returns true if the token pair is greater than the other one 1. compare deposits 2. compare block height 3. compare name

func (*TokenPair) Name

func (tp *TokenPair) Name() string

Name returns name of token pair

type TokenPairs

type TokenPairs []*TokenPair

TokenPairs represents token pair slice, support sorting

func (TokenPairs) Len

func (tp TokenPairs) Len() int

Len Implements Sort

func (TokenPairs) Less

func (tp TokenPairs) Less(i, j int) bool

Less Implements Sort

func (TokenPairs) Swap

func (tp TokenPairs) Swap(i, j int)

Swap Implements Sort

type WithdrawInfo

type WithdrawInfo struct {
	Owner        sdk.AccAddress `json:"owner"`
	Deposits     sdk.DecCoin    `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

Jump to

Keyboard shortcuts

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