decoder

package
v0.0.0-...-0b85bb3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 7, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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,bytes,bytes,bytes,bytes,bytes32,address,address,uint256,uint256,uint256,uint256,uint256)",
	"Cancel(address,address,bytes,bytes,address,bytes32)",
	"CancelUpTo(address,address,uint256)",
}

Functions

This section is empty.

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 New

func New() (*Decoder, error)

New instantiates a new 0x order-relevant events decoder

func (*Decoder) AddKnownERC1155

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

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

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

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

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

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

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

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

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

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

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

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

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

MarshalJSON implements a custom JSON marshaller for the ERC1155TransferBatchEvent type

func (*ERC1155TransferBatchEvent) UnmarshalJSON

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

type ERC1155TransferSingleEvent

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

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

MarshalJSON implements a custom JSON marshaller for the ERC1155TransferSingleEvent type

func (*ERC1155TransferSingleEvent) UnmarshalJSON

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

type ERC20ApprovalEvent

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

ERC20ApprovalEvent represents an ERC20 Approval event

func (ERC20ApprovalEvent) MarshalJSON

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

MarshalJSON implements a custom JSON marshaller for the ERC20ApprovalEvent type

func (*ERC20ApprovalEvent) UnmarshalJSON

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

type ERC20TransferEvent

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

ERC20TransferEvent represents an ERC20 Transfer event

func (ERC20TransferEvent) MarshalJSON

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

MarshalJSON implements a custom JSON marshaller for the ERC20TransferEvent type

func (*ERC20TransferEvent) UnmarshalJSON

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

type ERC721ApprovalEvent

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

ERC721ApprovalEvent represents an ERC721 Approval event

func (ERC721ApprovalEvent) MarshalJSON

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

MarshalJSON implements a custom JSON marshaller for the ERC721ApprovalEvent type

func (*ERC721ApprovalEvent) UnmarshalJSON

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

type ERC721ApprovalForAllEvent

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

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

ERC721TransferEvent represents an ERC721 Transfer event

func (ERC721TransferEvent) MarshalJSON

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

MarshalJSON implements a custom JSON marshaller for the ERC721TransferEvent type

func (*ERC721TransferEvent) UnmarshalJSON

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

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

func (ExchangeCancelEvent) MarshalJSON

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

MarshalJSON implements a custom JSON marshaller for the ExchangeCancelEvent type

func (*ExchangeCancelEvent) UnmarshalJSON

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

type ExchangeCancelUpToEvent

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

ExchangeCancelUpToEvent represents a 0x Exchange CancelUpTo event

func (ExchangeCancelUpToEvent) MarshalJSON

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

MarshalJSON implements a custom JSON marshaller for the ExchangeCancelUpToEvent type

func (*ExchangeCancelUpToEvent) UnmarshalJSON

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

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
	ProtocolFeePaid        *big.Int
	OrderHash              common.Hash
	MakerAssetData         []byte
	TakerAssetData         []byte
	MakerFeeAssetData      []byte
	TakerFeeAssetData      []byte
}

ExchangeFillEvent represents a 0x Exchange Fill event

func (ExchangeFillEvent) MarshalJSON

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

MarshalJSON implements a custom JSON marshaller for the ExchangeFillEvent type

func (*ExchangeFillEvent) UnmarshalJSON

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

type UnsupportedEventError

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

UnsupportedEventError is thrown when an unsupported topic is encountered

func (UnsupportedEventError) Error

func (e UnsupportedEventError) Error() string

Error returns the error string

type UntrackedTokenError

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

func (UntrackedTokenError) Error

func (e UntrackedTokenError) Error() string

Error returns the error string

type WKlayDepositEvent

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

WKlayDepositEvent represents a wrapped KLAY Deposit event

func (WKlayDepositEvent) MarshalJSON

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

MarshalJSON implements a custom JSON marshaller for the WKlayDepositEvent type

func (*WKlayDepositEvent) UnmarshalJSON

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

type WKlayDepositEventJSON

type WKlayDepositEventJSON struct {
	Owner string `json:"owner"`
	Value string `json:"value"`
}

type WKlayWithdrawalEvent

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

WKlayWithdrawalEvent represents a wrapped KLAY Withdraw event

func (WKlayWithdrawalEvent) MarshalJSON

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

MarshalJSON implements a custom JSON marshaller for the WKlayWithdrawalEvent type

func (*WKlayWithdrawalEvent) UnmarshalJSON

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

type WKlayWithdrawalEventJSON

type WKlayWithdrawalEventJSON struct {
	Owner string `json:"owner"`
	Value string `json:"value"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL