0x-mesh: github.com/0xProject/0x-mesh/zeroex/orderwatch Index | Files | Directories

package orderwatch

import "github.com/0xProject/0x-mesh/zeroex/orderwatch"

Index

Package Files

order_watcher.go topics.go

func GetRelevantTopics Uses

func GetRelevantTopics() []common.Hash

GetRelevantTopics returns the OrderWatcher-relevant topics that should be used when filtering the logs retrieved for Ethereum blocks

type Config Uses

type Config struct {
    MeshDB            *meshdb.MeshDB
    BlockWatcher      *blockwatch.Watcher
    OrderValidator    *ordervalidator.OrderValidator
    ChainID           int
    ContractAddresses ethereum.ContractAddresses
    MaxOrders         int
    MaxExpirationTime *big.Int
}

type Watcher Uses

type Watcher struct {
    // contains filtered or unexported fields
}

Watcher watches all order-relevant state and handles the state transitions

func New Uses

func New(config Config) (*Watcher, error)

New instantiates a new order watcher

func (*Watcher) Cleanup Uses

func (w *Watcher) Cleanup(ctx context.Context, lastUpdatedBuffer time.Duration) error

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

func (*Watcher) MaxExpirationTime Uses

func (w *Watcher) MaxExpirationTime() *big.Int

MaxExpirationTime returns the current maximum expiration time for incoming orders.

func (*Watcher) Subscribe Uses

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.

func (*Watcher) ValidateAndStoreValidOrders Uses

func (w *Watcher) ValidateAndStoreValidOrders(ctx context.Context, orders []*zeroex.SignedOrder, pinned bool, chainID int) (*ordervalidator.ValidationResults, error)

ValidateAndStoreValidOrders applies general 0x validation and Mesh-specific validation to the given orders and if they are valid, adds them to the OrderWatcher

func (*Watcher) WaitForAtLeastOneBlockToBeProcessed Uses

func (w *Watcher) WaitForAtLeastOneBlockToBeProcessed(ctx context.Context) error

WaitForAtLeastOneBlockToBeProcessed waits until the OrderWatcher has processed it's first block

func (*Watcher) Watch Uses

func (w *Watcher) Watch(ctx context.Context) error

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.

Directories

PathSynopsis
decoder
slowcounter

Package orderwatch imports 23 packages (graph) and is imported by 1 packages. Updated 2020-05-04. Refresh now. Tools for package owners.