Documentation ¶
Index ¶
- func InitSession(session *mgo.Session) (*mgo.Session, error)
- func LendingPairDaoDBOption(dbName string) func(dao *LendingPairDao) error
- func OrderDaoDBOption(dbName string) func(dao *OrderDao) error
- func PairDaoDBOption(dbName string) func(dao *PairDao) error
- type AccountDao
- func (dao *AccountDao) AddFavoriteToken(owner, token common.Address) error
- func (dao *AccountDao) Create(a *types.Account) error
- func (dao *AccountDao) DeleteFavoriteToken(owner, token common.Address) error
- func (dao *AccountDao) Drop()
- func (dao *AccountDao) FindOrCreate(addr common.Address) (*types.Account, error)
- func (dao *AccountDao) GetAll() (res []types.Account, err error)
- func (dao *AccountDao) GetByAddress(owner common.Address) (*types.Account, error)
- func (dao *AccountDao) GetByID(id bson.ObjectId) (*types.Account, error)
- func (dao *AccountDao) GetFavoriteTokens(owner common.Address) (map[common.Address]bool, error)
- func (dao *AccountDao) GetTokenBalance(owner common.Address, token common.Address) (*types.TokenBalance, error)
- func (dao *AccountDao) GetTokenBalances(owner common.Address) (map[common.Address]*types.TokenBalance, error)
- func (dao *AccountDao) Transfer(token common.Address, fromAddress common.Address, toAddress common.Address, ...) error
- func (dao *AccountDao) UpdateBalance(owner common.Address, token common.Address, balance *big.Int) error
- func (dao *AccountDao) UpdateTokenBalance(owner, token common.Address, tokenBalance *types.TokenBalance) error
- type AssociationDao
- func (dao *AssociationDao) Drop()
- func (dao *AssociationDao) GetAssociationByChainAddress(chain types.Chain, userAddress common.Address) (*types.AddressAssociationRecord, error)
- func (dao *AssociationDao) GetAssociationByChainAssociatedAddress(chain types.Chain, associatedAddress common.Address) (*types.AddressAssociationRecord, error)
- func (dao *AssociationDao) SaveAssociation(record *types.AddressAssociationRecord) error
- func (dao *AssociationDao) SaveAssociationStatus(chain types.Chain, sourceAccount common.Address, status string) error
- func (dao *AssociationDao) SaveDepositTransaction(chain types.Chain, sourceAccount common.Address, txEnvelope string) error
- type ConfigDao
- func (dao *ConfigDao) Drop()
- func (dao *ConfigDao) GetAddressIndex(chain types.Chain) (uint64, error)
- func (dao *ConfigDao) GetBlockToProcess(chain types.Chain) (uint64, error)
- func (dao *ConfigDao) GetSchemaVersion() uint64
- func (dao *ConfigDao) IncrementAddressIndex(chain types.Chain) error
- func (dao *ConfigDao) ResetBlockCounters() error
- func (dao *ConfigDao) SaveLastProcessedBlock(chain types.Chain, block uint64) error
- type Database
- func (d *Database) Aggregate(dbName, collection string, query []bson.M, response interface{}) error
- func (d *Database) AggregateEx(dbName, collection string, query []bson.M, response interface{}) error
- func (d *Database) ChangeAll(dbName, collection string, query interface{}, update interface{}) (*mgo.ChangeInfo, error)
- func (d *Database) Count(dbName, collection string, query interface{}) (int, error)
- func (d *Database) Create(dbName, collection string, data ...interface{}) (err error)
- func (d *Database) DropCollection(dbName, collection string) error
- func (d *Database) FindAndModify(dbName, collection string, query interface{}, change mgo.Change, ...) error
- func (d *Database) Get(dbName, collection string, query interface{}, offset, limit int, ...) (err error)
- func (d *Database) GetAndSort(dbName, collection string, query interface{}, sort []string, offset, limit int, ...) (err error)
- func (d *Database) GetByID(dbName, collection string, id bson.ObjectId, response interface{}) (err error)
- func (d *Database) GetCollection(dbName, collection string) *mgo.Collection
- func (d *Database) GetEx(dbName, collection string, query interface{}, sort []string, offset, limit int, ...) (count int, err error)
- func (d *Database) GetOne(dbName, collection string, query interface{}, response interface{}) (err error)
- func (d *Database) GetSortOne(dbName, collection string, query interface{}, sort []string, ...) (err error)
- func (d *Database) InitDatabase(session *mgo.Session)
- func (d *Database) Query(dbName, collection string, query interface{}, selector interface{}, ...) (err error)
- func (d *Database) Remove(dbName, collection string, query []bson.M) error
- func (d *Database) RemoveAll(dbName, collection string, query interface{}) error
- func (d *Database) RemoveItem(dbName, collection string, query interface{}) error
- func (d *Database) Update(dbName, collection string, query interface{}, update interface{}) error
- func (d *Database) UpdateAll(dbName, collection string, query interface{}, update interface{}) error
- func (d *Database) Upsert(dbName, collection string, query interface{}, update interface{}) (interface{}, error)
- func (d *Database) Watch(dbName, collection string, options mgo.ChangeStreamOptions) (*mgo.ChangeStream, *mgo.Session, error)
- type LendingOrderDao
- func (dao *LendingOrderDao) AddNewLendingOrder(o *types.LendingOrder) error
- func (dao *LendingOrderDao) CancelLendingOrder(o *types.LendingOrder) error
- func (dao *LendingOrderDao) Create(o *types.LendingOrder) error
- func (dao *LendingOrderDao) Drop() error
- func (dao *LendingOrderDao) GetByHash(hash common.Hash) (*types.LendingOrder, error)
- func (dao *LendingOrderDao) GetByID(id bson.ObjectId) (*types.LendingOrder, error)
- func (dao *LendingOrderDao) GetCollection() *mgo.Collection
- func (dao *LendingOrderDao) GetLastTokenPrice(bToken common.Address, qToken common.Address) (*big.Int, error)
- func (dao *LendingOrderDao) GetLendingNonce(userAddress common.Address) (uint64, error)
- func (dao *LendingOrderDao) GetLendingOrderBook(term uint64, lendingToken common.Address) ([]map[string]string, []map[string]string, error)
- func (dao *LendingOrderDao) GetLendingOrderBookInDb(term uint64, lendingToken common.Address) ([]map[string]string, []map[string]string, error)
- func (dao *LendingOrderDao) GetLendingOrderBookInterest(term uint64, lendingToken common.Address, interest uint64, side string) (*big.Int, error)
- func (dao *LendingOrderDao) GetLendingOrders(lendingSpec types.LendingSpec, sort []string, offset int, size int) (*types.LendingRes, error)
- func (dao *LendingOrderDao) GetOrderCountByUserAddress(addr common.Address) (int, error)
- func (dao *LendingOrderDao) RepayLendingOrder(o *types.LendingOrder) error
- func (dao *LendingOrderDao) TopupLendingOrder(o *types.LendingOrder) error
- func (dao *LendingOrderDao) UpdateFilledAmount(hash common.Hash, value *big.Int) error
- func (dao *LendingOrderDao) UpdateStatus(h common.Hash, status string) error
- func (dao *LendingOrderDao) Watch() (*mgo.ChangeStream, *mgo.Session, error)
- type LendingOrderDaoOption
- type LendingOrderMsg
- type LendingPairDao
- func (dao *LendingPairDao) Create(pair *types.LendingPair) error
- func (dao *LendingPairDao) DeleteByLendingKey(term uint64, lendingAddress common.Address) error
- func (dao *LendingPairDao) DeleteByLendingKeyAndCoinbase(term uint64, lendingAddress common.Address, addr common.Address) error
- func (dao *LendingPairDao) GetAll() ([]types.LendingPair, error)
- func (dao *LendingPairDao) GetAllByCoinbase(addr common.Address) ([]types.LendingPair, error)
- func (dao *LendingPairDao) GetByID(id bson.ObjectId) (*types.LendingPair, error)
- func (dao *LendingPairDao) GetByLendingID(term uint64, lendingAddress common.Address) (*types.LendingPair, error)
- type LendingPairDaoOption
- type LendingTradeDao
- func (dao *LendingTradeDao) Aggregate(q []bson.M) ([]*types.Tick, error)
- func (dao *LendingTradeDao) Create(trades ...*types.LendingTrade) error
- func (dao *LendingTradeDao) GetAll() ([]types.LendingTrade, error)
- func (dao *LendingTradeDao) GetByHash(h common.Hash) (*types.LendingTrade, error)
- func (dao *LendingTradeDao) GetByUserAddress(a common.Address) ([]*types.LendingTrade, error)
- func (dao *LendingTradeDao) GetCollection() *mgo.Collection
- func (dao *LendingTradeDao) GetLendingTradeByOrderBook(term uint64, lendingToken common.Address, from, to int64, n int) ([]*types.LendingTrade, error)
- func (dao *LendingTradeDao) GetLendingTradeByTime(dateFrom, dateTo int64, pageOffset int, pageSize int) ([]*types.LendingTrade, error)
- func (dao *LendingTradeDao) GetLendingTrades(lendingtradeSpec *types.LendingTradeSpec, sortedBy []string, pageOffset int, ...) (*types.LendingTradeRes, error)
- func (dao *LendingTradeDao) GetLendingTradesUserHistory(a common.Address, lendingtradeSpec *types.LendingTradeSpec, sortedBy []string, ...) (*types.LendingTradeRes, error)
- func (dao *LendingTradeDao) GetSortedLendingTradesByUserAddress(a, bt, qt common.Address, from, to int64, limit ...int) ([]*types.LendingTrade, error)
- func (dao *LendingTradeDao) Update(trade *types.LendingTrade) error
- func (dao *LendingTradeDao) UpdateTradeStatus(h common.Hash, status string) error
- func (dao *LendingTradeDao) Upsert(id bson.ObjectId, t *types.LendingTrade) error
- func (dao *LendingTradeDao) UpsertByHash(h common.Hash, t *types.LendingTrade) error
- func (dao *LendingTradeDao) Watch() (*mgo.ChangeStream, *mgo.Session, error)
- type NotificationDao
- func (dao *NotificationDao) Aggregate(q []bson.M) ([]*types.Notification, error)
- func (dao *NotificationDao) Create(notifications ...*types.Notification) ([]*types.Notification, error)
- func (dao *NotificationDao) Delete(notifications ...*types.Notification) error
- func (dao *NotificationDao) DeleteByIds(ids ...bson.ObjectId) error
- func (dao *NotificationDao) Drop()
- func (dao *NotificationDao) FindAndModify(id bson.ObjectId, n *types.Notification) (*types.Notification, error)
- func (dao *NotificationDao) GetAll() ([]types.Notification, error)
- func (dao *NotificationDao) GetByID(id bson.ObjectId) (*types.Notification, error)
- func (dao *NotificationDao) GetByUserAddress(addr common.Address, limit int, offset int) ([]*types.Notification, error)
- func (dao *NotificationDao) GetSortDecByUserAddress(addr common.Address, limit int, offset int) ([]*types.Notification, error)
- func (dao *NotificationDao) MarkAllRead(addr common.Address) error
- func (dao *NotificationDao) MarkRead(id bson.ObjectId) error
- func (dao *NotificationDao) MarkStatus(id bson.ObjectId, status string) error
- func (dao *NotificationDao) MarkUnRead(id bson.ObjectId) error
- func (dao *NotificationDao) Update(n *types.Notification) error
- func (dao *NotificationDao) Upsert(id bson.ObjectId, n *types.Notification) error
- type OHLCVDao
- type OrderDao
- func (dao *OrderDao) AddNewOrder(o *types.Order, topic string) error
- func (dao *OrderDao) Aggregate(q []bson.M) ([]*types.OrderData, error)
- func (dao *OrderDao) CancelOrder(o *types.Order, topic string) error
- func (dao *OrderDao) Create(o *types.Order) error
- func (dao *OrderDao) Delete(orders ...*types.Order) error
- func (dao *OrderDao) DeleteByHashes(hashes ...common.Hash) error
- func (dao *OrderDao) Drop() error
- func (dao *OrderDao) FindAndModify(h common.Hash, o *types.Order) (*types.Order, error)
- func (dao *OrderDao) GetByHash(hash common.Hash) (*types.Order, error)
- func (dao *OrderDao) GetByHashes(hashes []common.Hash) ([]*types.Order, error)
- func (dao *OrderDao) GetByID(id bson.ObjectId) (*types.Order, error)
- func (dao *OrderDao) GetByUserAddress(addr, bt, qt common.Address, from, to int64, limit ...int) ([]*types.Order, error)
- func (dao *OrderDao) GetCollection() *mgo.Collection
- func (dao *OrderDao) GetCurrentByUserAddress(addr common.Address, limit ...int) ([]*types.Order, error)
- func (dao *OrderDao) GetHistoryByUserAddress(addr, bt, qt common.Address, from, to int64, limit ...int) ([]*types.Order, error)
- func (dao *OrderDao) GetOpenOrders() ([]*types.Order, error)
- func (dao *OrderDao) GetOpenOrdersByUserAddress(addr common.Address) ([]*types.Order, error)
- func (dao *OrderDao) GetOrderBook(p *types.Pair) ([]map[string]string, []map[string]string, error)
- func (dao *OrderDao) GetOrderBookInDb(p *types.Pair) ([]map[string]string, []map[string]string, error)
- func (dao *OrderDao) GetOrderBookPricePoint(p *types.Pair, pp *big.Int, side string) (*big.Int, error)
- func (dao *OrderDao) GetOrderCountByUserAddress(addr common.Address) (int, error)
- func (dao *OrderDao) GetOrderNonce(userAddress common.Address) (interface{}, error)
- func (dao *OrderDao) GetOrders(orderSpec types.OrderSpec, sort []string, offset int, size int) (*types.OrderRes, error)
- func (dao *OrderDao) GetRawOrderBook(p *types.Pair) ([]*types.Order, error)
- func (dao *OrderDao) GetSideOrderBook(p *types.Pair, side string, srt int, limit ...int) ([]map[string]string, error)
- func (dao *OrderDao) GetUserLockedBalance(account common.Address, token common.Address, pairs []*types.Pair) (*big.Int, error)
- func (dao *OrderDao) Update(id bson.ObjectId, o *types.Order) error
- func (dao *OrderDao) UpdateAllByHash(h common.Hash, o *types.Order) error
- func (dao *OrderDao) UpdateByHash(h common.Hash, o *types.Order) error
- func (dao *OrderDao) UpdateOrderFilledAmount(hash common.Hash, value *big.Int) error
- func (dao *OrderDao) UpdateOrderFilledAmounts(hashes []common.Hash, amount []*big.Int) ([]*types.Order, error)
- func (dao *OrderDao) UpdateOrderStatus(h common.Hash, status string) error
- func (dao *OrderDao) UpdateOrderStatusesByHashes(status string, hashes ...common.Hash) ([]*types.Order, error)
- func (dao *OrderDao) Upsert(id bson.ObjectId, o *types.Order) error
- func (dao *OrderDao) UpsertByHash(h common.Hash, o *types.Order) error
- func (dao *OrderDao) Watch() (*mgo.ChangeStream, *mgo.Session, error)
- type OrderDaoOption
- type OrderErrorMsg
- type OrderMsg
- type PairDao
- func (dao *PairDao) Create(pair *types.Pair) error
- func (dao *PairDao) DeleteByToken(baseAddress common.Address, quoteAddress common.Address) error
- func (dao *PairDao) DeleteByTokenAndCoinbase(baseAddress common.Address, quoteAddress common.Address, addr common.Address) error
- func (dao *PairDao) GetActivePairs() ([]*types.Pair, error)
- func (dao *PairDao) GetActivePairsByCoinbase(addr common.Address) ([]*types.Pair, error)
- func (dao *PairDao) GetAll() ([]types.Pair, error)
- func (dao *PairDao) GetAllByCoinbase(addr common.Address) ([]types.Pair, error)
- func (dao *PairDao) GetByID(id bson.ObjectId) (*types.Pair, error)
- func (dao *PairDao) GetByName(name string) (*types.Pair, error)
- func (dao *PairDao) GetByTokenAddress(baseToken, quoteToken common.Address) (*types.Pair, error)
- func (dao *PairDao) GetByTokenSymbols(baseTokenSymbol, quoteTokenSymbol string) (*types.Pair, error)
- func (dao *PairDao) GetListedPairs() ([]types.Pair, error)
- func (dao *PairDao) GetUnlistedPairs() ([]types.Pair, error)
- type PairDaoOption
- type RelayerDao
- func (dao *RelayerDao) Create(a *types.Relayer) error
- func (dao *RelayerDao) DeleteByAddress(addr common.Address) error
- func (dao *RelayerDao) FindOrCreate(addr common.Address) (*types.Relayer, error)
- func (dao *RelayerDao) GetAll() (res []types.Relayer, err error)
- func (dao *RelayerDao) GetByAddress(owner common.Address) (*types.Relayer, error)
- func (dao *RelayerDao) GetByHost(host string) (*types.Relayer, error)
- func (dao *RelayerDao) GetByID(id bson.ObjectId) (*types.Relayer, error)
- func (dao *RelayerDao) UpdateByAddress(addr common.Address, relayer *types.Relayer) error
- func (dao *RelayerDao) UpdateNameByAddress(addr common.Address, name string, url string) error
- type TokenDao
- func (dao *TokenDao) Create(token *types.Token) error
- func (dao *TokenDao) DeleteByToken(contractAddress common.Address) error
- func (dao *TokenDao) DeleteByTokenAndCoinbase(contractAddress common.Address, addr common.Address) error
- func (dao *TokenDao) Drop() error
- func (dao *TokenDao) GetAll() ([]types.Token, error)
- func (dao *TokenDao) GetAllByCoinbase(addr common.Address) ([]types.Token, error)
- func (dao *TokenDao) GetBaseTokens() ([]types.Token, error)
- func (dao *TokenDao) GetByAddress(addr common.Address) (*types.Token, error)
- func (dao *TokenDao) GetByID(id bson.ObjectId) (*types.Token, error)
- func (dao *TokenDao) GetBySymbol(symbol string) (*types.Token, error)
- func (dao *TokenDao) GetQuoteTokens() ([]types.Token, error)
- func (dao *TokenDao) UpdateByToken(addr common.Address, token *types.Token) error
- func (dao *TokenDao) UpdateByTokenAndCoinbase(addr common.Address, coinbase common.Address, token *types.Token) error
- func (dao *TokenDao) UpdateFiatPriceBySymbol(symbol string, price float64) error
- type TradeDao
- func (dao *TradeDao) Aggregate(q []bson.M) ([]*types.Tick, error)
- func (dao *TradeDao) Create(trades ...*types.Trade) error
- func (dao *TradeDao) Delete(trades ...*types.Trade) error
- func (dao *TradeDao) DeleteByHashes(hashes ...common.Hash) error
- func (dao *TradeDao) Drop()
- func (dao *TradeDao) FindAndModify(h common.Hash, t *types.Trade) (*types.Trade, error)
- func (dao *TradeDao) GetAll() ([]types.Trade, error)
- func (dao *TradeDao) GetAllTradesByPairAddress(bt, qt common.Address) ([]*types.Trade, error)
- func (dao *TradeDao) GetByHash(h common.Hash) (*types.Trade, error)
- func (dao *TradeDao) GetByMakerOrderHash(h common.Hash) ([]*types.Trade, error)
- func (dao *TradeDao) GetByOrderHashes(hashes []common.Hash) ([]*types.Trade, error)
- func (dao *TradeDao) GetByPairName(name string) ([]*types.Trade, error)
- func (dao *TradeDao) GetByTakerOrderHash(h common.Hash) ([]*types.Trade, error)
- func (dao *TradeDao) GetByUserAddress(a common.Address) ([]*types.Trade, error)
- func (dao *TradeDao) GetCollection() *mgo.Collection
- func (dao *TradeDao) GetLatestTrade(bt, qt common.Address) (*types.Trade, error)
- func (dao *TradeDao) GetNTradesByPairAddress(bt, qt common.Address, n int) ([]*types.Trade, error)
- func (dao *TradeDao) GetSortedTrades(bt, qt common.Address, from, to int64, n int) ([]*types.Trade, error)
- func (dao *TradeDao) GetSortedTradesByUserAddress(a, bt, qt common.Address, from, to int64, limit ...int) ([]*types.Trade, error)
- func (dao *TradeDao) GetTradeByTime(dateFrom, dateTo int64, pageOffset int, pageSize int) ([]*types.Trade, error)
- func (dao *TradeDao) GetTrades(tradeSpec *types.TradeSpec, sortedBy []string, pageOffset int, pageSize int) (*types.TradeRes, error)
- func (dao *TradeDao) GetTradesByPairAddress(bt, qt common.Address, n int) ([]*types.Trade, error)
- func (dao *TradeDao) GetTradesUserHistory(a common.Address, tradeSpec *types.TradeSpec, sortedBy []string, ...) (*types.TradeRes, error)
- func (dao *TradeDao) Update(trade *types.Trade) error
- func (dao *TradeDao) UpdateByHash(h common.Hash, t *types.Trade) error
- func (dao *TradeDao) UpdateTradeStatus(h common.Hash, status string) error
- func (dao *TradeDao) UpdateTradeStatuses(status string, hashes ...common.Hash) ([]*types.Trade, error)
- func (dao *TradeDao) UpdateTradeStatusesByHashes(status string, hashes ...common.Hash) ([]*types.Trade, error)
- func (dao *TradeDao) UpdateTradeStatusesByOrderHashes(status string, hashes ...common.Hash) ([]*types.Trade, error)
- func (dao *TradeDao) Upsert(id bson.ObjectId, t *types.Trade) error
- func (dao *TradeDao) UpsertByHash(h common.Hash, t *types.Trade) error
- func (dao *TradeDao) Watch() (*mgo.ChangeStream, *mgo.Session, error)
- type WalletDao
- func (dao *WalletDao) Create(wallet *types.Wallet) error
- func (dao *WalletDao) GetAll() ([]types.Wallet, error)
- func (dao *WalletDao) GetByAddress(a common.Address) (*types.Wallet, error)
- func (dao *WalletDao) GetByID(id bson.ObjectId) (*types.Wallet, error)
- func (dao *WalletDao) GetDefaultAdminWallet() (*types.Wallet, error)
- func (dao *WalletDao) GetOperatorWallets() ([]*types.Wallet, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitSession ¶
InitSession initializes a new session with mongodb
func LendingPairDaoDBOption ¶ added in v1.2.0
func LendingPairDaoDBOption(dbName string) func(dao *LendingPairDao) error
LendingPairDaoDBOption option
func OrderDaoDBOption ¶
func PairDaoDBOption ¶
Types ¶
type AccountDao ¶
type AccountDao struct {
// contains filtered or unexported fields
}
AccountDao contains: collectionName: MongoDB collection name dbName: name of mongodb to interact with
func NewAccountDao ¶
func NewAccountDao() *AccountDao
NewAccountDao returns a new instance of AddressDao
func (*AccountDao) AddFavoriteToken ¶
func (dao *AccountDao) AddFavoriteToken(owner, token common.Address) error
func (*AccountDao) Create ¶
func (dao *AccountDao) Create(a *types.Account) error
Create function performs the DB insertion task for Balance collection
func (*AccountDao) DeleteFavoriteToken ¶
func (dao *AccountDao) DeleteFavoriteToken(owner, token common.Address) error
func (*AccountDao) Drop ¶
func (dao *AccountDao) Drop()
Drop drops all the order documents in the current database
func (*AccountDao) FindOrCreate ¶
func (*AccountDao) GetByAddress ¶
func (*AccountDao) GetFavoriteTokens ¶
func (*AccountDao) GetTokenBalance ¶
func (dao *AccountDao) GetTokenBalance(owner common.Address, token common.Address) (*types.TokenBalance, error)
func (*AccountDao) GetTokenBalances ¶
func (dao *AccountDao) GetTokenBalances(owner common.Address) (map[common.Address]*types.TokenBalance, error)
func (*AccountDao) UpdateBalance ¶
func (*AccountDao) UpdateTokenBalance ¶
func (dao *AccountDao) UpdateTokenBalance(owner, token common.Address, tokenBalance *types.TokenBalance) error
type AssociationDao ¶
type AssociationDao struct {
// contains filtered or unexported fields
}
AssociationDao contains: collectionName: MongoDB collection name dbName: name of mongodb to interact with
func NewAssociationDao ¶
func NewAssociationDao() *AssociationDao
NewBalanceDao returns a new instance of AddressDao
func (*AssociationDao) Drop ¶
func (dao *AssociationDao) Drop()
Drop drops all the order documents in the current database
func (*AssociationDao) GetAssociationByChainAddress ¶
func (dao *AssociationDao) GetAssociationByChainAddress(chain types.Chain, userAddress common.Address) (*types.AddressAssociationRecord, error)
func (*AssociationDao) GetAssociationByChainAssociatedAddress ¶
func (dao *AssociationDao) GetAssociationByChainAssociatedAddress(chain types.Chain, associatedAddress common.Address) (*types.AddressAssociationRecord, error)
func (*AssociationDao) SaveAssociation ¶
func (dao *AssociationDao) SaveAssociation(record *types.AddressAssociationRecord) error
SaveAssociation using upsert to update for existing users, only update allowed fields
func (*AssociationDao) SaveAssociationStatus ¶
func (*AssociationDao) SaveDepositTransaction ¶
func (dao *AssociationDao) SaveDepositTransaction(chain types.Chain, sourceAccount common.Address, txEnvelope string) error
SaveDepositTransaction update the transaction envelope for association item
type ConfigDao ¶
type ConfigDao struct {
// contains filtered or unexported fields
}
ConfigDao contains: collectionName: MongoDB collection name dbName: name of mongodb to interact with
func NewConfigDao ¶
func NewConfigDao() *ConfigDao
NewBalanceDao returns a new instance of AddressDao
func (*ConfigDao) Drop ¶
func (dao *ConfigDao) Drop()
Drop drops all the order documents in the current database
func (*ConfigDao) GetAddressIndex ¶
func (*ConfigDao) GetBlockToProcess ¶
func (*ConfigDao) GetSchemaVersion ¶
func (*ConfigDao) IncrementAddressIndex ¶
func (*ConfigDao) ResetBlockCounters ¶
ResetBlockCounters changes last processed bitcoin and ethereum block to default value. Used in stress tests.
type Database ¶
Database struct contains the pointer to mgo.session It is a wrapper over mgo to help utilize mgo connection pool
func (*Database) Aggregate ¶
Aggregate is a wrapper for mgo.Pipe function. It is used to make mongo aggregate pipeline queries It creates a copy of session initialized, sends query over this session and returns the session to connection pool
func (*Database) AggregateEx ¶
func (d *Database) AggregateEx(dbName, collection string, query []bson.M, response interface{}) error
AggregateEx add collation
func (*Database) ChangeAll ¶
func (d *Database) ChangeAll(dbName, collection string, query interface{}, update interface{}) (*mgo.ChangeInfo, error)
ChangeAll update all document and return change information
func (*Database) Create ¶
Create is a wrapper for mgo.Insert function. It creates a copy of session initialized, sends query over this session and returns the session to connection pool
func (*Database) DropCollection ¶
DropCollection drops all the documents in a collection
func (*Database) FindAndModify ¶
func (*Database) Get ¶
func (d *Database) Get(dbName, collection string, query interface{}, offset, limit int, response interface{}) (err error)
Get is a wrapper for mgo.Find function. It creates a copy of session initialized, sends query over this session and returns the session to connection pool
func (*Database) GetAndSort ¶
func (d *Database) GetAndSort(dbName, collection string, query interface{}, sort []string, offset, limit int, response interface{}) (err error)
GetAndSort is a wrapper for mgo.Find function with SORT function in pipeline. It creates a copy of session initialized, sends query over this session and returns the session to connection pool
func (*Database) GetByID ¶
func (d *Database) GetByID(dbName, collection string, id bson.ObjectId, response interface{}) (err error)
GetByID is a wrapper for mgo.FindId function. It creates a copy of session initialized, sends query over this session and returns the session to connection pool
func (*Database) GetCollection ¶
func (d *Database) GetCollection(dbName, collection string) *mgo.Collection
func (*Database) GetEx ¶
func (d *Database) GetEx(dbName, collection string, query interface{}, sort []string, offset, limit int, response interface{}) (count int, err error)
GetEx extend get function
func (*Database) GetOne ¶
func (d *Database) GetOne(dbName, collection string, query interface{}, response interface{}) (err error)
GetOne return one document
func (*Database) GetSortOne ¶
func (d *Database) GetSortOne(dbName, collection string, query interface{}, sort []string, response interface{}) (err error)
GetSortOne is a wrapper for mgo.Find function with SORT function in pipeline. It creates a copy of session initialized, sends query over this session and returns the session to connection pool
func (*Database) InitDatabase ¶
func (*Database) RemoveAll ¶
RemoveAll removes all the documents from a collection matching a certain query
func (*Database) RemoveItem ¶
Remove removes one document matching a certain query
func (*Database) Update ¶
Update is a wrapper for mgo.Update function. It creates a copy of session initialized, sends query over this session and returns the session to connection pool
type LendingOrderDao ¶ added in v1.2.0
type LendingOrderDao struct {
// contains filtered or unexported fields
}
LendingOrderDao contains: collectionName: MongoDB collection name dbName: name of mongodb to interact with
func NewLendingOrderDao ¶ added in v1.2.0
func NewLendingOrderDao(opts ...LendingOrderDaoOption) *LendingOrderDao
NewLendingOrderDao returns a new instance of LendingOrderDao
func NewRecallDao ¶ added in v1.2.0
func NewRecallDao(opts ...LendingOrderDaoOption) *LendingOrderDao
NewRecallDao recall dao
func NewRepayDao ¶ added in v1.2.0
func NewRepayDao(opts ...LendingOrderDaoOption) *LendingOrderDao
NewRepayDao repay dao
func NewTopupDao ¶ added in v1.2.0
func NewTopupDao(opts ...LendingOrderDaoOption) *LendingOrderDao
NewTopupDao topup dao
func (*LendingOrderDao) AddNewLendingOrder ¶ added in v1.2.0
func (dao *LendingOrderDao) AddNewLendingOrder(o *types.LendingOrder) error
AddNewLendingOrder add order
func (*LendingOrderDao) CancelLendingOrder ¶ added in v1.2.0
func (dao *LendingOrderDao) CancelLendingOrder(o *types.LendingOrder) error
CancelLendingOrder cancel order
func (*LendingOrderDao) Create ¶ added in v1.2.0
func (dao *LendingOrderDao) Create(o *types.LendingOrder) error
Create function performs the DB insertion task for LendingOrder collection
func (*LendingOrderDao) Drop ¶ added in v1.2.0
func (dao *LendingOrderDao) Drop() error
Drop drops all the order documents in the current database
func (*LendingOrderDao) GetByHash ¶ added in v1.2.0
func (dao *LendingOrderDao) GetByHash(hash common.Hash) (*types.LendingOrder, error)
GetByHash function fetches a single document from order collection based on mongoDB ID. Returns LendingOrder type struct
func (*LendingOrderDao) GetByID ¶ added in v1.2.0
func (dao *LendingOrderDao) GetByID(id bson.ObjectId) (*types.LendingOrder, error)
GetByID function fetches a single document from order collection based on mongoDB ID. Returns LendingOrder type struct
func (*LendingOrderDao) GetCollection ¶ added in v1.2.0
func (dao *LendingOrderDao) GetCollection() *mgo.Collection
GetCollection get collection name
func (*LendingOrderDao) GetLastTokenPrice ¶ added in v1.2.0
func (dao *LendingOrderDao) GetLastTokenPrice(bToken common.Address, qToken common.Address) (*big.Int, error)
GetLastTokenPrice get last token price
func (*LendingOrderDao) GetLendingNonce ¶ added in v1.2.0
func (dao *LendingOrderDao) GetLendingNonce(userAddress common.Address) (uint64, error)
GetLendingNonce get nonce of lending order
func (*LendingOrderDao) GetLendingOrderBook ¶ added in v1.2.0
func (*LendingOrderDao) GetLendingOrderBookInDb ¶ added in v1.2.0
func (dao *LendingOrderDao) GetLendingOrderBookInDb(term uint64, lendingToken common.Address) ([]map[string]string, []map[string]string, error)
GetLendingOrderBook get lending order token
func (*LendingOrderDao) GetLendingOrderBookInterest ¶ added in v1.2.0
func (dao *LendingOrderDao) GetLendingOrderBookInterest(term uint64, lendingToken common.Address, interest uint64, side string) (*big.Int, error)
GetLendingOrderBookInterest get amount from interest
func (*LendingOrderDao) GetLendingOrders ¶ added in v1.2.0
func (dao *LendingOrderDao) GetLendingOrders(lendingSpec types.LendingSpec, sort []string, offset int, size int) (*types.LendingRes, error)
GetLendingOrders filter lending order
func (*LendingOrderDao) GetOrderCountByUserAddress ¶ added in v1.2.0
func (dao *LendingOrderDao) GetOrderCountByUserAddress(addr common.Address) (int, error)
GetOrderCountByUserAddress get the total number of orders created by a user Return an integer and error
func (*LendingOrderDao) RepayLendingOrder ¶ added in v1.2.0
func (dao *LendingOrderDao) RepayLendingOrder(o *types.LendingOrder) error
RepayLendingOrder send repay transaction
func (*LendingOrderDao) TopupLendingOrder ¶ added in v1.2.0
func (dao *LendingOrderDao) TopupLendingOrder(o *types.LendingOrder) error
TopupLendingOrder send top up lending transaction
func (*LendingOrderDao) UpdateFilledAmount ¶ added in v1.2.0
UpdateFilledAmount update lending amount
func (*LendingOrderDao) UpdateStatus ¶ added in v1.2.0
func (dao *LendingOrderDao) UpdateStatus(h common.Hash, status string) error
UpdateStatus update lending status
func (*LendingOrderDao) Watch ¶ added in v1.2.0
func (dao *LendingOrderDao) Watch() (*mgo.ChangeStream, *mgo.Session, error)
Watch watch chaging database
type LendingOrderDaoOption ¶ added in v1.2.0
type LendingOrderDaoOption = func(*LendingOrderDao) error
LendingOrderDaoOption opts for database option
type LendingOrderMsg ¶ added in v1.2.0
type LendingOrderMsg struct { AccountNonce hexutil.Uint64 `json:"nonce" gencodec:"required"` Quantity hexutil.Big `json:"quantity,omitempty"` RelayerAddress common.Address `json:"relayerAddress,omitempty"` UserAddress common.Address `json:"userAddress,omitempty"` CollateralToken common.Address `json:"collateralToken,omitempty"` LendingToken common.Address `json:"lendingToken,omitempty"` Interest hexutil.Uint64 `json:"interest,omitempty"` Term hexutil.Uint64 `json:"term,omitempty"` Status string `json:"status,omitempty"` Side string `json:"side,omitempty"` Type string `json:"type,omitempty"` LendingID hexutil.Uint64 `json:"lendingID,omitempty"` LendingTradeID hexutil.Uint64 `json:"tradeId,omitempty"` AutoTopUp bool `json:"autoTopUp,omitempty"` // Signature values V hexutil.Big `json:"v" gencodec:"required"` R hexutil.Big `json:"r" gencodec:"required"` S hexutil.Big `json:"s" gencodec:"required"` // This is only used when marshaling to JSON. Hash common.Hash `json:"hash" rlp:"-"` }
LendingOrderMsg for tomox rpc
type LendingPairDao ¶ added in v1.2.0
type LendingPairDao struct {
// contains filtered or unexported fields
}
LendingPairDao contains: collectionName: MongoDB collection name dbName: name of mongodb to interact with
func NewLendingPairDao ¶ added in v1.2.0
func NewLendingPairDao(options ...LendingPairDaoOption) *LendingPairDao
NewLendingPairDao returns a new instance of AddressDao
func (*LendingPairDao) Create ¶ added in v1.2.0
func (dao *LendingPairDao) Create(pair *types.LendingPair) error
Create function performs the DB insertion task for pair collection
func (*LendingPairDao) DeleteByLendingKey ¶ added in v1.2.0
func (dao *LendingPairDao) DeleteByLendingKey(term uint64, lendingAddress common.Address) error
DeleteByLendingKey delete token by term and lending token address
func (*LendingPairDao) DeleteByLendingKeyAndCoinbase ¶ added in v1.2.0
func (*LendingPairDao) GetAll ¶ added in v1.2.0
func (dao *LendingPairDao) GetAll() ([]types.LendingPair, error)
GetAll function fetches all the pairs in the pair collection of mongodb. for GetAll return continous memory
func (*LendingPairDao) GetAllByCoinbase ¶ added in v1.2.0
func (dao *LendingPairDao) GetAllByCoinbase(addr common.Address) ([]types.LendingPair, error)
func (*LendingPairDao) GetByID ¶ added in v1.2.0
func (dao *LendingPairDao) GetByID(id bson.ObjectId) (*types.LendingPair, error)
GetByID function fetches details of a pair using pair's mongo ID.
func (*LendingPairDao) GetByLendingID ¶ added in v1.2.0
func (dao *LendingPairDao) GetByLendingID(term uint64, lendingAddress common.Address) (*types.LendingPair, error)
GetByLendingID get pair from lending token and term
type LendingPairDaoOption ¶ added in v1.2.0
type LendingPairDaoOption = func(*LendingPairDao) error
LendingPairDaoOption option
type LendingTradeDao ¶ added in v1.2.0
type LendingTradeDao struct {
// contains filtered or unexported fields
}
LendingTradeDao contains: collectionName: MongoDB collection name dbName: name of mongodb to interact with
func NewLendingTradeDao ¶ added in v1.2.0
func NewLendingTradeDao() *LendingTradeDao
NewLendingTradeDao returns a new instance of LendingTradeDao.
func (*LendingTradeDao) Aggregate ¶ added in v1.2.0
Aggregate function calls the aggregate pipeline of mongodb
func (*LendingTradeDao) Create ¶ added in v1.2.0
func (dao *LendingTradeDao) Create(trades ...*types.LendingTrade) error
Create function performs the DB insertion task for trade collection It accepts 1 or more trades as input. All the trades are inserted in one query itself.
func (*LendingTradeDao) GetAll ¶ added in v1.2.0
func (dao *LendingTradeDao) GetAll() ([]types.LendingTrade, error)
GetAll function fetches all the trades in mongodb
func (*LendingTradeDao) GetByHash ¶ added in v1.2.0
func (dao *LendingTradeDao) GetByHash(h common.Hash) (*types.LendingTrade, error)
GetByHash fetches the first record that matches a certain hash
func (*LendingTradeDao) GetByUserAddress ¶ added in v1.2.0
func (dao *LendingTradeDao) GetByUserAddress(a common.Address) ([]*types.LendingTrade, error)
GetByUserAddress fetches all the trades corresponding to a particular user address.
func (*LendingTradeDao) GetCollection ¶ added in v1.2.0
func (dao *LendingTradeDao) GetCollection() *mgo.Collection
GetCollection get trade collection name
func (*LendingTradeDao) GetLendingTradeByOrderBook ¶ added in v1.2.0
func (dao *LendingTradeDao) GetLendingTradeByOrderBook(term uint64, lendingToken common.Address, from, to int64, n int) ([]*types.LendingTrade, error)
GetLendingTradeByOrderBook get trade by term and lendingToken
func (*LendingTradeDao) GetLendingTradeByTime ¶ added in v1.2.0
func (dao *LendingTradeDao) GetLendingTradeByTime(dateFrom, dateTo int64, pageOffset int, pageSize int) ([]*types.LendingTrade, error)
GetLendingTradeByTime get range trade
func (*LendingTradeDao) GetLendingTrades ¶ added in v1.2.0
func (dao *LendingTradeDao) GetLendingTrades(lendingtradeSpec *types.LendingTradeSpec, sortedBy []string, pageOffset int, pageSize int) (*types.LendingTradeRes, error)
GetLendingTrades get user lending trade
func (*LendingTradeDao) GetLendingTradesUserHistory ¶ added in v1.2.0
func (dao *LendingTradeDao) GetLendingTradesUserHistory(a common.Address, lendingtradeSpec *types.LendingTradeSpec, sortedBy []string, pageOffset int, pageSize int) (*types.LendingTradeRes, error)
GetLendingTradesUserHistory get user lending trade history
func (*LendingTradeDao) GetSortedLendingTradesByUserAddress ¶ added in v1.2.0
func (dao *LendingTradeDao) GetSortedLendingTradesByUserAddress(a, bt, qt common.Address, from, to int64, limit ...int) ([]*types.LendingTrade, error)
GetSortedLendingTradesByUserAddress get trade of user address
func (*LendingTradeDao) Update ¶ added in v1.2.0
func (dao *LendingTradeDao) Update(trade *types.LendingTrade) error
Update update lending trade record
func (*LendingTradeDao) UpdateTradeStatus ¶ added in v1.2.0
func (dao *LendingTradeDao) UpdateTradeStatus(h common.Hash, status string) error
UpdateTradeStatus update trade status
func (*LendingTradeDao) Upsert ¶ added in v1.2.0
func (dao *LendingTradeDao) Upsert(id bson.ObjectId, t *types.LendingTrade) error
Upsert update lending trade record by id
func (*LendingTradeDao) UpsertByHash ¶ added in v1.2.0
func (dao *LendingTradeDao) UpsertByHash(h common.Hash, t *types.LendingTrade) error
UpsertByHash update lending trade record by hash
func (*LendingTradeDao) Watch ¶ added in v1.2.0
func (dao *LendingTradeDao) Watch() (*mgo.ChangeStream, *mgo.Session, error)
Watch changing database
type NotificationDao ¶
type NotificationDao struct {
// contains filtered or unexported fields
}
func NewNotificationDao ¶
func NewNotificationDao() *NotificationDao
func (*NotificationDao) Aggregate ¶
func (dao *NotificationDao) Aggregate(q []bson.M) ([]*types.Notification, error)
Aggregate function calls the aggregate pipeline of mongodb
func (*NotificationDao) Create ¶
func (dao *NotificationDao) Create(notifications ...*types.Notification) ([]*types.Notification, error)
Create function performs the DB insertion task for notification collection It accepts 1 or more notifications as input. All the notifications are inserted in one query itself.
func (*NotificationDao) Delete ¶
func (dao *NotificationDao) Delete(notifications ...*types.Notification) error
func (*NotificationDao) DeleteByIds ¶
func (dao *NotificationDao) DeleteByIds(ids ...bson.ObjectId) error
func (*NotificationDao) Drop ¶
func (dao *NotificationDao) Drop()
Drop drops all the order documents in the current database
func (*NotificationDao) FindAndModify ¶
func (dao *NotificationDao) FindAndModify(id bson.ObjectId, n *types.Notification) (*types.Notification, error)
func (*NotificationDao) GetAll ¶
func (dao *NotificationDao) GetAll() ([]types.Notification, error)
GetAll function fetches all the notifications in the notification collection of mongodb.
func (*NotificationDao) GetByID ¶
func (dao *NotificationDao) GetByID(id bson.ObjectId) (*types.Notification, error)
GetByID function fetches details of a notification based on its mongo id
func (*NotificationDao) GetByUserAddress ¶
func (dao *NotificationDao) GetByUserAddress(addr common.Address, limit int, offset int) ([]*types.Notification, error)
GetByUserAddress function fetches list of orders from order collection based on user address. Returns array of Order type struct
func (*NotificationDao) GetSortDecByUserAddress ¶
func (dao *NotificationDao) GetSortDecByUserAddress(addr common.Address, limit int, offset int) ([]*types.Notification, error)
GetSortDecByUserAddress function fetches list of orders from order collection based on user address, result sorted by created date. Returns array of notification type struct
func (*NotificationDao) MarkAllRead ¶
func (dao *NotificationDao) MarkAllRead(addr common.Address) error
MarkAllRead update all UNREAD status to READ status
func (*NotificationDao) MarkRead ¶
func (dao *NotificationDao) MarkRead(id bson.ObjectId) error
MarkRead update UNREAD status to READ status
func (*NotificationDao) MarkStatus ¶
func (dao *NotificationDao) MarkStatus(id bson.ObjectId, status string) error
MarkStatus update UNREAD status to READ status
func (*NotificationDao) MarkUnRead ¶
func (dao *NotificationDao) MarkUnRead(id bson.ObjectId) error
MarkUnRead update READ status to UNREAD status
func (*NotificationDao) Update ¶
func (dao *NotificationDao) Update(n *types.Notification) error
func (*NotificationDao) Upsert ¶
func (dao *NotificationDao) Upsert(id bson.ObjectId, n *types.Notification) error
type OHLCVDao ¶ added in v1.2.0
type OHLCVDao struct {
// contains filtered or unexported fields
}
OHLCVDao for ohlcv database struct
func NewOHLCVDao ¶ added in v1.2.0
func NewOHLCVDao() *OHLCVDao
NewOHLCVDao for init ohlcv database struct
func (*OHLCVDao) Create ¶ added in v1.2.0
Create function performs the DB insertion task for token collection
type OrderDao ¶
type OrderDao struct {
// contains filtered or unexported fields
}
OrderDao contains: collectionName: MongoDB collection name dbName: name of mongodb to interact with
func NewOrderDao ¶
func NewOrderDao(opts ...OrderDaoOption) *OrderDao
NewOrderDao returns a new instance of OrderDao
func (*OrderDao) AddNewOrder ¶
AddNewOrder add order
func (*OrderDao) CancelOrder ¶
CancelOrder cancel order
func (*OrderDao) FindAndModify ¶
func (*OrderDao) GetByHash ¶
GetByHash function fetches a single document from order collection based on mongoDB ID. Returns Order type struct
func (*OrderDao) GetByHashes ¶
GetByHashes return Order DAO by address
func (*OrderDao) GetByID ¶
GetByID function fetches a single document from order collection based on mongoDB ID. Returns Order type struct
func (*OrderDao) GetByUserAddress ¶
func (dao *OrderDao) GetByUserAddress(addr, bt, qt common.Address, from, to int64, limit ...int) ([]*types.Order, error)
GetByUserAddress function fetches list of orders from order collection based on user address. Returns array of Order type struct
func (*OrderDao) GetCollection ¶
func (dao *OrderDao) GetCollection() *mgo.Collection
func (*OrderDao) GetCurrentByUserAddress ¶
func (dao *OrderDao) GetCurrentByUserAddress(addr common.Address, limit ...int) ([]*types.Order, error)
GetCurrentByUserAddress function fetches list of open/partial orders from order collection based on user address. Returns array of Order type struct
func (*OrderDao) GetHistoryByUserAddress ¶
func (dao *OrderDao) GetHistoryByUserAddress(addr, bt, qt common.Address, from, to int64, limit ...int) ([]*types.Order, error)
GetHistoryByUserAddress function fetches list of orders which are not in open/partial order status from order collection based on user address. Returns array of Order type struct
func (*OrderDao) GetOpenOrders ¶ added in v1.2.0
GetOpenOrders return all open orders
func (*OrderDao) GetOpenOrdersByUserAddress ¶
GetOpenOrdersByUserAddress function fetches list of open/partial filled orders from order collection based on user address. Returns array of Order type struct
func (*OrderDao) GetOrderBook ¶
func (*OrderDao) GetOrderBookInDb ¶ added in v1.2.0
func (dao *OrderDao) GetOrderBookInDb(p *types.Pair) ([]map[string]string, []map[string]string, error)
GetOrderBook get best bids descending and best asks ascending
func (*OrderDao) GetOrderBookPricePoint ¶
func (*OrderDao) GetOrderCountByUserAddress ¶
GetOrderCountByUserAddress get the total number of orders created by a user Return an integer and error
func (*OrderDao) GetOrderNonce ¶ added in v0.5.0
GetOrderNonce get nonce of order
func (*OrderDao) GetOrders ¶
func (dao *OrderDao) GetOrders(orderSpec types.OrderSpec, sort []string, offset int, size int) (*types.OrderRes, error)
GetOrders filter order
func (*OrderDao) GetRawOrderBook ¶
func (*OrderDao) GetSideOrderBook ¶
func (*OrderDao) GetUserLockedBalance ¶
func (dao *OrderDao) GetUserLockedBalance(account common.Address, token common.Address, pairs []*types.Pair) (*big.Int, error)
GetUserLockedBalance return balance using selling
func (*OrderDao) Update ¶
Update function performs the DB updations task for Order collection corresponding to a particular order ID
func (*OrderDao) UpdateAllByHash ¶
func (*OrderDao) UpdateByHash ¶
UpdateByHash updates fields that are considered updateable for an order.
func (*OrderDao) UpdateOrderFilledAmount ¶
func (*OrderDao) UpdateOrderFilledAmounts ¶
func (*OrderDao) UpdateOrderStatus ¶
func (*OrderDao) UpdateOrderStatusesByHashes ¶
func (*OrderDao) UpsertByHash ¶
type OrderDaoOption ¶
type OrderErrorMsg ¶ added in v1.2.0
type OrderErrorMsg struct {
Message string `json:"message,omitempty"`
}
type OrderMsg ¶ added in v0.5.0
type OrderMsg struct { AccountNonce hexutil.Uint64 `json:"nonce" gencodec:"required"` Quantity hexutil.Big `json:"quantity,omitempty"` Price hexutil.Big `json:"price,omitempty"` ExchangeAddress common.Address `json:"exchangeAddress,omitempty"` UserAddress common.Address `json:"userAddress,omitempty"` BaseToken common.Address `json:"baseToken,omitempty"` QuoteToken common.Address `json:"quoteToken,omitempty"` Status string `json:"status,omitempty"` Side string `json:"side,omitempty"` Type string `json:"type,omitempty"` OrderID hexutil.Uint64 `json:"orderid,omitempty"` // Signature values V hexutil.Big `json:"v" gencodec:"required"` R hexutil.Big `json:"r" gencodec:"required"` S hexutil.Big `json:"s" gencodec:"required"` // This is only used when marshaling to JSON. Hash common.Hash `json:"hash" rlp:"-"` }
type PairDao ¶
type PairDao struct {
// contains filtered or unexported fields
}
PairDao contains: collectionName: MongoDB collection name dbName: name of mongodb to interact with
func NewPairDao ¶
func NewPairDao(options ...PairDaoOption) *PairDao
NewPairDao returns a new instance of AddressDao
func (*PairDao) DeleteByToken ¶
DeleteByToken delete token by contract address
func (*PairDao) DeleteByTokenAndCoinbase ¶ added in v1.2.0
func (*PairDao) GetActivePairsByCoinbase ¶ added in v1.2.0
func (*PairDao) GetAll ¶
GetAll function fetches all the pairs in the pair collection of mongodb. for GetAll return continous memory
func (*PairDao) GetAllByCoinbase ¶ added in v1.2.0
func (*PairDao) GetByName ¶
GetByName function fetches details of a pair using pair's name. It makes CASE INSENSITIVE search query one pair's name
func (*PairDao) GetByTokenAddress ¶
GetByTokenAddress function fetches pair based on CONTRACT ADDRESS of base token and quote token
func (*PairDao) GetByTokenSymbols ¶
type PairDaoOption ¶
type RelayerDao ¶ added in v1.2.0
type RelayerDao struct {
// contains filtered or unexported fields
}
func NewRelayerDao ¶ added in v1.2.0
func NewRelayerDao() *RelayerDao
func (*RelayerDao) DeleteByAddress ¶ added in v1.2.0
func (dao *RelayerDao) DeleteByAddress(addr common.Address) error
func (*RelayerDao) FindOrCreate ¶ added in v1.2.0
func (*RelayerDao) GetAll ¶ added in v1.2.0
func (dao *RelayerDao) GetAll() (res []types.Relayer, err error)
func (*RelayerDao) GetByAddress ¶ added in v1.2.0
func (*RelayerDao) GetByHost ¶ added in v1.2.0
func (dao *RelayerDao) GetByHost(host string) (*types.Relayer, error)
func (*RelayerDao) UpdateByAddress ¶ added in v1.2.0
func (*RelayerDao) UpdateNameByAddress ¶ added in v1.2.0
type TokenDao ¶
type TokenDao struct {
// contains filtered or unexported fields
}
TokenDao contains: collectionName: MongoDB collection name dbName: name of mongodb to interact with
func NewCollateralTokenDao ¶ added in v1.2.0
func NewCollateralTokenDao() *TokenDao
NewCollateralTokenDao lending dao
func NewLendingTokenDao ¶ added in v1.2.0
func NewLendingTokenDao() *TokenDao
NewLendingTokenDao lending dao
func (*TokenDao) DeleteByToken ¶
DeleteByToken delete token by contract address
func (*TokenDao) DeleteByTokenAndCoinbase ¶ added in v1.2.0
func (*TokenDao) GetAll ¶
GetAll function fetches all the tokens in the token collection of mongodb.
func (*TokenDao) GetAllByCoinbase ¶ added in v1.2.0
func (*TokenDao) GetBaseTokens ¶
GetBase function fetches all the base tokens in the token collection of mongodb.
func (*TokenDao) GetByAddress ¶
GetByAddress function fetches details of a token based on its contract address
func (*TokenDao) GetBySymbol ¶ added in v1.2.0
func (*TokenDao) GetQuoteTokens ¶
GetQuote function fetches all the quote tokens in the token collection of mongodb.
func (*TokenDao) UpdateByToken ¶ added in v1.2.0
func (*TokenDao) UpdateByTokenAndCoinbase ¶ added in v1.2.0
type TradeDao ¶
type TradeDao struct {
// contains filtered or unexported fields
}
TradeDao contains: collectionName: MongoDB collection name dbName: name of mongodb to interact with
func (*TradeDao) Create ¶
Create function performs the DB insertion task for trade collection It accepts 1 or more trades as input. All the trades are inserted in one query itself.
func (*TradeDao) Drop ¶
func (dao *TradeDao) Drop()
Drop drops all the order documents in the current database
func (*TradeDao) FindAndModify ¶
func (*TradeDao) GetAllTradesByPairAddress ¶
func (*TradeDao) GetByMakerOrderHash ¶
GetByOrderHash fetches the first trade record which matches a certain order hash
func (*TradeDao) GetByOrderHashes ¶
func (*TradeDao) GetByPairName ¶
GetByPairName fetches all the trades corresponding to a particular pair name.
func (*TradeDao) GetByTakerOrderHash ¶
func (*TradeDao) GetByUserAddress ¶
GetByUserAddress fetches all the trades corresponding to a particular user address.
func (*TradeDao) GetCollection ¶
func (dao *TradeDao) GetCollection() *mgo.Collection
func (*TradeDao) GetLatestTrade ¶
func (*TradeDao) GetNTradesByPairAddress ¶
func (*TradeDao) GetSortedTrades ¶
func (*TradeDao) GetSortedTradesByUserAddress ¶
func (*TradeDao) GetTradeByTime ¶ added in v1.2.0
func (dao *TradeDao) GetTradeByTime(dateFrom, dateTo int64, pageOffset int, pageSize int) ([]*types.Trade, error)
GetTradeByTime get range trade
func (*TradeDao) GetTrades ¶
func (dao *TradeDao) GetTrades(tradeSpec *types.TradeSpec, sortedBy []string, pageOffset int, pageSize int) (*types.TradeRes, error)
GetTrades filter trade
func (*TradeDao) GetTradesByPairAddress ¶
GetByPairAddress fetches all the trades corresponding to a particular pair token address.
func (*TradeDao) GetTradesUserHistory ¶
func (dao *TradeDao) GetTradesUserHistory(a common.Address, tradeSpec *types.TradeSpec, sortedBy []string, pageOffset int, pageSize int) (*types.TradeRes, error)
GetTradesUserHistory get trade by user address
func (*TradeDao) UpdateByHash ¶
UpdateByHash updates the fields that can be normally updated in a structure. For a complete update, use the Update or UpdateAllByHash function
func (*TradeDao) UpdateTradeStatus ¶
func (*TradeDao) UpdateTradeStatuses ¶
func (*TradeDao) UpdateTradeStatusesByHashes ¶
func (*TradeDao) UpdateTradeStatusesByOrderHashes ¶
func (*TradeDao) UpsertByHash ¶
type WalletDao ¶
type WalletDao struct {
// contains filtered or unexported fields
}
TokenDao contains: collectionName: MongoDB collection name dbName: name of mongodb to interact with
func NewWalletDao ¶
func NewWalletDao() *WalletDao
func (*WalletDao) GetByAddress ¶
GetByAddress function fetches details of a token based on its contract address