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

package zeroex

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

Index

Package Files

asset_data_decoder.go order.go

Constants

const (
    // ESInvalid is an event that is never emitted. It is here to discern between a declared but uninitialized OrderEventEndState
    ESInvalid = OrderEventEndState("INVALID")
    // ESOrderAdded means an order was successfully added to the Mesh node
    ESOrderAdded = OrderEventEndState("ADDED")
    // ESOrderFilled means an order was filled for a partial amount
    ESOrderFilled = OrderEventEndState("FILLED")
    // ESOrderFullyFilled means an order was fully filled such that it's remaining fillableTakerAssetAmount is 0
    ESOrderFullyFilled = OrderEventEndState("FULLY_FILLED")
    // ESOrderCancelled means an order was cancelled on-chain
    ESOrderCancelled = OrderEventEndState("CANCELLED")
    // ESOrderExpired means an order expired according to the latest block timestamp
    ESOrderExpired = OrderEventEndState("EXPIRED")
    // ESOrderUnexpired means an order is no longer expired. This can happen if a block re-org causes the latest
    // block timestamp to decline below the order's expirationTimestamp (rare and usually short-lived)
    ESOrderUnexpired = OrderEventEndState("UNEXPIRED")
    // ESOrderBecameUnfunded means an order has become unfunded. This happens if the maker transfers the balance /
    // changes their allowance backing an order
    ESOrderBecameUnfunded = OrderEventEndState("UNFUNDED")
    // ESOrderFillabilityIncreased means the fillability of an order has increased. Fillability for an order can
    // increase if a previously processed fill event gets reverted, or if a maker tops up their balance/allowance
    // backing an order
    ESOrderFillabilityIncreased = OrderEventEndState("FILLABILITY_INCREASED")
    // ESStoppedWatching means an order is potentially still valid but was removed for a different reason (e.g.
    // the database is full or the peer that sent the order was misbehaving). The order will no longer be watched
    // and no further events for this order will be emitted. In some cases, the order may be re-added in the
    // future.
    ESStoppedWatching = OrderEventEndState("STOPPED_WATCHING")
)

OrderEventEndState values

const CheckGasPriceDefaultID = "d728f5b7"

CheckGasDefaultID is the function selector for the `checkGas` function that does not accept a gasPrice.

const CheckGasPriceID = "da5b166a"

CheckGasID is the function selector for the `checkGas` function that accepts a gasPrice.

const ERC1155AssetDataID = "a7cb5fb7"

ERC1155AssetDataID is the assetDataId for ERC721 tokens

const ERC20AssetDataID = "f47261b0"

ERC20AssetDataID is the assetDataId for ERC20 tokens

const ERC20BridgeAssetDataID = "dc1600f3"

ERC20BridgeAssetDataID is the assetDataId for ERC20Bridge assets

const ERC721AssetDataID = "02571792"

ERC721AssetDataID is the assetDataId for ERC721 tokens

const MultiAssetDataID = "94cfcdd7"

MultiAssetDataID is the assetDataId for multiAsset tokens

const StaticCallAssetDataID = "c339d10a"

StaticCallAssetDataID is the assetDataId for staticcalls

type AssetDataDecoder Uses

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

AssetDataDecoder decodes 0x order asset data

func NewAssetDataDecoder Uses

func NewAssetDataDecoder() *AssetDataDecoder

NewAssetDataDecoder instantiates a new asset data decoder

func (*AssetDataDecoder) Decode Uses

func (a *AssetDataDecoder) Decode(assetData []byte, decodedAssetData interface{}) error

Decode decodes an encoded asset data into it's sub-components

func (*AssetDataDecoder) GetName Uses

func (a *AssetDataDecoder) GetName(assetData []byte) (string, error)

GetName returns the name of the assetData type

type CheckGasPriceStaticCallData Uses

type CheckGasPriceStaticCallData struct {
    MaxGasPrice *big.Int
}

type ContractEvent Uses

type ContractEvent struct {
    BlockHash  common.Hash
    TxHash     common.Hash
    TxIndex    uint
    LogIndex   uint
    IsRemoved  bool
    Address    common.Address
    Kind       string
    Parameters interface{}
}

ContractEvent is an event emitted by a smart contract

func (ContractEvent) MarshalJSON Uses

func (c ContractEvent) MarshalJSON() ([]byte, error)

MarshalJSON implements a custom JSON marshaller for the ContractEvent type

type ERC1155AssetData Uses

type ERC1155AssetData struct {
    Address      common.Address
    Ids          []*big.Int
    Values       []*big.Int
    CallbackData []byte
}

ERC1155AssetData represents an ERC1155 assetData

type ERC20AssetData Uses

type ERC20AssetData struct {
    Address common.Address
}

ERC20AssetData represents an ERC20 assetData

type ERC20BridgeAssetData Uses

type ERC20BridgeAssetData struct {
    TokenAddress  common.Address
    BridgeAddress common.Address
    BridgeData    []byte
}

ERC20BridgeAssetData represents an ERC20 Bridge assetData

type ERC721AssetData Uses

type ERC721AssetData struct {
    Address common.Address
    TokenId *big.Int
}

ERC721AssetData represents an ERC721 assetData

type MultiAssetData Uses

type MultiAssetData struct {
    Amounts         []*big.Int
    NestedAssetData [][]byte
}

MultiAssetData represents a MultiAssetData

type Order Uses

type Order struct {
    ChainID               *big.Int       `json:"chainId"`
    ExchangeAddress       common.Address `json:"exchangeAddress"`
    MakerAddress          common.Address `json:"makerAddress"`
    MakerAssetData        []byte         `json:"makerAssetData"`
    MakerFeeAssetData     []byte         `json:"makerFeeAssetData"`
    MakerAssetAmount      *big.Int       `json:"makerAssetAmount"`
    MakerFee              *big.Int       `json:"makerFee"`
    TakerAddress          common.Address `json:"takerAddress"`
    TakerAssetData        []byte         `json:"takerAssetData"`
    TakerFeeAssetData     []byte         `json:"takerFeeAssetData"`
    TakerAssetAmount      *big.Int       `json:"takerAssetAmount"`
    TakerFee              *big.Int       `json:"takerFee"`
    SenderAddress         common.Address `json:"senderAddress"`
    FeeRecipientAddress   common.Address `json:"feeRecipientAddress"`
    ExpirationTimeSeconds *big.Int       `json:"expirationTimeSeconds"`
    Salt                  *big.Int       `json:"salt"`
    // contains filtered or unexported fields
}

Order represents an unsigned 0x order

func (*Order) ComputeOrderHash Uses

func (o *Order) ComputeOrderHash() (common.Hash, error)

ComputeOrderHash computes a 0x order hash

func (*Order) ResetHash Uses

func (o *Order) ResetHash()

ResetHash resets the cached order hash. Usually only required for testing.

type OrderEvent Uses

type OrderEvent struct {
    // Timestamp is an order event timestamp that can be used for bookkeeping purposes.
    // If the OrderEvent represents a Mesh-specific event (e.g., ADDED, STOPPED_WATCHING),
    // the timestamp is when the event was generated. If the event was generated after
    // re-validating an order at the latest block height (e.g., FILLED, UNFUNDED, CANCELED),
    // then it is set to the latest block timestamp at which the order was re-validated.
    Timestamp time.Time `json:"timestamp"`
    // OrderHash is the EIP712 hash of the 0x order
    OrderHash common.Hash `json:"orderHash"`
    // SignedOrder is the signed 0x order struct
    SignedOrder *SignedOrder `json:"signedOrder"`
    // EndState is the end state of this order at the time this event was generated
    EndState OrderEventEndState `json:"endState"`
    // FillableTakerAssetAmount is the amount for which this order is still fillable
    FillableTakerAssetAmount *big.Int `json:"fillableTakerAssetAmount"`
    // ContractEvents contains all the contract events that triggered this orders re-evaluation.
    // They did not all necessarily cause the orders state change itself, only it's re-evaluation.
    // Since it's state _did_ change, at least one of them did cause the actual state change.
    ContractEvents []*ContractEvent `json:"contractEvents"`
}

OrderEvent is the order event emitted by the Mesh GraphQL API or the SubScribeToOrderEvents method in core.

func (OrderEvent) MarshalJSON Uses

func (o OrderEvent) MarshalJSON() ([]byte, error)

MarshalJSON implements a custom JSON marshaller for the OrderEvent type

func (*OrderEvent) UnmarshalJSON Uses

func (o *OrderEvent) UnmarshalJSON(data []byte) error

UnmarshalJSON implements a custom JSON unmarshaller for the OrderEvent type

type OrderEventEndState Uses

type OrderEventEndState string

OrderEventEndState enumerates all the possible order event types. An OrderEventEndState describes the end state of a 0x order after revalidation

type OrderStatus Uses

type OrderStatus uint8

OrderStatus represents the status of an order as returned from the 0x smart contracts as part of OrderInfo

const (
    OSInvalid OrderStatus = iota
    OSInvalidMakerAssetAmount
    OSInvalidTakerAssetAmount
    OSFillable
    OSExpired
    OSFullyFilled
    OSCancelled
    OSSignatureInvalid
    OSInvalidMakerAssetData
    OSInvalidTakerAssetData
)

OrderStatus values

type SignatureType Uses

type SignatureType uint8

SignatureType represents the type of 0x signature encountered

const (
    IllegalSignature SignatureType = iota
    InvalidSignature
    EIP712Signature
    EthSignSignature
    WalletSignature
    ValidatorSignature
    PreSignedSignature
    EIP1271WalletSignature
    NSignatureTypesSignature
)

SignatureType values

type SignedOrder Uses

type SignedOrder struct {
    Order
    Signature []byte `json:"signature"`
}

SignedOrder represents a signed 0x order

func SignOrder Uses

func SignOrder(signer signer.Signer, order *Order) (*SignedOrder, error)

SignOrder signs the 0x order with the supplied Signer

func SignTestOrder Uses

func SignTestOrder(order *Order) (*SignedOrder, error)

SignTestOrder signs the 0x order with the local test signer

func (SignedOrder) MarshalJSON Uses

func (s SignedOrder) MarshalJSON() ([]byte, error)

MarshalJSON implements a custom JSON marshaller for the SignedOrder type

func (*SignedOrder) Trim Uses

func (s *SignedOrder) Trim() wrappers.LibOrderOrder

Trim converts the order to a LibOrderOrder, which is the format expected by our smart contracts. It removes the ChainID and ExchangeAddress fields.

func (*SignedOrder) UnmarshalJSON Uses

func (s *SignedOrder) UnmarshalJSON(data []byte) error

UnmarshalJSON implements a custom JSON unmarshaller for the SignedOrder type

type SignedOrderJSON Uses

type SignedOrderJSON struct {
    ChainID               int64  `json:"chainId"`
    ExchangeAddress       string `json:"exchangeAddress"`
    MakerAddress          string `json:"makerAddress"`
    MakerAssetData        string `json:"makerAssetData"`
    MakerFeeAssetData     string `json:"makerFeeAssetData"`
    MakerAssetAmount      string `json:"makerAssetAmount"`
    MakerFee              string `json:"makerFee"`
    TakerAddress          string `json:"takerAddress"`
    TakerAssetData        string `json:"takerAssetData"`
    TakerFeeAssetData     string `json:"takerFeeAssetData"`
    TakerAssetAmount      string `json:"takerAssetAmount"`
    TakerFee              string `json:"takerFee"`
    SenderAddress         string `json:"senderAddress"`
    FeeRecipientAddress   string `json:"feeRecipientAddress"`
    ExpirationTimeSeconds string `json:"expirationTimeSeconds"`
    Salt                  string `json:"salt"`
    Signature             string `json:"signature"`
}

SignedOrderJSON is an unmodified JSON representation of a SignedOrder

type StaticCallAssetData Uses

type StaticCallAssetData struct {
    StaticCallTargetAddress common.Address
    StaticCallData          []byte
    ExpectedReturnHashData  [32]byte
}

Directories

PathSynopsis
ordervalidator
orderwatch
orderwatch/decoder
orderwatch/slowcounter

Package zeroex imports 15 packages (graph) and is imported by 16 packages. Updated 2020-10-22. Refresh now. Tools for package owners.