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

package decoder

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

Index

Package Files

event_decoder.go

Variables

var EVENT_SIGNATURES = [...]string{
    "Transfer(address,address,uint256)",
    "Approval(address,address,uint256)",
    "TransferSingle(address,address,address,uint256,uint256)",
    "TransferBatch(address,address,address,uint256[],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)",
}

type Decoder Uses

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 New Uses

func New() (*Decoder, error)

New instantiates a new 0x order-relevant events decoder

func (*Decoder) AddKnownERC1155 Uses

func (d *Decoder) AddKnownERC1155(address common.Address)

AddKnownERC1155 registers the supplied contract address as an ERC1155 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) AddKnownERC20 Uses

func (d *Decoder) AddKnownERC20(address common.Address)

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 Uses

func (d *Decoder) AddKnownERC721(address common.Address)

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 Uses

func (d *Decoder) AddKnownExchange(address common.Address)

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 Uses

func (d *Decoder) Decode(log types.Log, decodedLog interface{}) error

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 Uses

func (d *Decoder) FindEventType(log types.Log) (string, error)

FindEventType returns to event type contained in the supplied log. It looks both at the registered contract addresses and the log topic.

func (*Decoder) RemoveKnownERC1155 Uses

func (d *Decoder) RemoveKnownERC1155(address common.Address)

RemoveKnownERC1155 removes an ERC1155 address from the list of known addresses. We will no longer decode events for this token.

func (*Decoder) RemoveKnownERC20 Uses

func (d *Decoder) RemoveKnownERC20(address common.Address)

RemoveKnownERC20 removes an ERC20 address from the list of known addresses. We will no longer decode events for this token.

func (*Decoder) RemoveKnownERC721 Uses

func (d *Decoder) RemoveKnownERC721(address common.Address)

RemoveKnownERC721 removes an ERC721 address from the list of known addresses. We will no longer decode events for this token.

func (*Decoder) RemoveKnownExchange Uses

func (d *Decoder) RemoveKnownExchange(address common.Address)

RemoveKnownExchange removes an Exchange address from the list of known addresses. We will no longer decode events for this contract.

type ERC1155ApprovalForAllEvent Uses

type ERC1155ApprovalForAllEvent struct {
    Owner    common.Address `json:"owner"`
    Operator common.Address `json:"operator"`
    Approved bool           `json:"approved"`
}

ERC1155ApprovalForAllEvent represents an ERC1155 ApprovalForAll event

type ERC1155TransferBatchEvent Uses

type ERC1155TransferBatchEvent struct {
    Operator common.Address
    From     common.Address
    To       common.Address
    Ids      []*big.Int
    Values   []*big.Int
}

ERC1155TransferBatchEvent represents an ERC1155 TransfeSingler event

func (ERC1155TransferBatchEvent) MarshalJSON Uses

func (e ERC1155TransferBatchEvent) MarshalJSON() ([]byte, error)

MarshalJSON implements a custom JSON marshaller for the ERC1155TransferBatchEvent type

func (*ERC1155TransferBatchEvent) UnmarshalJSON Uses

func (e *ERC1155TransferBatchEvent) UnmarshalJSON(data []byte) error

type ERC1155TransferSingleEvent Uses

type ERC1155TransferSingleEvent struct {
    Operator common.Address
    From     common.Address
    To       common.Address
    Id       *big.Int
    Value    *big.Int
}

ERC1155TransferSingleEvent represents an ERC1155 TransfeSingler event

func (ERC1155TransferSingleEvent) MarshalJSON Uses

func (e ERC1155TransferSingleEvent) MarshalJSON() ([]byte, error)

MarshalJSON implements a custom JSON marshaller for the ERC1155TransferSingleEvent type

func (*ERC1155TransferSingleEvent) UnmarshalJSON Uses

func (e *ERC1155TransferSingleEvent) UnmarshalJSON(data []byte) error

type ERC20ApprovalEvent Uses

type ERC20ApprovalEvent struct {
    Owner   common.Address
    Spender common.Address
    Value   *big.Int
}

ERC20ApprovalEvent represents an ERC20 Approval event

func (ERC20ApprovalEvent) MarshalJSON Uses

func (e ERC20ApprovalEvent) MarshalJSON() ([]byte, error)

MarshalJSON implements a custom JSON marshaller for the ERC20ApprovalEvent type

func (*ERC20ApprovalEvent) UnmarshalJSON Uses

func (e *ERC20ApprovalEvent) UnmarshalJSON(data []byte) error

type ERC20TransferEvent Uses

type ERC20TransferEvent struct {
    From  common.Address
    To    common.Address
    Value *big.Int
}

ERC20TransferEvent represents an ERC20 Transfer event

func (ERC20TransferEvent) MarshalJSON Uses

func (e ERC20TransferEvent) MarshalJSON() ([]byte, error)

MarshalJSON implements a custom JSON marshaller for the ERC20TransferEvent type

func (*ERC20TransferEvent) UnmarshalJSON Uses

func (e *ERC20TransferEvent) UnmarshalJSON(data []byte) error

type ERC721ApprovalEvent Uses

type ERC721ApprovalEvent struct {
    Owner    common.Address
    Approved common.Address
    TokenId  *big.Int
}

ERC721ApprovalEvent represents an ERC721 Approval event

func (ERC721ApprovalEvent) MarshalJSON Uses

func (e ERC721ApprovalEvent) MarshalJSON() ([]byte, error)

MarshalJSON implements a custom JSON marshaller for the ERC721ApprovalEvent type

func (*ERC721ApprovalEvent) UnmarshalJSON Uses

func (e *ERC721ApprovalEvent) UnmarshalJSON(data []byte) error

type ERC721ApprovalForAllEvent Uses

type ERC721ApprovalForAllEvent struct {
    Owner    common.Address `json:"owner"`
    Operator common.Address `json:"operator"`
    Approved bool           `json:"approved"`
}

ERC721ApprovalForAllEvent represents an ERC721 ApprovalForAll event

type ERC721TransferEvent Uses

type ERC721TransferEvent struct {
    From    common.Address
    To      common.Address
    TokenId *big.Int
}

ERC721TransferEvent represents an ERC721 Transfer event

func (ERC721TransferEvent) MarshalJSON Uses

func (e ERC721TransferEvent) MarshalJSON() ([]byte, error)

MarshalJSON implements a custom JSON marshaller for the ERC721TransferEvent type

func (*ERC721TransferEvent) UnmarshalJSON Uses

func (e *ERC721TransferEvent) UnmarshalJSON(data []byte) error

type ExchangeCancelEvent Uses

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

func (ExchangeCancelEvent) MarshalJSON Uses

func (e ExchangeCancelEvent) MarshalJSON() ([]byte, error)

MarshalJSON implements a custom JSON marshaller for the ExchangeCancelEvent type

func (*ExchangeCancelEvent) UnmarshalJSON Uses

func (e *ExchangeCancelEvent) UnmarshalJSON(data []byte) error

type ExchangeCancelUpToEvent Uses

type ExchangeCancelUpToEvent struct {
    MakerAddress  common.Address
    SenderAddress common.Address
    OrderEpoch    *big.Int
}

ExchangeCancelUpToEvent represents a 0x Exchange CancelUpTo event

func (ExchangeCancelUpToEvent) MarshalJSON Uses

func (e ExchangeCancelUpToEvent) MarshalJSON() ([]byte, error)

MarshalJSON implements a custom JSON marshaller for the ExchangeCancelUpToEvent type

func (*ExchangeCancelUpToEvent) UnmarshalJSON Uses

func (e *ExchangeCancelUpToEvent) UnmarshalJSON(data []byte) error

type ExchangeFillEvent Uses

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

func (ExchangeFillEvent) MarshalJSON Uses

func (e ExchangeFillEvent) MarshalJSON() ([]byte, error)

MarshalJSON implements a custom JSON marshaller for the ExchangeFillEvent type

func (*ExchangeFillEvent) UnmarshalJSON Uses

func (e *ExchangeFillEvent) UnmarshalJSON(data []byte) error

type UnsupportedEventError Uses

type UnsupportedEventError struct {
    Topics          []common.Hash
    ContractAddress common.Address
}

UnsupportedEventError is thrown when an unsupported topic is encountered

func (UnsupportedEventError) Error Uses

func (e UnsupportedEventError) Error() string

Error returns the error string

type UntrackedTokenError Uses

type UntrackedTokenError struct {
    Topic        common.Hash
    TokenAddress common.Address
}

func (UntrackedTokenError) Error Uses

func (e UntrackedTokenError) Error() string

Error returns the error string

type WethDepositEvent Uses

type WethDepositEvent struct {
    Owner common.Address
    Value *big.Int
}

WethDepositEvent represents a wrapped Ether Deposit event

func (WethDepositEvent) MarshalJSON Uses

func (w WethDepositEvent) MarshalJSON() ([]byte, error)

MarshalJSON implements a custom JSON marshaller for the WethDepositEvent type

func (*WethDepositEvent) UnmarshalJSON Uses

func (e *WethDepositEvent) UnmarshalJSON(data []byte) error

type WethWithdrawalEvent Uses

type WethWithdrawalEvent struct {
    Owner common.Address
    Value *big.Int
}

WethWithdrawalEvent represents a wrapped Ether Withdraw event

func (WethWithdrawalEvent) MarshalJSON Uses

func (w WethWithdrawalEvent) MarshalJSON() ([]byte, error)

MarshalJSON implements a custom JSON marshaller for the WethWithdrawalEvent type

func (*WethWithdrawalEvent) UnmarshalJSON Uses

func (e *WethWithdrawalEvent) UnmarshalJSON(data []byte) error

Package decoder imports 11 packages (graph) and is imported by 2 packages. Updated 2019-12-12. Refresh now. Tools for package owners.