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: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventTypeCreateDex            = "create_dex"
	EventTypeEditDex              = "edit_dex"
	EventTypeCreateTradingPair    = "create_trading_pair"
	EventTypeEditTradingPair      = "edit_trading_pair"
	EventTypeAddLiquidity         = "add_liquidity"
	EventTypeRemoveLiquidity      = "remove_liquidity"
	EventTypeSwap                 = "swap"
	EventTypeCancelOrders         = "cancel_orders"
	EventTypeExpireOrders         = "expire_orders"
	EventTypeWithdrawLPEarning    = "withdraw_lp_earning"
	EventTypeWithdrawTradeEarning = "withdraw_trade_earning"
	EventTypeMining               = "mining"
	EventTypeRepurchase           = "repurchase"

	AttributeKeyDexID           = "dex_id"
	AttributeKeyTokenA          = "token_a"
	AttributeKeyTokenB          = "token_b"
	AttributeKeyLiquidity       = "liquidity"
	AttributeKeySwapResult      = "swap"
	AttributeKeyBurned          = "burned"
	AttributeKeyOrders          = "orders"
	AttributeKeyLPAmount        = "lp_amount"
	AttributeKeyTradeAmount     = "trade_amount"
	AttributeKeyValidatorAmount = "validator_amount"
	AttributeKeyAddress         = "address"
	AttributeKeyAmount          = "amount"
	AttributeKeySymbol          = "symbol"
)
View Source
const (
	// ModuleName is the name of this module
	ModuleName = "openswap"

	// RouterKey is used to route governance proposals
	RouterKey = ModuleName

	// StoreKey is the prefix under which we store this module's data
	StoreKey = ModuleName

	// QuerierKey is used to handle abci_query requests
	QuerierKey = ModuleName

	// DefaultParamspace default name for parameter store
	DefaultParamspace = ModuleName

	BonusCollectorName = "openswap_collector"
)
View Source
const (
	TypeMsgCreateDex         = "createdex"
	TypeMsgEditDex           = "editdex"
	TypeMsgCreateTradingPair = "createtradingpair"
	TypeMsgEditTradingPair   = "edittradingpair"
	TypeMsgAddLiquidity      = "addliquidity"
	TypeMsgRemoveLiquidity   = "removeliquidity"
	TypeMsgSwapExactIn       = "swapexactin"
	TypeMsgSwapExactOut      = "swapexactout"
	TypeMsgLimitSwap         = "limitswap"
	TypeMsgCancelLimitSwap   = "cancellimitswap"
	TypeMsgClaimLpEarning    = "withdrawlpearning"
	TypeMsgClaimTradeEarning = "withdrawtradeearning"
)
View Source
const (
	OrderStatusNew             = 0x00
	OrderStatusPartiallyFilled = 0x01
	OrderStatusFilled          = 0x02
	OrderStatusCanceled        = 0x03
	OrderStatusExpired         = 0x04
)
View Source
const (
	OrderSideBuy  = 0x0
	OrderSideSell = 0x1
)
View Source
const (
	QueryDex               = "dex"
	QueryAllDex            = "all-dex"
	QueryTradingPair       = "trading_pair"
	QueryAllTradingPair    = "all_trading_pair"
	QueryAddrLiquidity     = "addr_liquidity"
	QueryOrderbook         = "orderbook"
	QueryOrder             = "order"
	QueryUnfinishedOrder   = "unfinished_order"
	QueryUnclaimedEarnings = "unclaimed_earnings"
	QueryRepurchaseFunds   = "repurchase_funds"
	QueryParameters        = "parameters"
)

query endpoints supported by the upgrade Querier

Variables

View Source
var (
	DexKeyPrefix                = []byte{0x00}
	DexIDKey                    = []byte{0x01}
	TradingPairKeyPrefix        = []byte{0x02}
	LiquidityKeyPrefix          = []byte{0x03}
	OrderKeyPrefix              = []byte{0x04}
	UnfinishedOrderKeyPrefix    = []byte{0x05}
	WaitToInsertMatchingKey     = []byte{0x06}
	WaitToRemoveFromMatchingKey = []byte{0x07}
	RefererKeyPrefix            = []byte{0x08}
	TotalShareKeyPrefix         = []byte{0x09}
	GlobalMaskKeyPrefix         = []byte{0x0a}
	AddrMaskKeyPrefix           = []byte{0x0b}
	RepurchaseFundKeyPrefix     = []byte{0x0c}
	PairTradeRewardKeyPrefix    = []byte{0x0d}
	AddrTradeVolumeKeyPrefix    = []byte{0x0e}
)
View Source
var (
	DefaultMinimumLiquidity            = sdk.NewInt(1000)
	DefaultLimitSwapMatchingGas        = sdk.NewUint(50000)
	DefaultMaxFeeRate                  = sdk.NewDecWithPrec(1, 1)   // 0.1
	DefaultLpRewardRate                = sdk.NewDecWithPrec(125, 5) // 0.00125
	DefaultRefererTransactionBonusRate = sdk.NewDecWithPrec(0, 4)   // 0.0001
	DefaultRepurchaseRate              = sdk.NewDecWithPrec(125, 5) // 0.00125
	DefaultRepurchaseDuration          = int64(1000)
	DefaultRepurchaseToken             = sdk.NativeToken
	DefaultRepurchaseRoutingToken      = tokentypes.CalSymbol("usdt", sdk.NativeToken).String()
	DefaultLPMiningWeights             = []*MiningWeight{}
	DefaultTradeMiningWeights          = []*MiningWeight{}
	DefaultLPMiningRewardRate          = sdk.NewDecWithPrec(9, 1) // 0.9
)
View Source
var (
	KeyMinimumLiquidity            = []byte("MinimumLiquidity")
	KeyLimitSwapMatchingGas        = []byte("LimitSwapMatchingGas")
	KeyMaxFeeRate                  = []byte("MaxFeeRate")
	KeyLpRewardRate                = []byte("LpRewardRate")
	KeyRepurchaseRate              = []byte("RepurchaseRate")
	KeyRefererTransactionBonusRate = []byte("RefererTransactionBonusRate")
	KeyRepurchaseDuration          = []byte("RepurchaseDuration")
	KeyRepurchaseToken             = []byte("RepurchaseToken")
	KeyRepurchaseRoutingToken      = []byte("RepurchaseRoutingToken")
	KeyLPMiningWeights             = []byte("LPMiningWeights")
	KeyTradeMiningWeights          = []byte("TradeMiningWeights")
	KeyLPMiningRewardRate          = []byte("LPMiningRewardRate")
)
View Source
var (
	ModuleCUAddress = sdk.CUAddress(crypto.AddressHash([]byte(ModuleName)))
)
View Source
var ModuleCdc = codec.New()

Functions

func AddrLiquidityKeyPrefix

func AddrLiquidityKeyPrefix(addr sdk.CUAddress) []byte

func AddrLiquidityKeyPrefixWithDexID

func AddrLiquidityKeyPrefixWithDexID(addr sdk.CUAddress, dexID uint32) []byte

func AddrMaskKey

func AddrMaskKey(addr sdk.CUAddress, dexID uint32, tokenA, tokenB sdk.Symbol) []byte

func AddrTradeVolumeKey

func AddrTradeVolumeKey(addr sdk.CUAddress, dexID uint32, tokenA, tokenB sdk.Symbol) []byte

func AddrTradeVolumeKeyWithAddrPrefix

func AddrTradeVolumeKeyWithAddrPrefix(addr sdk.CUAddress) []byte

func AddrTradeVolumeKeyWithDexID

func AddrTradeVolumeKeyWithDexID(addr sdk.CUAddress, dexID uint32) []byte

func DecodeAddrTradeVolumeKey

func DecodeAddrTradeVolumeKey(key []byte) (uint32, sdk.Symbol, sdk.Symbol)

func DecodeLiquidityKey

func DecodeLiquidityKey(key []byte) (uint32, sdk.Symbol, sdk.Symbol)

func DexKey

func DexKey(dexID uint32) []byte

func GetOrderIDFromUnfinishedOrderKey

func GetOrderIDFromUnfinishedOrderKey(key []byte) string

func GetSymbolFromRepurchaseFundKey

func GetSymbolFromRepurchaseFundKey(key []byte) string

func GlobalMaskKey

func GlobalMaskKey(dexID uint32, tokenA, tokenB sdk.Symbol) []byte

func LiquidityKey

func LiquidityKey(addr sdk.CUAddress, dexID uint32, tokenA, tokenB sdk.Symbol) []byte

func OrderKey

func OrderKey(orderID string) []byte

func PairTradeRewardKey

func PairTradeRewardKey(dexID uint32, tokenA, tokenB sdk.Symbol) []byte

func RefererKey

func RefererKey(addr sdk.CUAddress) []byte

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

Register concrete types on codec codec

func RepurchaseFundKey

func RepurchaseFundKey(symbol string) []byte

func TotalShareKey

func TotalShareKey(dexID uint32, tokenA, tokenB sdk.Symbol) []byte

func TradingPairKey

func TradingPairKey(dexID uint32, tokenA, tokenB sdk.Symbol) []byte

func TradingPairKeyPrefixWithDexID

func TradingPairKeyPrefixWithDexID(dexID uint32) []byte

func UnfinishedOrderKey

func UnfinishedOrderKey(order *Order) []byte

func UnfinishedOrderKeyPrefixWithAddr

func UnfinishedOrderKeyPrefixWithAddr(addr sdk.CUAddress) []byte

func UnfinishedOrderKeyPrefixWithPair

func UnfinishedOrderKeyPrefixWithPair(addr sdk.CUAddress, dexID uint32, baseSymbol, quoteSymbol sdk.Symbol) []byte

Types

type AddrLiquidity

type AddrLiquidity struct {
	*TradingPair   `json:"trading_pair"`
	Liquidity      sdk.Int `json:"liquidity"`
	LiquidityShare sdk.Dec `json:"liquidity_share"`
}

func NewAddrLiquidity

func NewAddrLiquidity(pair *TradingPair, liquidity sdk.Int) *AddrLiquidity

type DepthBook

type DepthBook struct {
	Height int64      `json:"h"`
	Time   int64      `json:"t"`
	Market string     `json:"m"`
	Bids   [][]string `json:"bids"`
	Asks   [][]string `json:"asks"`
}

func NewDepthBook

func NewDepthBook(height, time int64, market string, buyOrders, sellOrders []*Order) *DepthBook

type Dex

type Dex struct {
	ID             uint32        `json:"id"`
	Name           string        `json:"name"`
	Owner          sdk.CUAddress `json:"owner"`
	IncomeReceiver sdk.CUAddress `json:"income_receiver"`
}

func (*Dex) Validate

func (d *Dex) Validate() error

type Earning

type Earning struct {
	DexID                  uint32     `json:"dex_id"`
	TokenA                 sdk.Symbol `json:"token_a"`
	TokenB                 sdk.Symbol `json:"token_b"`
	Amount                 sdk.Int    `json:"amount"`
	UnclaimedTradingVolume sdk.Int    `json:"unclaimed_trading_volume"`
}

func NewEarning

func NewEarning(dexID uint32, tokenA, tokenB sdk.Symbol, amount, unclaimedTradingVolume sdk.Int) *Earning

type EventLiquidity

type EventLiquidity struct {
	From                sdk.CUAddress `json:"from"`
	DexID               uint32        `json:"dex_id"`
	TokenA              sdk.Symbol    `json:"token_a"`
	TokenB              sdk.Symbol    `json:"token_b"`
	TokenAAmount        sdk.Int       `json:"token_a_amount"`
	TokenBAmount        sdk.Int       `json:"token_b_amount"`
	ChangedTokenAAmount sdk.Int       `json:"changed_a_amount"`
	ChangedTokenBAmount sdk.Int       `json:"changed_b_amount"`
}

func NewEventLiquidity

func NewEventLiquidity(from sdk.CUAddress, dexID uint32, tokenA, tokenB sdk.Symbol, tokenAAmount, tokenBAmount, changedAAmount, changedBAmount sdk.Int) *EventLiquidity

func (*EventLiquidity) String

func (e *EventLiquidity) String() string

type EventOrderStatusChanged

type EventOrderStatusChanged struct {
	OrderIDs []string `json:"order_ids"`
}

func NewEventOrderStatusChanged

func NewEventOrderStatusChanged(orderIDs []string) *EventOrderStatusChanged

func (*EventOrderStatusChanged) String

func (e *EventOrderStatusChanged) String() string

type EventSwap

type EventSwap struct {
	From         sdk.CUAddress `json:"from"`
	OrderID      string        `json:"order_id"`
	DexID        uint32        `json:"dex_id"`
	TokenA       sdk.Symbol    `json:"token_a"`
	TokenB       sdk.Symbol    `json:"token_b"`
	TokenAAmount sdk.Int       `json:"token_a_amount"`
	TokenBAmount sdk.Int       `json:"token_b_amount"`
	TokenIn      sdk.Symbol    `json:"token_in"`
	AmountIn     sdk.Int       `json:"amount_in"`
	AmountOut    sdk.Int       `json:"amount_out"`
}

func NewEventSwap

func NewEventSwap(from sdk.CUAddress, orderID string, dexID uint32, tokenA, tokenB, tokenIn sdk.Symbol,
	tokenAAmount, tokenBAmount, amountIn, amountOut sdk.Int) *EventSwap

type EventSwaps

type EventSwaps []*EventSwap

func (*EventSwaps) String

func (e *EventSwaps) String() string

type FeeRate

type FeeRate struct {
	LPRewardRate      sdk.Dec `json:"lp_reward_rate"`
	RepurchaseRate    sdk.Dec `json:"repurchase_rate"`
	RefererRewardRate sdk.Dec `json:"referer_reward_rate"`
}

func NewFeeRate

func NewFeeRate(lpRewardRate, repurchaseRate, refererRewardRate sdk.Dec) *FeeRate

func (*FeeRate) TotalFeeRate

func (f *FeeRate) TotalFeeRate() sdk.Dec

type MiningWeight

type MiningWeight struct {
	DexID  uint32     `json:"dex_id"`
	TokenA sdk.Symbol `json:"token_a"`
	TokenB sdk.Symbol `json:"token_b"`
	Weight sdk.Int    `json:"weight"`
}

func NewMiningWeight

func NewMiningWeight(dexID uint32, tokenA, tokenB sdk.Symbol, weight sdk.Int) *MiningWeight

type MsgAddLiquidity

type MsgAddLiquidity struct {
	From            sdk.CUAddress `json:"from"`
	DexID           uint32        `json:"dex_id"`
	TokenA          sdk.Symbol    `json:"token_a"`
	TokenB          sdk.Symbol    `json:"token_b"`
	TokenAAmount    sdk.Int       `json:"token_a_amount"`
	TokenBAmount    sdk.Int       `json:"token_b_amount"`
	MinTokenAAmount sdk.Int       `json:"min_token_a_amount"`
	MinTokenBAmount sdk.Int       `json:"min_token_b_amount"`
	ExpiredAt       int64         `json:"expired_at"`
}

func NewMsgAddLiquidity

func NewMsgAddLiquidity(from sdk.CUAddress, dexID uint32, tokenA, tokenB sdk.Symbol,
	tokenAAmount, tokenBAmount, minTokenAAmount, minTokenBAmount sdk.Int, expiredAt int64) MsgAddLiquidity

func (MsgAddLiquidity) GetSignBytes

func (msg MsgAddLiquidity) GetSignBytes() []byte

func (MsgAddLiquidity) GetSigners

func (msg MsgAddLiquidity) GetSigners() []sdk.CUAddress

func (MsgAddLiquidity) Route

func (msg MsgAddLiquidity) Route() string

func (MsgAddLiquidity) Type

func (msg MsgAddLiquidity) Type() string

func (MsgAddLiquidity) ValidateBasic

func (msg MsgAddLiquidity) ValidateBasic() sdk.Error

type MsgCancelLimitSwap

type MsgCancelLimitSwap struct {
	From     sdk.CUAddress `json:"from"`
	OrderIDs []string      `json:"order_ids"`
}

func NewMsgCancelLimitSwap

func NewMsgCancelLimitSwap(from sdk.CUAddress, orderIDs []string) MsgCancelLimitSwap

func (MsgCancelLimitSwap) GetSignBytes

func (msg MsgCancelLimitSwap) GetSignBytes() []byte

func (MsgCancelLimitSwap) GetSigners

func (msg MsgCancelLimitSwap) GetSigners() []sdk.CUAddress

func (MsgCancelLimitSwap) Route

func (msg MsgCancelLimitSwap) Route() string

func (MsgCancelLimitSwap) Type

func (msg MsgCancelLimitSwap) Type() string

func (MsgCancelLimitSwap) ValidateBasic

func (msg MsgCancelLimitSwap) ValidateBasic() sdk.Error

type MsgClaimLPEarning

type MsgClaimLPEarning struct {
	From   sdk.CUAddress `json:"from"`
	DexID  uint32        `json:"dex_id"`
	TokenA sdk.Symbol    `json:"token_a"`
	TokenB sdk.Symbol    `json:"token_b"`
}

func NewMsgClaimLPEarning

func NewMsgClaimLPEarning(from sdk.CUAddress, dexID uint32, tokenA, tokenB sdk.Symbol) MsgClaimLPEarning

func (MsgClaimLPEarning) GetSignBytes

func (msg MsgClaimLPEarning) GetSignBytes() []byte

func (MsgClaimLPEarning) GetSigners

func (msg MsgClaimLPEarning) GetSigners() []sdk.CUAddress

func (MsgClaimLPEarning) Route

func (msg MsgClaimLPEarning) Route() string

func (MsgClaimLPEarning) Type

func (msg MsgClaimLPEarning) Type() string

func (MsgClaimLPEarning) ValidateBasic

func (msg MsgClaimLPEarning) ValidateBasic() sdk.Error

type MsgClaimTradeEarning

type MsgClaimTradeEarning struct {
	From   sdk.CUAddress `json:"from"`
	DexID  uint32        `json:"dex_id"`
	TokenA sdk.Symbol    `json:"token_a"`
	TokenB sdk.Symbol    `json:"token_b"`
}

func NewMsgClaimTradeEarning

func NewMsgClaimTradeEarning(from sdk.CUAddress, dexID uint32, tokenA, tokenB sdk.Symbol) MsgClaimTradeEarning

func (MsgClaimTradeEarning) GetSignBytes

func (msg MsgClaimTradeEarning) GetSignBytes() []byte

func (MsgClaimTradeEarning) GetSigners

func (msg MsgClaimTradeEarning) GetSigners() []sdk.CUAddress

func (MsgClaimTradeEarning) Route

func (msg MsgClaimTradeEarning) Route() string

func (MsgClaimTradeEarning) Type

func (msg MsgClaimTradeEarning) Type() string

func (MsgClaimTradeEarning) ValidateBasic

func (msg MsgClaimTradeEarning) ValidateBasic() sdk.Error

type MsgCreateDex

type MsgCreateDex struct {
	From           sdk.CUAddress `json:"from"`
	Name           string        `json:"name"`
	IncomeReceiver sdk.CUAddress `json:"income_receiver"`
}

func NewMsgCreateDex

func NewMsgCreateDex(from sdk.CUAddress, name string, incomeReceiver sdk.CUAddress) MsgCreateDex

func (MsgCreateDex) GetSignBytes

func (msg MsgCreateDex) GetSignBytes() []byte

func (MsgCreateDex) GetSigners

func (msg MsgCreateDex) GetSigners() []sdk.CUAddress

func (MsgCreateDex) Route

func (msg MsgCreateDex) Route() string

func (MsgCreateDex) Type

func (msg MsgCreateDex) Type() string

func (MsgCreateDex) ValidateBasic

func (msg MsgCreateDex) ValidateBasic() sdk.Error

type MsgCreateTradingPair

type MsgCreateTradingPair struct {
	From              sdk.CUAddress `json:"from"`
	DexID             uint32        `json:"dex_id"`
	TokenA            sdk.Symbol    `json:"token_a"`
	TokenB            sdk.Symbol    `json:"token_b"`
	IsPublic          bool          `json:"is_public"`
	LPRewardRate      sdk.Dec       `json:"lp_reward_rate"`
	RefererRewardRate sdk.Dec       `json:"referer_reward_rate"`
}

func NewMsgCreateTradingPair

func NewMsgCreateTradingPair(from sdk.CUAddress, dexID uint32, tokenA, tokenB sdk.Symbol, isPublic bool, lpReward, refererReward sdk.Dec) MsgCreateTradingPair

func (MsgCreateTradingPair) GetSignBytes

func (msg MsgCreateTradingPair) GetSignBytes() []byte

func (MsgCreateTradingPair) GetSigners

func (msg MsgCreateTradingPair) GetSigners() []sdk.CUAddress

func (MsgCreateTradingPair) Route

func (msg MsgCreateTradingPair) Route() string

func (MsgCreateTradingPair) Type

func (msg MsgCreateTradingPair) Type() string

func (MsgCreateTradingPair) ValidateBasic

func (msg MsgCreateTradingPair) ValidateBasic() sdk.Error

type MsgEditDex

type MsgEditDex struct {
	From           sdk.CUAddress  `json:"from"`
	DexID          uint32         `json:"dex_id"`
	Name           string         `json:"name"`
	IncomeReceiver *sdk.CUAddress `json:"income_receiver,omitempty"`
}

func NewMsgEditDex

func NewMsgEditDex(from sdk.CUAddress, dexID uint32, name string, incomeReceiver *sdk.CUAddress) MsgEditDex

func (MsgEditDex) GetSignBytes

func (msg MsgEditDex) GetSignBytes() []byte

func (MsgEditDex) GetSigners

func (msg MsgEditDex) GetSigners() []sdk.CUAddress

func (MsgEditDex) Route

func (msg MsgEditDex) Route() string

func (MsgEditDex) Type

func (msg MsgEditDex) Type() string

func (MsgEditDex) ValidateBasic

func (msg MsgEditDex) ValidateBasic() sdk.Error

type MsgEditTradingPair

type MsgEditTradingPair struct {
	From              sdk.CUAddress `json:"from"`
	DexID             uint32        `json:"dex_id"`
	TokenA            sdk.Symbol    `json:"token_a"`
	TokenB            sdk.Symbol    `json:"token_b"`
	IsPublic          *bool         `json:"is_public,omitempty"`
	LPRewardRate      *sdk.Dec      `json:"lp_reward_rate,omitempty"`
	RefererRewardRate *sdk.Dec      `json:"referer_reward_rate,omitempty"`
}

func NewMsgEditTradingPair

func NewMsgEditTradingPair(from sdk.CUAddress, dexID uint32, tokenA, tokenB sdk.Symbol, isPublic *bool, lpReward, refererReward *sdk.Dec) MsgEditTradingPair

func (MsgEditTradingPair) GetSignBytes

func (msg MsgEditTradingPair) GetSignBytes() []byte

func (MsgEditTradingPair) GetSigners

func (msg MsgEditTradingPair) GetSigners() []sdk.CUAddress

func (MsgEditTradingPair) Route

func (msg MsgEditTradingPair) Route() string

func (MsgEditTradingPair) Type

func (msg MsgEditTradingPair) Type() string

func (MsgEditTradingPair) ValidateBasic

func (msg MsgEditTradingPair) ValidateBasic() sdk.Error

type MsgLimitSwap

type MsgLimitSwap struct {
	From        sdk.CUAddress `json:"from"`
	DexID       uint32        `json:"dex_id"`
	OrderID     string        `json:"order_id"`
	Referer     sdk.CUAddress `json:"referer"`
	Receiver    sdk.CUAddress `json:"receiver"`
	AmountIn    sdk.Int       `json:"amount_in"`
	Price       sdk.Dec       `json:"price"`
	BaseSymbol  sdk.Symbol    `json:"base_symbol"`
	QuoteSymbol sdk.Symbol    `json:"quote_symbol"`
	Side        int           `json:"side"`
	ExpiredAt   int64         `json:"expired_at"`
}

func NewMsgLimitSwap

func NewMsgLimitSwap(orderID string, dexID uint32, from, referer, receiver sdk.CUAddress, amountIn sdk.Int, price sdk.Dec,
	baseSymbol, quoteSymbol sdk.Symbol, side int, expiredAt int64) MsgLimitSwap

func (MsgLimitSwap) GetSignBytes

func (msg MsgLimitSwap) GetSignBytes() []byte

func (MsgLimitSwap) GetSigners

func (msg MsgLimitSwap) GetSigners() []sdk.CUAddress

func (MsgLimitSwap) Route

func (msg MsgLimitSwap) Route() string

func (MsgLimitSwap) Type

func (msg MsgLimitSwap) Type() string

func (MsgLimitSwap) ValidateBasic

func (msg MsgLimitSwap) ValidateBasic() sdk.Error

type MsgRemoveLiquidity

type MsgRemoveLiquidity struct {
	From            sdk.CUAddress `json:"from"`
	DexID           uint32        `json:"dex_id"`
	TokenA          sdk.Symbol    `json:"token_a"`
	TokenB          sdk.Symbol    `json:"token_b"`
	Liquidity       sdk.Int       `json:"liquidity"`
	MinTokenAAmount sdk.Int       `json:"min_token_a_amount"`
	MinTokenBAmount sdk.Int       `json:"min_token_b_amount"`
	ExpiredAt       int64         `json:"expired_at"`
}

func NewMsgRemoveLiquidity

func NewMsgRemoveLiquidity(from sdk.CUAddress, dexID uint32, tokenA, tokenB sdk.Symbol, liquidity sdk.Int,
	minTokenAAmount, minTokenBAmount sdk.Int, expiredAt int64) MsgRemoveLiquidity

func (MsgRemoveLiquidity) GetSignBytes

func (msg MsgRemoveLiquidity) GetSignBytes() []byte

func (MsgRemoveLiquidity) GetSigners

func (msg MsgRemoveLiquidity) GetSigners() []sdk.CUAddress

func (MsgRemoveLiquidity) Route

func (msg MsgRemoveLiquidity) Route() string

func (MsgRemoveLiquidity) Type

func (msg MsgRemoveLiquidity) Type() string

func (MsgRemoveLiquidity) ValidateBasic

func (msg MsgRemoveLiquidity) ValidateBasic() sdk.Error

type MsgSwapExactIn

type MsgSwapExactIn struct {
	From         sdk.CUAddress `json:"from"`
	DexID        uint32        `json:"dex_id"`
	Referer      sdk.CUAddress `json:"referer"`
	Receiver     sdk.CUAddress `json:"receiver"`
	AmountIn     sdk.Int       `json:"amount_in"`
	MinAmountOut sdk.Int       `json:"min_amount_out"`
	SwapPath     []sdk.Symbol  `json:"swap_path"`
	ExpiredAt    int64         `json:"expired_at"`
}

func NewMsgSwapExactIn

func NewMsgSwapExactIn(dexID uint32, from, referer, receiver sdk.CUAddress, amountIn, minAmountOut sdk.Int,
	path []sdk.Symbol, expiredAt int64) MsgSwapExactIn

func (MsgSwapExactIn) GetSignBytes

func (msg MsgSwapExactIn) GetSignBytes() []byte

func (MsgSwapExactIn) GetSigners

func (msg MsgSwapExactIn) GetSigners() []sdk.CUAddress

func (MsgSwapExactIn) Route

func (msg MsgSwapExactIn) Route() string

func (MsgSwapExactIn) Type

func (msg MsgSwapExactIn) Type() string

func (MsgSwapExactIn) ValidateBasic

func (msg MsgSwapExactIn) ValidateBasic() sdk.Error

type MsgSwapExactOut

type MsgSwapExactOut struct {
	From        sdk.CUAddress `json:"from"`
	DexID       uint32        `json:"dex_id"`
	Referer     sdk.CUAddress `json:"referer"`
	Receiver    sdk.CUAddress `json:"receiver"`
	MaxAmountIn sdk.Int       `json:"max_amount_in"`
	AmountOut   sdk.Int       `json:"amount_out"`
	SwapPath    []sdk.Symbol  `json:"swap_path"`
	ExpiredAt   int64         `json:"expired_at"`
}

func NewMsgSwapExactOut

func NewMsgSwapExactOut(dexID uint32, from, referer, receiver sdk.CUAddress, amountOut, maxAmountIn sdk.Int,
	path []sdk.Symbol, expiredAt int64) MsgSwapExactOut

func (MsgSwapExactOut) GetSignBytes

func (msg MsgSwapExactOut) GetSignBytes() []byte

func (MsgSwapExactOut) GetSigners

func (msg MsgSwapExactOut) GetSigners() []sdk.CUAddress

func (MsgSwapExactOut) Route

func (msg MsgSwapExactOut) Route() string

func (MsgSwapExactOut) Type

func (msg MsgSwapExactOut) Type() string

func (MsgSwapExactOut) ValidateBasic

func (msg MsgSwapExactOut) ValidateBasic() sdk.Error

type Order

type Order struct {
	OrderID      string        `json:"order_id"`
	DexID        uint32        `json:"dex_id"`
	From         sdk.CUAddress `json:"from"`
	Referer      sdk.CUAddress `json:"referer"`
	Receiver     sdk.CUAddress `json:"receiver"`
	CreatedTime  int64         `json:"created_time"`
	ExpiredTime  int64         `json:"expired_time"`
	FinishedTime int64         `json:"finished_time"`
	Status       byte          `json:"status"`
	Side         byte          `json:"side"`
	BaseSymbol   sdk.Symbol    `json:"base_symbol"`
	QuoteSymbol  sdk.Symbol    `json:"quote_symbol"`
	Price        sdk.Dec       `json:"price"`
	AmountIn     sdk.Int       `json:"amount_int"`
	LockedFund   sdk.Int       `json:"locked_fund"`
	FeeRate      *FeeRate      `json:"fee_rate"`
}

func (*Order) IsFinished

func (o *Order) IsFinished() bool

func (*Order) LessThan

func (o *Order) LessThan(order *Order) bool

func (*Order) RemainQuantity

func (o *Order) RemainQuantity() sdk.Int

type OrderByCreatedTime

type OrderByCreatedTime []*Order

func (OrderByCreatedTime) Len

func (o OrderByCreatedTime) Len() int

func (OrderByCreatedTime) Less

func (o OrderByCreatedTime) Less(i, j int) bool

func (OrderByCreatedTime) Swap

func (o OrderByCreatedTime) Swap(i, j int)

type Params

type Params struct {
	MinimumLiquidity            sdk.Int         `json:"minimum_liquidity"`
	LimitSwapMatchingGas        sdk.Uint        `json:"limit_swap_matching_gas"`
	MaxFeeRate                  sdk.Dec         `json:"max_fee_rate"`
	LpRewardRate                sdk.Dec         `json:"lp_reward_rate"`
	RepurchaseRate              sdk.Dec         `json:"repurchase_rate"`
	RefererTransactionBonusRate sdk.Dec         `json:"referer_transaction_bonus_rate"`
	RepurchaseDuration          int64           `json:"repurchase_duration"`
	LPMiningWeights             []*MiningWeight `json:"lp_mining_weights"`
	TradeMiningWeights          []*MiningWeight `json:"trade_mining_weights"`
	LPMiningRewardRate          sdk.Dec         `json:"lp_mining_reward_rate"`
	RepurchaseToken             string          `json:"repurchase_token"`
	RepurchaseRoutingToken      string          `json:"repurchase_routing_token"`
}

Params defines the high level settings for staking

func DefaultParams

func DefaultParams() Params

DefaultParams returns a default set of parameters.

func MustUnmarshalParams

func MustUnmarshalParams(cdc *codec.Codec, value []byte) Params

unmarshal the current staking params value from store key or panic

func NewParams

func NewParams(minLiquidity sdk.Int, limitSwapMatchingGas sdk.Uint, maxFeeRate, lpRewardRate, repurchaseRate, refererTransactionBonusRate sdk.Dec,
	repurchaseDuration int64, lpMiningWeights, tradeMiningWeights []*MiningWeight,
	lpMiningRewardRate sdk.Dec, repurchaseToken, repurchaseRoutingToken string) Params

NewParams creates a new Params instance

func UnmarshalParams

func UnmarshalParams(cdc *codec.Codec, value []byte) (params Params, err error)

unmarshal the current staking params value from store key

func (Params) Equal

func (p Params) Equal(p2 Params) bool

func (*Params) ParamSetPairs

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

Implements params.ParamSet

func (Params) String

func (p Params) String() string

String returns a human readable string representation of the parameters.

func (Params) Validate

func (p Params) Validate() error

validate a set of params

type QueryAddrLiquidityParams

type QueryAddrLiquidityParams struct {
	Addr  sdk.CUAddress
	DexID *uint32
}

func NewQueryAddrLiquidityParams

func NewQueryAddrLiquidityParams(addr sdk.CUAddress, dexID *uint32) QueryAddrLiquidityParams

type QueryAllTradingPairParams

type QueryAllTradingPairParams struct {
	DexID *uint32
}

func NewQueryAllTradingPairParams

func NewQueryAllTradingPairParams(dexID *uint32) QueryAllTradingPairParams

type QueryDexParams

type QueryDexParams struct {
	DexID uint32
}

func NewQueryDexParams

func NewQueryDexParams(dexID uint32) QueryDexParams

type QueryOrderParams

type QueryOrderParams struct {
	OrderID string
}

func NewQueryOrderParams

func NewQueryOrderParams(orderID string) QueryOrderParams

type QueryOrderbookParams

type QueryOrderbookParams struct {
	DexID       uint32
	BaseSymbol  sdk.Symbol
	QuoteSymbol sdk.Symbol
	Merge       bool
}

func NewQueryOrderbookParams

func NewQueryOrderbookParams(dexID uint32, baseSymbol, quoteSymbol sdk.Symbol, merge bool) QueryOrderbookParams

type QueryTradingPairParams

type QueryTradingPairParams struct {
	DexID  uint32
	TokenA sdk.Symbol
	TokenB sdk.Symbol
}

func NewQueryTradingPairParams

func NewQueryTradingPairParams(dexID uint32, tokenA, tokenB sdk.Symbol) QueryTradingPairParams

type QueryUnclaimedEarningParams

type QueryUnclaimedEarningParams struct {
	Addr sdk.CUAddress
}

func NewQueryUnclaimedEarningParams

func NewQueryUnclaimedEarningParams(addr sdk.CUAddress) QueryUnclaimedEarningParams

type QueryUnfinishedOrderParams

type QueryUnfinishedOrderParams struct {
	Addr        sdk.CUAddress
	DexID       uint32
	BaseSymbol  sdk.Symbol
	QuoteSymbol sdk.Symbol
}

func NewQueryUnfinishedOrderParams

func NewQueryUnfinishedOrderParams(addr sdk.CUAddress, dexID uint32, baseSymbol, quoteSymbol sdk.Symbol) QueryUnfinishedOrderParams

type ReceiptKeeper

type ReceiptKeeper interface {
	NewReceipt(category sdk.CategoryType, flows []sdk.Flow) *sdk.Receipt
	SaveReceiptToResult(receipt *sdk.Receipt, result *sdk.Result) *sdk.Result
	GetReceiptFromResult(result *sdk.Result) (*sdk.Receipt, error)
}

type ResOrder

type ResOrder struct {
	OrderID        string        `json:"order_id"`
	From           sdk.CUAddress `json:"from"`
	Referer        sdk.CUAddress `json:"referer"`
	Receiver       sdk.CUAddress `json:"receiver"`
	CreatedTime    int64         `json:"created_time"`
	ExpiredTime    int64         `json:"expired_time"`
	FinishedTime   int64         `json:"finished_time"`
	Status         byte          `json:"status"`
	Side           byte          `json:"side"`
	BaseSymbol     sdk.Symbol    `json:"base_symbol"`
	QuoteSymbol    sdk.Symbol    `json:"quote_symbol"`
	Price          sdk.Dec       `json:"price"`
	AmountIn       sdk.Int       `json:"amount_int"`
	LockedFund     sdk.Int       `json:"locked_fund"`
	RemainQuantity sdk.Int       `json:"remain_quantity"`
	DexID          uint32        `json:"dex_id"`
	FeeRate        *FeeRate      `json:"fee_rate"`
}

func NewResOrder

func NewResOrder(order *Order) *ResOrder

func NewResOrders

func NewResOrders(orders []*Order) []*ResOrder

type ResTradingPair

type ResTradingPair struct {
	DexID                  uint32     `json:"dex_id"`
	TokenA                 sdk.Symbol `json:"token_a"`
	TokenB                 sdk.Symbol `json:"token_b"`
	TokenAAmount           sdk.Int    `json:"token_a_amount"`
	TokenBAmount           sdk.Int    `json:"token_b_amount"`
	TotalLiquidity         sdk.Int    `json:"total_liquidity"`
	IsPublic               bool       `json:"is_public"`
	LPRewardRate           sdk.Dec    `json:"lp_reward_rate"`
	RefererRewardRate      sdk.Dec    `json:"referer_reward_rate"`
	UnclaimedTradingReward sdk.Int    `json:"unclaimed_trading_reward"`
	UnclaimedTradingVolume sdk.Int    `json:"unclaimed_trading_volume"`
}

func NewResTradingPair

func NewResTradingPair(pair *TradingPair, reward *TradeReward) *ResTradingPair

func NewResTradingPairs

func NewResTradingPairs(pairs []*TradingPair) []*ResTradingPair

type SupplyKeeper

type SupplyKeeper interface {
	GetModuleAccount(ctx sdk.Context, name string) supplyI.ModuleAccountI
	SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) (sdk.Result, sdk.Error)
	SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.CUAddress, amt sdk.Coins) (sdk.Result, sdk.Error)
	SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.CUAddress, recipientModule string, amt sdk.Coins) (sdk.Result, sdk.Error)
	MintCoins(ctx sdk.Context, name string, amt sdk.Coins) sdk.Error
	BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) sdk.Error
	GetSupply(ctx sdk.Context) (supply supplyI.SupplyI)
}

SupplyKeeper defines the expected supply keeper

type TokenKeeper

type TokenKeeper interface {
	GetToken(ctx sdk.Context, symbol sdk.Symbol) sdk.Token
}

type TradeReward

type TradeReward struct {
	DexID         uint32     `json:"dex_id"`
	TokenA        sdk.Symbol `json:"token_a"`
	TokenB        sdk.Symbol `json:"token_b"`
	Reward        sdk.Int    `json:"reward"`
	TradingVolume sdk.Int    `json:"trading_volume"`
}

func NewTradeReward

func NewTradeReward(dexID uint32, tokenA, tokenB sdk.Symbol) *TradeReward

type TradingPair

type TradingPair struct {
	DexID             uint32     `json:"dex_id"`
	TokenA            sdk.Symbol `json:"token_a"`
	TokenB            sdk.Symbol `json:"token_b"`
	TokenAAmount      sdk.Int    `json:"token_a_amount"`
	TokenBAmount      sdk.Int    `json:"token_b_amount"`
	TotalLiquidity    sdk.Int    `json:"total_liquidity"`
	IsPublic          bool       `json:"is_public"`
	LPRewardRate      sdk.Dec    `json:"lp_reward_rate"`
	RefererRewardRate sdk.Dec    `json:"referer_reward_rate"`
}

func NewCustomTradingPair

func NewCustomTradingPair(dexID uint32, tokenA, tokenB sdk.Symbol, isPublic bool, lpRewardRate, refererRewardRate sdk.Dec) *TradingPair

func NewDefaultTradingPair

func NewDefaultTradingPair(tokenA, tokenB sdk.Symbol, initialLiquidity sdk.Int) *TradingPair

func (*TradingPair) Price

func (t *TradingPair) Price() sdk.Dec

func (*TradingPair) Validate

func (t *TradingPair) Validate() error

type TransferKeeper

type TransferKeeper interface {
	GetBalance(ctx sdk.Context, addr sdk.CUAddress, symbol string) sdk.Int
	GetAllBalance(ctx sdk.Context, addr sdk.CUAddress) sdk.Coins
	AddCoins(ctx sdk.Context, addr sdk.CUAddress, amt sdk.Coins) (sdk.Coins, []sdk.Flow, sdk.Error)
	AddCoin(ctx sdk.Context, addr sdk.CUAddress, amt sdk.Coin) (sdk.Coin, sdk.Flow, sdk.Error)
	SubCoins(ctx sdk.Context, addr sdk.CUAddress, amt sdk.Coins) (sdk.Coins, []sdk.Flow, sdk.Error)
	SubCoin(ctx sdk.Context, addr sdk.CUAddress, amt sdk.Coin) (sdk.Coin, sdk.Flow, sdk.Error)
	SubCoinHold(ctx sdk.Context, addr sdk.CUAddress, amt sdk.Coin) (sdk.Coin, sdk.Flow, sdk.Error)
	LockCoin(ctx sdk.Context, addr sdk.CUAddress, amt sdk.Coin) ([]sdk.Flow, sdk.Error)
	UnlockCoin(ctx sdk.Context, addr sdk.CUAddress, amt sdk.Coin) ([]sdk.Flow, sdk.Error)
	SendCoin(ctx sdk.Context, fromAddr sdk.CUAddress, toAddr sdk.CUAddress, amt sdk.Coin) (sdk.Result, []sdk.Flow, sdk.Error)
}

Jump to

Keyboard shortcuts

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