Documentation ¶
Index ¶
- Constants
- Variables
- func ConnectDatabase(driver, url string) *sqlx.DB
- func GetBaseTokenDecimals(marketID string) int
- func GetBaseTokenSymbol(marketID string) string
- func InitTestDB()
- func MockMarketDao()
- func MockTradeDao()
- func ToSnake(camel string) string
- func UpdateLaunchLogToPending(launchLog *LaunchLog) (err error)
- type ECSignature
- type IBalanceDao
- type ILaunchLogDao
- type IMarketDao
- type IOrderDao
- type ITokenDao
- type ITradeDao
- type ITransactionDao
- type LaunchLog
- type MCache
- type MErc20
- type MLockedBalanceDao
- type MMarketDao
- type MTradeDao
- func (m *MTradeDao) Count() int
- func (m *MTradeDao) FindAccountMarketTrades(account, marketID, status string, limit, offset int) (int64, []*Trade)
- func (m *MTradeDao) FindAllTrades(marketID string) (int64, []*Trade)
- func (m *MTradeDao) FindTradeByID(id int64) *Trade
- func (m *MTradeDao) FindTradeByTransactionID(transactionID int64) []*Trade
- func (m *MTradeDao) FindTradesByHash(hash string) []*Trade
- func (m *MTradeDao) FindTradesByMarket(pair string, startTime time.Time, endTime time.Time) []*Trade
- func (m *MTradeDao) InsertTrade(trade *Trade) error
- func (m *MTradeDao) UpdateTrade(trade *Trade) error
- type Market
- type Op
- type OpEq
- type OpGt
- type OpList
- type OpLt
- type Order
- type OrderByDirection
- type OrderJSON
- type Token
- type Trade
- type Transaction
Constants ¶
View Source
const (
OP_OR = "or"
)
Variables ¶
View Source
var DB *sqlx.DB
Functions ¶
func ConnectDatabase ¶
func GetBaseTokenDecimals ¶
func GetBaseTokenSymbol ¶
func InitTestDB ¶
func InitTestDB()
func MockMarketDao ¶
func MockMarketDao()
func MockTradeDao ¶
func MockTradeDao()
Types ¶
type ECSignature ¶
type IBalanceDao ¶
type IBalanceDao interface {
GetByAccountAndSymbol(account, tokenSymbol string, decimals int) decimal.Decimal
}
IBalanceDao is an interface about how to fetch balance data from storage
var BalanceDao IBalanceDao
type ILaunchLogDao ¶
type ILaunchLogDao interface { FindLaunchLogByID(int) *LaunchLog FindByHash(hash string) *LaunchLog FindPendingLogWithMaxNonce() int64 FindAllCreated() []*LaunchLog UpdateLaunchLog(*LaunchLog) error InsertLaunchLog(*LaunchLog) error UpdateLaunchLogsStatusByItemID(string, int64) error }
var LaunchLogDao ILaunchLogDao
type IMarketDao ¶
type IMarketDao interface { FindAllMarkets() []*Market FindMarketByID(marketID string) *Market InsertMarket(market *Market) error UpdateMarket(market *Market) error }
var MarketDao IMarketDao
type IOrderDao ¶
type IOrderDao interface { FindMarketPendingOrders(marketID string) []*Order FindByAccount(trader, marketID, status string, offset, limit int) (int64, []*Order) FindByID(id string) *Order InsertOrder(order *Order) error UpdateOrder(order *Order) error Count() int }
var OrderDao IOrderDao
type ITokenDao ¶
type ITokenDao interface { GetAllTokens() []*Token InsertToken(*Token) error FindTokenBySymbol(string) *Token }
var TokenDao ITokenDao
type ITradeDao ¶
type ITradeDao interface { FindTradesByMarket(pair string, startTime time.Time, endTime time.Time) []*Trade FindAllTrades(marketID string) (int64, []*Trade) FindTradesByHash(hash string) []*Trade FindTradeByID(id int64) *Trade FindAccountMarketTrades(account, marketID, status string, limit, offset int) (int64, []*Trade) InsertTrade(trade *Trade) error UpdateTrade(trade *Trade) error Count() int FindTradeByTransactionID(transactionID int64) []*Trade }
var TradeDao ITradeDao
type ITransactionDao ¶
type ITransactionDao interface { FindTransactionByHash(transactionHash string) *Transaction InsertTransaction(transaction *Transaction) error UpdateTransaction(transaction *Transaction) error UpdateTransactionStatus(status, hash string) error Count() int FindTransactionByID(id int64) *Transaction }
var TransactionDao ITransactionDao
type LaunchLog ¶
type LaunchLog struct { ID int64 `db:"id" auto:"true" primaryKey:"true" autoIncrement:"true"` ItemType string `db:"item_type"` ItemID int64 `db:"item_id"` Status string `db:"status"` Hash sql.NullString `db:"transaction_hash"` BlockNumber sql.NullInt64 `db:"block_number"` From string `db:"t_from"` To string `db:"t_to"` Value decimal.Decimal `db:"value"` GasLimit int64 `db:"gas_limit"` GasUsed sql.NullInt64 `db:"gas_used"` GasPrice decimal.NullDecimal `db:"gas_price"` Nonce sql.NullInt64 `db:"nonce"` Data string `db:"data"` ExecutedAt time.Time `db:"executed_at"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` }
type MLockedBalanceDao ¶
func (*MLockedBalanceDao) GetByAccountAndSymbol ¶
func (m *MLockedBalanceDao) GetByAccountAndSymbol(account, tokenSymbol string, decimals int) decimal.Decimal
type MMarketDao ¶
func (*MMarketDao) FindAllMarkets ¶
func (m *MMarketDao) FindAllMarkets() []*Market
func (*MMarketDao) FindMarketByID ¶
func (m *MMarketDao) FindMarketByID(marketID string) *Market
func (*MMarketDao) InsertMarket ¶
func (m *MMarketDao) InsertMarket(market *Market) error
func (*MMarketDao) UpdateMarket ¶
func (m *MMarketDao) UpdateMarket(market *Market) error
type MTradeDao ¶
func (*MTradeDao) FindAccountMarketTrades ¶
func (*MTradeDao) FindAllTrades ¶
func (*MTradeDao) FindTradeByID ¶
func (*MTradeDao) FindTradeByTransactionID ¶
func (*MTradeDao) FindTradesByHash ¶
func (*MTradeDao) FindTradesByMarket ¶
func (*MTradeDao) InsertTrade ¶
func (*MTradeDao) UpdateTrade ¶
type Market ¶
type Market struct { ID string `json:"id" db:"id" primaryKey:"true"` BaseTokenSymbol string `json:"baseTokenSymbol" db:"base_token_symbol"` BaseTokenName string `json:"BaseTokenName" db:"base_token_name"` BaseTokenAddress string `json:"baseTokenAddress" db:"base_token_address"` BaseTokenDecimals int `json:"baseTokenDecimals" db:"base_token_decimals"` QuoteTokenSymbol string `json:"quoteTokenSymbol" db:"quote_token_symbol"` QuoteTokenName string `json:"QuoteTokenName" db:"quote_token_name"` QuoteTokenAddress string `json:"quoteTokenAddress" db:"quote_token_address"` QuoteTokenDecimals int `json:"quoteTokenDecimals" db:"quote_token_decimals"` MinOrderSize decimal.Decimal `json:"minOrderSize" db:"min_order_size"` PricePrecision int `json:"pricePrecision" db:"price_precision"` PriceDecimals int `json:"priceDecimals" db:"price_decimals"` AmountDecimals int `json:"amountDecimals" db:"amount_decimals"` MakerFeeRate decimal.Decimal `json:"makerFeeRate" db:"maker_fee_rate"` TakerFeeRate decimal.Decimal `json:"takerFeeRate" db:"taker_fee_rate"` GasUsedEstimation int `json:"gasUsedEstimation" db:"gas_used_estimation"` IsPublished bool `json:"isPublished" db:"is_published"` }
type OpList ¶
type OpList struct {
// contains filtered or unexported fields
}
func (*OpList) GetSqlAndValues ¶
type Order ¶
type Order struct { ID string `json:"id" db:"id" primaryKey:"true"` TraderAddress string `json:"traderAddress" db:"trader_address"` MarketID string `json:"marketID" db:"market_id"` Side string `json:"side" db:"side"` Price decimal.Decimal `json:"price" db:"price"` Amount decimal.Decimal `json:"amount" db:"amount"` Status string `json:"status" db:"status"` Type string `json:"type" db:"type"` Version string `json:"version" db:"version"` AvailableAmount decimal.Decimal `json:"availableAmount" db:"available_amount"` ConfirmedAmount decimal.Decimal `json:"confirmedAmount" db:"confirmed_amount"` CanceledAmount decimal.Decimal `json:"canceledAmount" db:"canceled_amount"` PendingAmount decimal.Decimal `json:"pendingAmount" db:"pending_amount"` MakerFeeRate decimal.Decimal `json:"makerFeeRate" db:"maker_fee_rate"` TakerFeeRate decimal.Decimal `json:"takerFeeRate" db:"taker_fee_rate"` MakerRebateRate decimal.Decimal `json:"makerRebateRate" db:"maker_rebate_rate"` GasFeeAmount decimal.Decimal `json:"gasFeeAmount" db:"gas_fee_amount"` JSON string `json:"json" db:"json"` CreatedAt time.Time `json:"createdAt" db:"created_at"` UpdatedAt time.Time `json:"updatedAt" db:"updated_at"` }
func (*Order) AutoSetStatusByAmounts ¶
func (o *Order) AutoSetStatusByAmounts()
func (Order) GetOrderJson ¶
type OrderByDirection ¶
type OrderByDirection uint
const ( OrderByAsc OrderByDirection = iota OrderByDesc )
type OrderJSON ¶
type OrderJSON struct { Trader string `json:"trader"` Relayer string `json:"relayer"` BaseCurrencyHugeAmount decimal.Decimal `json:"baseTokenAmount"` QuoteCurrencyHugeAmount decimal.Decimal `json:"quoteTokenAmount"` BaseCurrency string `json:"baseToken"` QuoteCurrency string `json:"quoteToken"` GasTokenHugeAmount decimal.Decimal `json:"gasTokenAmount"` Signature string `json:"signature"` Data string `json:"data"` }
type Trade ¶
type Trade struct { ID int64 `json:"id" db:"id" primaryKey:"true" autoIncrement:"true"` TransactionID int64 `json:"transactionID" db:"transaction_id"` TransactionHash string `json:"transactionHash" db:"transaction_hash"` Status string `json:"status" db:"status"` MarketID string `json:"marketID" db:"market_id"` Maker string `json:"maker" db:"maker"` Taker string `json:"taker" db:"taker"` TakerSide string `json:"takerSide" db:"taker_side"` MakerOrderID string `json:"makerOrderID" db:"maker_order_id"` TakerOrderID string `json:"takerOrderID" db:"taker_order_id"` Sequence int `json:"sequence" db:"sequence"` Amount decimal.Decimal `json:"amount" db:"amount"` Price decimal.Decimal `json:"price" db:"price"` ExecutedAt time.Time `json:"executedAt" db:"executed_at"` CreatedAt time.Time `json:"createdAt" db:"created_at"` UpdatedAt time.Time `json:"updatedAt" db:"updated_at"` }
type Transaction ¶
type Transaction struct { ID int64 `json:"id" db:"id" primaryKey:"true" autoIncrement:"true"` MarketID string `json:"marketID" db:"market_id"` TransactionHash *sql.NullString `json:"transactionHash" db:"transaction_hash"` Status string `json:"status" db:"status"` ExecutedAt time.Time `json:"executedAt" db:"executed_at"` UpdatedAt time.Time `json:"updatedAt" db:"updated_at"` CreatedAt time.Time `json:"createdAt" db:"created_at"` }
Click to show internal directories.
Click to hide internal directories.