types

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 27, 2018 License: GPL-3.0 Imports: 14 Imported by: 15

Documentation

Index

Constants

View Source
const (
	TYPED_SIG_EIP SigMode = 0
	GETH                  = 1
	TREZOR                = 2
)
View Source
const ETH_ADDRESS = "0x0000000000000000000000000000000000000000"

Variables

View Source
var ORDER_HASH_SCHEME = NewHash("0xb9caf644225739cd2bda9073346357ae4a0c3d71809876978bd81cc702b7fdc7")

Functions

This section is empty.

Types

type Address

type Address struct {
	common.Address
}

func HexToAddress

func HexToAddress(hex string) Address

func (Address) GetBSON

func (a Address) GetBSON() (interface{}, error)

func (Address) IsZero

func (a Address) IsZero() bool

func (*Address) MarshalJSON

func (a *Address) MarshalJSON() ([]byte, error)

func (*Address) SetBSON

func (a *Address) SetBSON(raw bson.Raw) error

type EC

type EC struct {
	V       int     `json:"v" bson:"v"`
	R       Hash    `json:"r" bson:"r"`
	S       Hash    `json:"s" bson:"s"`
	SigMode SigMode `json:"sig_mode" bson:"sig_mode"`
}

func (*EC) Verify

func (ec *EC) Verify(address Address, hash Hash) bool

type Hash

type Hash struct {
	common.Hash
}

func NewHash

func NewHash(hash string) Hash

func (Hash) GetBSON

func (h Hash) GetBSON() (interface{}, error)

func (Hash) MarshalJSON

func (h Hash) MarshalJSON() ([]byte, error)

func (*Hash) SetBSON

func (h *Hash) SetBSON(raw bson.Raw) error

func (*Hash) UnmarshalJSON

func (h *Hash) UnmarshalJSON(input []byte) error

type Int

type Int struct {
	big.Int
}

func NewInt

func NewInt(x int64) Int

func (Int) Add added in v1.1.0

func (x Int) Add(y Int) Int

func (Int) GetBSON

func (x Int) GetBSON() (interface{}, error)

func (Int) MarshalJSON

func (x Int) MarshalJSON() ([]byte, error)

func (*Int) SetBSON

func (x *Int) SetBSON(raw bson.Raw) error

func (Int) U256

func (x Int) U256() []byte

func (*Int) UnmarshalJSON added in v1.0.1

func (x *Int) UnmarshalJSON(input []byte) error

type Market

type Market struct {
	Token  Address `json:"token" bson:"_id"`
	Bid    float64 `json:"bid" bson:"bid"`
	Ask    float64 `json:"ask" bson:"ask"`
	Volume float64 `json:"volume" bson:"volume"`
	Last   float64 `json:"last" bson:"last"`
	Depth  Int     `json:"depth" bson:"depth"`
}

type Order

type Order struct {
	Hash      Hash        `json:"hash,omitempty" bson:"_id"`
	Price     float64     `json:"-" bson:"price"`
	Make      Trade       `json:"make" bson:"make"`
	Take      Trade       `json:"take" bson:"take"`
	Expires   Timestamp   `json:"expires" bson:"expires"`
	Nonce     int64       `json:"nonce" bson:"nonce"`
	Maker     Address     `json:"maker" bson:"maker"`
	Exchange  Address     `json:"exchange" bson:"exchange"`
	Signature EC          `json:"signature" bson:"signature"`
	Filled    Int         `json:"filled,omitempty" bson:"filled"`
	Status    OrderStatus `json:"-" bson:"status"`
}

func (*Order) OrderHash

func (o *Order) OrderHash() Hash

func (*Order) Validate

func (o *Order) Validate() error

type OrderStatus added in v1.0.2

type OrderStatus string
const (
	UNDER_FUNDED OrderStatus = "UNDER_FUNDED"
	OPEN                     = "OPEN"
)

type Orders

type Orders struct {
	Asks []Order `json:"asks"`
	Bids []Order `json:"bids"`
}

type Pair

type Pair struct {
	Quote Address `json:"quote" bson:"quote"`
	Base  Address `json:"base" bson:"base"`
}

type Price

type Price struct {
	Base  string
	Quote string
}

type Prices

type Prices map[Address]Price

type SigMode

type SigMode int

type Tick

type Tick struct {
	Pair      Pair      `json:"pair" bson:"pair"`
	Block     int64     `json:"block" bson:"block"`
	Volume    Int       `json:"volume" bson:"volume"`
	Open      float64   `json:"open" bson:"open"`
	Close     float64   `json:"close" bson:"close"`
	High      float64   `json:"high" bson:"high"`
	Low       float64   `json:"low" bson:"low"`
	Timestamp Timestamp `json:"timestamp" bson:"timestamp"`
}

type Timestamp

type Timestamp struct {
	time.Time
}

func NewTimestampFromInt

func NewTimestampFromInt(t Int) Timestamp

func (Timestamp) MarshalJSON

func (t Timestamp) MarshalJSON() ([]byte, error)

func (*Timestamp) UnmarshalJSON

func (t *Timestamp) UnmarshalJSON(b []byte) error

type Trade

type Trade struct {
	Token  Address `json:"token" bson:"token"`
	Amount Int     `json:"amount" bson:"amount"`
}

type Transaction

type Transaction struct {
	TransactionID    Hash      `json:"tx" bson:"_id"`
	TransactionIndex uint      `json:"index" bson:"index"`
	OrderHash        Hash      `json:"hash" bson:"hash"`
	BlockNumber      uint64    `json:"block" bson:"block"`
	Timestamp        Timestamp `json:"timestamp" bson:"timestamp"`
	Taker            Address   `json:"taker" bson:"taker"`
	Maker            Address   `json:"maker" bson:"maker"`
	Make             Trade     `json:"make" bson:"make"`
	Take             Trade     `json:"take" bson:"take"`
}

func NewTransaction

func NewTransaction(trade contracts.ExchangeTraded, timestamp Int) Transaction

Jump to

Keyboard shortcuts

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