Documentation ¶
Index ¶
- Variables
- func GetRelevantTopics() []common.Hash
- type Decoder
- func (d *Decoder) AddKnownERC20(address common.Address)
- func (d *Decoder) AddKnownERC721(address common.Address)
- func (d *Decoder) AddKnownExchange(address common.Address)
- func (d *Decoder) Decode(log types.Log, decodedLog interface{}) error
- func (d *Decoder) FindEventType(log types.Log) (string, error)
- func (d *Decoder) RemoveKnownERC20(address common.Address)
- func (d *Decoder) RemoveKnownERC721(address common.Address)
- func (d *Decoder) RemoveKnownExchange(address common.Address)
- type ERC20ApprovalEvent
- type ERC20TransferEvent
- type ERC721ApprovalEvent
- type ERC721ApprovalForAllEvent
- type ERC721TransferEvent
- type ExchangeCancelEvent
- type ExchangeCancelUpToEvent
- type ExchangeFillEvent
- type OrderWithTxHashes
- type UnsupportedEventError
- type UntrackedTokenError
- type Watcher
- type WethDepositEvent
- type WethWithdrawalEvent
Constants ¶
This section is empty.
Variables ¶
var EVENT_SIGNATURES = [...]string{
"Transfer(address,address,uint256)",
"Approval(address,address,uint256)",
"ApprovalForAll(address,address,bool)",
"Deposit(address,uint256)",
"Withdrawal(address,uint256)",
"Fill(address,address,address,address,uint256,uint256,uint256,uint256,bytes32,bytes,bytes)",
"Cancel(address,address,address,bytes32,bytes,bytes)",
"CancelUpTo(address,address,uint256)",
}
Functions ¶
func GetRelevantTopics ¶
GetRelevantTopics returns the OrderWatcher-relevant topics that should be used when filtering the logs retrieved for Ethereum blocks
Types ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder decodes events relevant to the fillability of 0x orders. Since ERC20 & ERC721 events have the same signatures, but different meanings, all ERC20 & ERC721 contract addresses must be added to the decoder ahead of time.
func NewDecoder ¶
NewDecoder instantiates a new 0x order-relevant events decoder
func (*Decoder) AddKnownERC20 ¶
AddKnownERC20 registers the supplied contract address as an ERC20 contract. If an event is found from this contract address, the decoder will properly decode the `Transfer` and `Approve` events including the correct event parameter names.
func (*Decoder) AddKnownERC721 ¶
AddKnownERC721 registers the supplied contract address as an ERC721 contract. If an event is found from this contract address, the decoder will properly decode the `Transfer` and `Approve` events including the correct event parameter names.
func (*Decoder) AddKnownExchange ¶
AddKnownExchange registers the supplied contract address as a 0x Exchange contract. If an event is found from this contract address, the decoder will properly decode it's events including the correct event parameter names.
func (*Decoder) Decode ¶
Decode attempts to decode the supplied log given the event types relevant to 0x orders. The decoded result is stored in the value pointed to by supplied `decodedLog` struct.
func (*Decoder) FindEventType ¶
FindEventType returns to event type contained in the supplied log. It looks both at the registered contract addresses and the log topic.
func (*Decoder) RemoveKnownERC20 ¶
RemoveKnownERC20 removes an ERC20 address from the list of known addresses. We will no longer decode events for this token.
func (*Decoder) RemoveKnownERC721 ¶
RemoveKnownERC721 removes an ERC721 address from the list of known addresses. We will no longer decode events for this token.
func (*Decoder) RemoveKnownExchange ¶
RemoveKnownExchange removes an Exchange address from the list of known addresses. We will no longer decode events for this contract.
type ERC20ApprovalEvent ¶
ERC20ApprovalEvent represents an ERC20 Approval event
type ERC20TransferEvent ¶
ERC20TransferEvent represents an ERC20 Transfer event
type ERC721ApprovalEvent ¶
ERC721ApprovalEvent represents an ERC721 Approval event
type ERC721ApprovalForAllEvent ¶
type ERC721ApprovalForAllEvent struct { Owner common.Address Operator common.Address Approved bool }
ERC721ApprovalForAllEvent represents an ERC721 ApprovalForAll event
type ERC721TransferEvent ¶
ERC721TransferEvent represents an ERC721 Transfer event
type ExchangeCancelEvent ¶
type ExchangeCancelEvent struct { MakerAddress common.Address FeeRecipientAddress common.Address SenderAddress common.Address OrderHash common.Hash MakerAssetData []byte TakerAssetData []byte }
ExchangeCancelEvent represents a 0x Exchange Cancel event
type ExchangeCancelUpToEvent ¶
type ExchangeCancelUpToEvent struct { MakerAddress common.Address SenderAddress common.Address OrderEpoch *big.Int }
ExchangeCancelUpToEvent represents a 0x Exchange CancelUpTo event
type ExchangeFillEvent ¶
type ExchangeFillEvent struct { MakerAddress common.Address TakerAddress common.Address SenderAddress common.Address FeeRecipientAddress common.Address MakerAssetFilledAmount *big.Int TakerAssetFilledAmount *big.Int MakerFeePaid *big.Int TakerFeePaid *big.Int OrderHash common.Hash MakerAssetData []byte TakerAssetData []byte }
ExchangeFillEvent represents a 0x Exchange Fill event
type OrderWithTxHashes ¶
type UnsupportedEventError ¶
UnsupportedEventError is thrown when an unsupported topic is encountered
func (UnsupportedEventError) Error ¶
func (e UnsupportedEventError) Error() string
Error returns the error string
type UntrackedTokenError ¶
func (UntrackedTokenError) Error ¶
func (e UntrackedTokenError) Error() string
Error returns the error string
type Watcher ¶
type Watcher struct {
// contains filtered or unexported fields
}
Watcher watches all order-relevant state and handles the state transitions
func New ¶
func New(meshDB *meshdb.MeshDB, blockWatcher *blockwatch.Watcher, orderValidator *zeroex.OrderValidator, networkID int, expirationBuffer time.Duration) (*Watcher, error)
New instantiates a new order watcher
func (*Watcher) Start ¶
Start sets up the event & expiration watchers as well as the cleanup worker. Event watching will require the blockwatch.Watcher to be started however.
func (*Watcher) Stop ¶
Stop closes the block subscription, stops the event, expiration watcher and the cleanup worker.
func (*Watcher) Subscribe ¶
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.
type WethDepositEvent ¶
WethDepositEvent represents a wrapped Ether Deposit event