Documentation ¶
Index ¶
- Constants
- Variables
- func NewQuerier(mk Keeper) sdk.Querier
- type DelistKeeper
- func (keeper *DelistKeeper) AddDelistRequest(ctx sdk.Context, time int64, symbol string)
- func (keeper *DelistKeeper) GetDelistSymbolsBeforeTime(ctx sdk.Context, time int64) []string
- func (keeper *DelistKeeper) HasDelistRequest(ctx sdk.Context, symbol string) bool
- func (keeper *DelistKeeper) RemoveDelistRequestsBeforeTime(ctx sdk.Context, time int64)
- type GlobalMarketInfoKeeper
- type GlobalOrderKeeper
- type Keeper
- func (k Keeper) DeductInt64CetFee(ctx sdk.Context, addr sdk.AccAddress, amt int64) sdk.Error
- func (k Keeper) FreezeCoins(ctx sdk.Context, acc sdk.AccAddress, amt sdk.Coins) sdk.Error
- func (k Keeper) GetAllMarketInfos(ctx sdk.Context) []types.MarketInfo
- func (k Keeper) GetAllOrders(ctx sdk.Context) []*types.Order
- func (k Keeper) GetAssetKeeper() types.ExpectedAssetStatusKeeper
- func (k Keeper) GetBankxKeeper() types.ExpectedBankxKeeper
- func (k Keeper) GetMarketFeeMin(ctx sdk.Context) int64
- func (k Keeper) GetMarketInfo(ctx sdk.Context, symbol string) (types.MarketInfo, error)
- func (k Keeper) GetMarketKey() sdk.StoreKey
- func (k *Keeper) GetMarketLastExePrice(ctx sdk.Context, symbol string) (sdk.Dec, error)
- func (k Keeper) GetMarketVolume(ctx sdk.Context, stock, money string, stockVolume, moneyVolume sdk.Dec) sdk.Dec
- func (k Keeper) GetMarketsWithNewlyAddedOrder(ctx sdk.Context) []string
- func (k Keeper) GetMsgProducer() msgqueue.MsgSender
- func (k Keeper) GetOrderCleanTime(ctx sdk.Context) int64
- func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k Keeper) GetRebateRatio(ctx sdk.Context) int64
- func (k Keeper) GetRebateRatioBase(ctx sdk.Context) int64
- func (k Keeper) GetRefereeAddr(ctx sdk.Context, accAddr sdk.AccAddress) sdk.AccAddress
- func (k Keeper) GetToken(ctx sdk.Context, symbol string) asset.Token
- func (k Keeper) HasCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) bool
- func (k Keeper) IsForbiddenByTokenIssuer(ctx sdk.Context, denom string, addr sdk.AccAddress) bool
- func (k *Keeper) IsMarketExist(ctx sdk.Context, symbol string) bool
- func (k Keeper) IsSubScribed(topic string) bool
- func (k Keeper) IsTokenExists(ctx sdk.Context, symbol string) bool
- func (k Keeper) IsTokenForbidden(ctx sdk.Context, symbol string) bool
- func (k Keeper) IsTokenIssuer(ctx sdk.Context, denom string, addr sdk.AccAddress) bool
- func (k Keeper) MarketCountOfStock(ctx sdk.Context, stock string) int64
- func (k Keeper) MarketOwner(ctx sdk.Context, info types.MarketInfo) sdk.AccAddress
- func (k Keeper) QuerySeqWithAddr(ctx sdk.Context, addr sdk.AccAddress) (uint64, sdk.Error)
- func (k Keeper) RemoveMarket(ctx sdk.Context, symbol string) sdk.Error
- func (k Keeper) SendCoins(ctx sdk.Context, from sdk.AccAddress, to sdk.AccAddress, amt sdk.Coins) sdk.Error
- func (k Keeper) SetMarket(ctx sdk.Context, info types.MarketInfo) sdk.Error
- func (k Keeper) SetOrder(ctx sdk.Context, order *types.Order) sdk.Error
- func (k Keeper) SetOrderCleanTime(ctx sdk.Context, t int64)
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) SubtractCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) sdk.Error
- func (k Keeper) SubtractFeeAndCollectFee(ctx sdk.Context, addr sdk.AccAddress, amt int64) sdk.Error
- func (k Keeper) UnFreezeCoins(ctx sdk.Context, acc sdk.AccAddress, amt sdk.Coins) sdk.Error
- type MarketInfoList
- type OrderCleanUpDayKeeper
- type OrderKeeper
- type PersistentGlobalOrderKeeper
- type PersistentMarketInfoKeeper
- func (k PersistentMarketInfoKeeper) GetAllMarketInfos(ctx sdk.Context) []types.MarketInfo
- func (k PersistentMarketInfoKeeper) GetMarketInfo(ctx sdk.Context, symbol string) (info types.MarketInfo, err error)
- func (k PersistentMarketInfoKeeper) MarketCountOfStock(ctx sdk.Context, stock string) (count int64)
- func (k PersistentMarketInfoKeeper) RemoveMarket(ctx sdk.Context, symbol string) sdk.Error
- func (k PersistentMarketInfoKeeper) SetMarket(ctx sdk.Context, info types.MarketInfo) sdk.Error
- type PersistentOrderKeeper
- func (keeper *PersistentOrderKeeper) Add(ctx sdk.Context, order *types.Order) sdk.Error
- func (keeper *PersistentOrderKeeper) GetMatchingCandidates(ctx sdk.Context) []*types.Order
- func (keeper *PersistentOrderKeeper) GetOlderThan(ctx sdk.Context, height int64) []*types.Order
- func (keeper *PersistentOrderKeeper) GetOrdersAtHeight(ctx sdk.Context, height int64) []*types.Order
- func (keeper *PersistentOrderKeeper) GetSymbol() string
- func (keeper *PersistentOrderKeeper) Remove(ctx sdk.Context, order *types.Order) sdk.Error
- func (keeper *PersistentOrderKeeper) Update(ctx sdk.Context, order *types.Order) sdk.Error
- type QueryCancelMarkets
- type QueryMarketInfo
- type QueryMarketInfoAndParams
- type QueryMarketParam
- type QueryOrderParam
- type QueryUserOrderList
- type ResOrder
Constants ¶
const ( QueryMarket = "market-info" QueryMarkets = "market-list" QueryOrdersInMarket = "orders-in-market" QueryOrder = "order-info" QueryUserOrders = "user-order-list" QueryWaitCancelMarkets = "wait-cancel-markets" QueryParameters = "parameters" )
Variables ¶
var ( MarketIdentifierPrefix = []byte{0x15} DelistKey = []byte{0x40} DelistRevKey = []byte{0x42} )
var ( OrderBookKeyPrefix = []byte{0x11} BidListKeyPrefix = []byte{0x12} AskListKeyPrefix = []byte{0x13} OrderQueueKeyPrefix = []byte{0x14} NewlyAddedKeyPrefix = []byte{0x66} NewlyAddedKeyEnd = []byte{0x67} LastOrderCleanUpDayKey = []byte{0x20} )
nolint
Functions ¶
Types ¶
type DelistKeeper ¶
type DelistKeeper struct {
// contains filtered or unexported fields
}
func NewDelistKeeper ¶
func NewDelistKeeper(key sdk.StoreKey) *DelistKeeper
func (*DelistKeeper) AddDelistRequest ¶
func (keeper *DelistKeeper) AddDelistRequest(ctx sdk.Context, time int64, symbol string)
func (*DelistKeeper) GetDelistSymbolsBeforeTime ¶
func (keeper *DelistKeeper) GetDelistSymbolsBeforeTime(ctx sdk.Context, time int64) []string
include the specific time
func (*DelistKeeper) HasDelistRequest ¶
func (keeper *DelistKeeper) HasDelistRequest(ctx sdk.Context, symbol string) bool
func (*DelistKeeper) RemoveDelistRequestsBeforeTime ¶
func (keeper *DelistKeeper) RemoveDelistRequestsBeforeTime(ctx sdk.Context, time int64)
type GlobalMarketInfoKeeper ¶
type GlobalMarketInfoKeeper interface { SetMarket(ctx sdk.Context, info types.MarketInfo) sdk.Error RemoveMarket(ctx sdk.Context, symbol string) sdk.Error GetAllMarketInfos(ctx sdk.Context) []types.MarketInfo MarketCountOfStock(ctx sdk.Context, stock string) int64 GetMarketInfo(ctx sdk.Context, symbol string) (types.MarketInfo, error) }
func NewGlobalMarketInfoKeeper ¶
func NewGlobalMarketInfoKeeper(key sdk.StoreKey, cdcVal *codec.Codec) GlobalMarketInfoKeeper
type GlobalOrderKeeper ¶
type GlobalOrderKeeper interface { GetAllOrders(ctx sdk.Context) []*types.Order QueryOrder(ctx sdk.Context, orderID string) *types.Order GetOrdersFromUser(ctx sdk.Context, user string) []string }
Global order keep can lookup a order, given its ID or the prefix of its ID, i.e. the sender's address
func NewGlobalOrderKeeper ¶
func NewGlobalOrderKeeper(key sdk.StoreKey, codec *codec.Codec) GlobalOrderKeeper
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
func NewKeeper ¶
func NewKeeper(key sdk.StoreKey, axkVal types.ExpectedAssetStatusKeeper, bnkVal types.ExpectedBankxKeeper, cdcVal *codec.Codec, msgKeeperVal msgqueue.MsgSender, paramstore params.Subspace, ak auth.AccountKeeper, authX types.ExpectedAuthXKeeper) Keeper
func (Keeper) DeductInt64CetFee ¶
func (Keeper) FreezeCoins ¶
func (Keeper) GetAllMarketInfos ¶
func (k Keeper) GetAllMarketInfos(ctx sdk.Context) []types.MarketInfo
func (Keeper) GetAssetKeeper ¶
func (k Keeper) GetAssetKeeper() types.ExpectedAssetStatusKeeper
func (Keeper) GetBankxKeeper ¶
func (k Keeper) GetBankxKeeper() types.ExpectedBankxKeeper
func (Keeper) GetMarketInfo ¶
func (Keeper) GetMarketKey ¶
func (*Keeper) GetMarketLastExePrice ¶
func (Keeper) GetMarketVolume ¶
func (Keeper) GetMarketsWithNewlyAddedOrder ¶
func (Keeper) GetMsgProducer ¶
func (Keeper) GetRefereeAddr ¶
func (k Keeper) GetRefereeAddr(ctx sdk.Context, accAddr sdk.AccAddress) sdk.AccAddress
func (Keeper) IsForbiddenByTokenIssuer ¶
func (Keeper) IsSubScribed ¶
func (Keeper) IsTokenForbidden ¶
func (Keeper) IsTokenIssuer ¶
func (Keeper) MarketCountOfStock ¶
func (Keeper) MarketOwner ¶
func (k Keeper) MarketOwner(ctx sdk.Context, info types.MarketInfo) sdk.AccAddress
func (Keeper) QuerySeqWithAddr ¶
func (Keeper) SubtractCoins ¶
func (Keeper) SubtractFeeAndCollectFee ¶
type MarketInfoList ¶
type MarketInfoList []QueryMarketInfo
type OrderCleanUpDayKeeper ¶
type OrderCleanUpDayKeeper struct {
// contains filtered or unexported fields
}
This keeper records at which day the last GTE-order-clean-up action was performed
func NewOrderCleanUpDayKeeper ¶
func NewOrderCleanUpDayKeeper(key sdk.StoreKey) *OrderCleanUpDayKeeper
func (*OrderCleanUpDayKeeper) GetUnixTime ¶
func (keeper *OrderCleanUpDayKeeper) GetUnixTime(ctx sdk.Context) int64
func (*OrderCleanUpDayKeeper) SetUnixTime ¶
func (keeper *OrderCleanUpDayKeeper) SetUnixTime(ctx sdk.Context, unixTime int64)
type OrderKeeper ¶
type OrderKeeper interface { Add(ctx sdk.Context, order *types.Order) sdk.Error Update(ctx sdk.Context, order *types.Order) sdk.Error Remove(ctx sdk.Context, order *types.Order) sdk.Error GetOlderThan(ctx sdk.Context, height int64) []*types.Order GetOrdersAtHeight(ctx sdk.Context, height int64) []*types.Order GetMatchingCandidates(ctx sdk.Context) []*types.Order GetSymbol() string }
OrderKeeper manages the order book of one market
func NewOrderKeeper ¶
type PersistentGlobalOrderKeeper ¶
type PersistentGlobalOrderKeeper struct {
// contains filtered or unexported fields
}
func (*PersistentGlobalOrderKeeper) GetAllOrders ¶
func (keeper *PersistentGlobalOrderKeeper) GetAllOrders(ctx sdk.Context) []*types.Order
Get all the orders out. It is an expensive operation. Only use it for dumping state.
func (*PersistentGlobalOrderKeeper) GetOrdersFromUser ¶
func (keeper *PersistentGlobalOrderKeeper) GetOrdersFromUser(ctx sdk.Context, user string) []string
func (*PersistentGlobalOrderKeeper) QueryOrder ¶
type PersistentMarketInfoKeeper ¶
type PersistentMarketInfoKeeper struct {
// contains filtered or unexported fields
}
func (PersistentMarketInfoKeeper) GetAllMarketInfos ¶
func (k PersistentMarketInfoKeeper) GetAllMarketInfos(ctx sdk.Context) []types.MarketInfo
func (PersistentMarketInfoKeeper) GetMarketInfo ¶
func (k PersistentMarketInfoKeeper) GetMarketInfo(ctx sdk.Context, symbol string) (info types.MarketInfo, err error)
func (PersistentMarketInfoKeeper) MarketCountOfStock ¶
func (k PersistentMarketInfoKeeper) MarketCountOfStock(ctx sdk.Context, stock string) (count int64)
func (PersistentMarketInfoKeeper) RemoveMarket ¶
func (PersistentMarketInfoKeeper) SetMarket ¶
func (k PersistentMarketInfoKeeper) SetMarket(ctx sdk.Context, info types.MarketInfo) sdk.Error
SetMarket implements token Keeper.
type PersistentOrderKeeper ¶
type PersistentOrderKeeper struct {
// contains filtered or unexported fields
}
PersistentOrderKeeper implements OrderKeeper interface with a KVStore
func (*PersistentOrderKeeper) GetMatchingCandidates ¶
func (keeper *PersistentOrderKeeper) GetMatchingCandidates(ctx sdk.Context) []*types.Order
Return the bid orders and ask orders which have proper prices and have possibilities for deal
func (*PersistentOrderKeeper) GetOlderThan ¶
using the order queue, find orders which are older than a particular height
func (*PersistentOrderKeeper) GetOrdersAtHeight ¶
func (keeper *PersistentOrderKeeper) GetOrdersAtHeight(ctx sdk.Context, height int64) []*types.Order
using the order queue, find orders which locate at a particular height
func (*PersistentOrderKeeper) GetSymbol ¶
func (keeper *PersistentOrderKeeper) GetSymbol() string
type QueryCancelMarkets ¶
type QueryCancelMarkets struct {
Time int64
}
type QueryMarketInfo ¶
type QueryMarketParam ¶
type QueryMarketParam struct {
TradingPair string
}
func NewQueryMarketParam ¶
func NewQueryMarketParam(symbol string) QueryMarketParam
type QueryOrderParam ¶
type QueryOrderParam struct {
OrderID string
}
func NewQueryOrderParam ¶
func NewQueryOrderParam(orderID string) QueryOrderParam
type QueryUserOrderList ¶
type QueryUserOrderList struct {
User string
}
type ResOrder ¶ added in v0.2.10
type ResOrder struct { OrderID string `json:"order_id"` Sender sdk.AccAddress `json:"sender"` Sequence uint64 `json:"sequence"` Identify byte `json:"identify"` TradingPair string `json:"trading_pair"` OrderType byte `json:"order_type"` Price sdk.Dec `json:"price"` Quantity int64 `json:"quantity"` Side byte `json:"side"` TimeInForce int64 `json:"time_in_force"` Height int64 `json:"height"` FrozenCommission int64 `json:"frozen_commission"` // DEX2 ExistBlocks int64 `json:"exist_blocks"` FrozenFeatureFee int64 `json:"frozen_feature_fee"` // DEX2 FrozenFee int64 `json:"frozen_fee,omitempty"` // DEX2: -> frozen_commission // These fields will change when order was filled/canceled. LeftStock int64 `json:"left_stock"` Freeze int64 `json:"freeze"` DealStock int64 `json:"deal_stock"` DealMoney int64 `json:"deal_money"` }