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          = OrderEventEndState("INVALID")
    ESOrderAdded       = OrderEventEndState("ADDED")
    ESOrderFilled      = OrderEventEndState("FILLED")
    ESOrderFullyFilled = OrderEventEndState("FULLY_FILLED")
    ESOrderCancelled   = OrderEventEndState("CANCELLED")
    ESOrderExpired     = OrderEventEndState("EXPIRED")
    ESOrderUnexpired   = OrderEventEndState("UNEXPIRED")
    // An order becomes unfunded if the maker transfers the balance / changes their
    // allowance backing an order
    ESOrderBecameUnfunded = OrderEventEndState("UNFUNDED")
    // 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")
    // 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 ERC1155AssetDataID = "a7cb5fb7"

ERC1155AssetDataID is the assetDataId for ERC721 tokens

const ERC20AssetDataID = "f47261b0"

ERC20AssetDataID is the assetDataId for ERC20 tokens

const ERC721AssetDataID = "02571792"

ERC721AssetDataID is the assetDataId for ERC721 tokens

const MultiAssetDataID = "94cfcdd7"

MultiAssetDataID is the assetDataId for multiAsset tokens

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 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 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 an MultiAssetData

type Order Uses

type Order struct {
    MakerAddress          common.Address `json:"makerAddress"`
    MakerAssetData        []byte         `json:"makerAssetData"`
    MakerAssetAmount      *big.Int       `json:"makerAssetAmount"`
    MakerFee              *big.Int       `json:"makerFee"`
    TakerAddress          common.Address `json:"takerAddress"`
    TakerAssetData        []byte         `json:"takerAssetData"`
    TakerAssetAmount      *big.Int       `json:"takerAssetAmount"`
    TakerFee              *big.Int       `json:"takerFee"`
    SenderAddress         common.Address `json:"senderAddress"`
    ExchangeAddress       common.Address `json:"exchangeAddress"`
    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()

Resets the cached order hash. Usually only required for testing.

type OrderEvent Uses

type OrderEvent struct {
    OrderHash                common.Hash        `json:"orderHash"`
    SignedOrder              *SignedOrder       `json:"signedOrder"`
    EndState                 OrderEventEndState `json:"endState"`
    FillableTakerAssetAmount *big.Int           `json:"fillableTakerAssetAmount"`
    // 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 Mesh nodes on the "orders" topic when calling JSON-RPC method `mesh_subscribe`

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
    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) ConvertToOrderWithoutExchangeAddress Uses

func (s *SignedOrder) ConvertToOrderWithoutExchangeAddress() wrappers.OrderWithoutExchangeAddress

ConvertToOrderWithoutExchangeAddress re-formats a SignedOrder into the format expected by the 0x smart contracts.

func (SignedOrder) MarshalJSON Uses

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

MarshalJSON implements a custom JSON marshaller for the SignedOrder type

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 {
    MakerAddress          string `json:"makerAddress"`
    MakerAssetData        string `json:"makerAssetData"`
    MakerAssetAmount      string `json:"makerAssetAmount"`
    MakerFee              string `json:"makerFee"`
    TakerAddress          string `json:"takerAddress"`
    TakerAssetData        string `json:"takerAssetData"`
    TakerAssetAmount      string `json:"takerAssetAmount"`
    TakerFee              string `json:"takerFee"`
    SenderAddress         string `json:"senderAddress"`
    ExchangeAddress       string `json:"exchangeAddress"`
    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

Directories

PathSynopsis
ordervalidator
orderwatch
orderwatch/decoder

Package zeroex imports 14 packages (graph) and is imported by 7 packages. Updated 2019-11-13. Refresh now. Tools for package owners.