import "github.com/0xProject/0x-mesh/zeroex/orderwatch"
GetRelevantTopics returns the OrderWatcher-relevant topics that should be used when filtering the logs retrieved for Ethereum blocks
type Config struct { MeshDB *meshdb.MeshDB BlockWatcher *blockwatch.Watcher OrderValidator *ordervalidator.OrderValidator ChainID int MaxOrders int MaxExpirationTime *big.Int }
type Watcher struct {
// contains filtered or unexported fields
}
Watcher watches all order-relevant state and handles the state transitions
New instantiates a new order watcher
func (w *Watcher) Add(orderInfo *ordervalidator.AcceptedOrderInfo, pinned bool) error
Add adds a 0x order to the DB and watches it for changes in fillability. It will no-op (and return nil) if the order has already been added. If pinned is true, the orders will be marked as pinned. Pinned orders will not be affected by any DDoS prevention or incentive mechanisms and will always stay in storage until they are no longer fillable.
Cleanup re-validates all orders in DB which haven't been re-validated in `lastUpdatedBuffer` time to make sure all orders are still up-to-date
MaxExpirationTime returns the current maximum expiration time for incoming orders.
func (w *Watcher) Subscribe(sink chan<- []*zeroex.OrderEvent) event.Subscription
Subscribe allows one to subscribe to the order events emitted by the OrderWatcher. To unsubscribe, simply call `Unsubscribe` on the returned subscription. The sink channel should have ample buffer space to avoid blocking other subscribers. Slow subscribers are not dropped.
Watch sets up the event & expiration watchers as well as the cleanup worker. Event watching will require the blockwatch.Watcher to be started first. Watch will block until there is a critical error or the given context is canceled.
Path | Synopsis |
---|---|
decoder | |
slowcounter |
Package orderwatch imports 21 packages (graph) and is imported by 1 packages. Updated 2019-12-04. Refresh now. Tools for package owners.