tomox

package
v2.0.1-beta+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2019 License: GPL-3.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TrueByte  = byte(1)
	FalseByte = byte(0)

	Ask    = "SELL"
	Bid    = "BUY"
	Market = "MO"
	Limit  = "LO"
	Cancel = "CANCELLED"
)
View Source
const (
	OrderStatusNew           = "NEW"
	OrderStatusOpen          = "OPEN"
	OrderStatusPartialFilled = "PARTIAL_FILLED"
	OrderStatusFilled        = "FILLED"
	OrderStatusCancelled     = "CANCELLED"
	OrderStatusRejected      = "REJECTED"
)
View Source
const (
	Fee         = "Fee"         // Fee is calculated in quoteToken
	InToken     = "InToken"     // type of token which user is received as the result of the trade
	InQuantity  = "InQuantity"  // amount of token which user is received as the result of the trade, not include fee
	InTotal     = "InTotal"     // amount of token which user is received as the result of the trade, include fee
	OutToken    = "OutToken"    // type of token which user sends out to the partner as the result of the trade
	OutQuantity = "OutQuantity" // amount of token which user sends out to the partner as the result of the trade, not include fee
	OutTotal    = "OutTotal"    // amount of token which user sends out to the partner as the result of the trade, include fee
)
View Source
const (
	ProtocolName       = "tomox"
	ProtocolVersion    = uint64(1)
	ProtocolVersionStr = "1.0"
)
View Source
const (
	TradeStatusPending = "PENDING"
	TradeStatusSuccess = "SUCCESS"
	TradeStatusError   = "ERROR"

	TradeTakerOrderHash = "takerOrderHash"
	TradeMakerOrderHash = "makerOrderHash"
	TradeTimestamp      = "timestamp"
	TradeQuantity       = "quantity"
	TradeMakerExchange  = "makerExAddr"
	TradeMaker          = "uAddr"
	TradeBaseToken      = "bToken"
	TradeQuoteToken     = "qToken"
	TradePrice          = "tradedPrice"
)
View Source
const (
	LimitThresholdOrderNonceInQueue = 100
)

Variables

View Source
var (
	ErrNoTopics          = errors.New("missing topic(s)")
	ErrOrderNonceTooLow  = errors.New("OrderNonce too low")
	ErrOrderNonceTooHigh = errors.New("OrderNonce too high")
)

List of errors

View Source
var (
	TokenMappingSlot = map[string]uint64{
		"balances": 0,
	}
	RelayerMappingSlot = map[string]uint64{
		"CONTRACT_OWNER":       0,
		"MaximumRelayers":      1,
		"MaximumTokenList":     2,
		"RELAYER_LIST":         3,
		"RELAYER_COINBASES":    4,
		"RESIGN_REQUESTS":      5,
		"RELAYER_ON_SALE_LIST": 6,
		"RelayerCount":         7,
		"MinimumDeposit":       8,
	}
	RelayerStructMappingSlot = map[string]*big.Int{
		"_deposit":    big.NewInt(0),
		"_fee":        big.NewInt(1),
		"_fromTokens": big.NewInt(2),
		"_toTokens":   big.NewInt(3),
		"_index":      big.NewInt(4),
		"_owner":      big.NewInt(5),
	}
)
View Source
var (
	// errors
	ErrUnsupportedEngine    = errors.New("only POSV supports matching orders")
	ErrTomoXServiceNotFound = errors.New("can't attach tomoX service")
	ErrInvalidDryRunResult  = errors.New("failed to apply txMatches, invalid dryRun result")
)
View Source
var (
	ErrNonceTooHigh = errors.New("nonce too high")
	ErrNonceTooLow  = errors.New("nonce too low")
)
View Source
var DefaultConfig = Config{
	DataDir: "",
}

DefaultConfig represents (shocker!) the default configuration.

Functions

func Add

func Add(x, y *big.Int) *big.Int

func BigIntToBigFloat

func BigIntToBigFloat(a *big.Int) *big.Float

func Bool2byte

func Bool2byte(bln bool) byte

func Byte2bool

func Byte2bool(b byte) bool

func CloneBigInt

func CloneBigInt(bigInt *big.Int) *big.Int

func CmpBigInt

func CmpBigInt(a []byte, b []byte) int

func DecodeBytesItem

func DecodeBytesItem(bytes []byte, val interface{}) error

func Div

func Div(x, y *big.Int) *big.Int

func DivFloat

func DivFloat(x, y *big.Float) *big.Float

func EmptyKey

func EmptyKey() []byte

use alloc to prevent reference manipulation

func EncodeBytesItem

func EncodeBytesItem(val interface{}) ([]byte, error)

func EncodeTxMatchesBatch

func EncodeTxMatchesBatch(txMatchBatch TxMatchBatch) ([]byte, error)

func Exp

func Exp(x, y *big.Int) *big.Int

func GetKeyFromBig

func GetKeyFromBig(key *big.Int) []byte

func GetKeyFromString

func GetKeyFromString(key string) []byte

func GetKeyFromUint64

func GetKeyFromUint64(key uint64) []byte

func GetOrderBookHash

func GetOrderBookHash(baseToken common.Address, quoteToken common.Address) common.Hash

func GetOrderHistoryKey

func GetOrderHistoryKey(baseToken, quoteToken common.Address, orderId uint64) common.Hash

func GetSegmentHash

func GetSegmentHash(key []byte, segment, index uint8) []byte

func GetTradeQuantity

func GetTradeQuantity(takerSide string, takerFeeRate *big.Int, takerBalance *big.Int, makerPrice *big.Int, makerFeeRate *big.Int, makerBalance *big.Int, baseTokenDecimal *big.Int, quantityToTrade *big.Int) (*big.Int, bool)

func IsEqual

func IsEqual(x, y *big.Int) bool

func IsEqualOrGreaterThan

func IsEqualOrGreaterThan(x, y *big.Int) bool

func IsEqualOrSmallerThan

func IsEqualOrSmallerThan(x, y *big.Int) bool

func IsGreaterThan

func IsGreaterThan(x, y *big.Int) bool

func IsSmallerThan

func IsSmallerThan(x, y *big.Int) bool

func IsStrictlyGreaterThan

func IsStrictlyGreaterThan(x, y *big.Int) bool

func IsStrictlySmallerThan

func IsStrictlySmallerThan(x, y *big.Int) bool

func IsZero

func IsZero(x *big.Int) bool

func Max

func Max(a, b *big.Int) *big.Int

func Mul

func Mul(x, y *big.Int) *big.Int

func Neg

func Neg(x *big.Int) *big.Int

func SetteBalance

func SetteBalance(coinbase common.Address, takerOrder, makerOrder *tomox_state.OrderItem, settleBalance *SettleBalance, statedb *state.StateDB) error

func Sub

func Sub(x, y *big.Int) *big.Int

func ToBigInt

func ToBigInt(s string) *big.Int

func ToDecimal

func ToDecimal(value *big.Int) float64

func ToJSON

func ToJSON(object interface{}, args ...string) string

ToJSON : log json string

func Zero

func Zero() *big.Int

Types

type Batch

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

func (*Batch) Put

func (b *Batch) Put(key, value []byte) error

func (*Batch) Reset

func (b *Batch) Reset()

func (*Batch) SetCollection

func (b *Batch) SetCollection(collection string)

func (*Batch) ValueSize

func (b *Batch) ValueSize() int

func (*Batch) Write

func (b *Batch) Write() error

type BatchDatabase

type BatchDatabase struct {
	Debug bool
	// contains filtered or unexported fields
}

func NewBatchDatabase

func NewBatchDatabase(datadir string, cacheLimit int) *BatchDatabase

NewBatchDatabase use rlp as encoding

func NewBatchDatabaseWithEncode

func NewBatchDatabaseWithEncode(datadir string, cacheLimit int) *BatchDatabase

batchdatabase is a fast cache db to retrieve in-mem object

func NewLDBEngine

func NewLDBEngine(cfg *Config) *BatchDatabase

func (*BatchDatabase) Close

func (db *BatchDatabase) Close()

func (*BatchDatabase) CommitBulk

func (db *BatchDatabase) CommitBulk(sc *mgo.Session) error

func (*BatchDatabase) Delete

func (db *BatchDatabase) Delete(key []byte) error

func (*BatchDatabase) DeleteObject

func (db *BatchDatabase) DeleteObject(hash common.Hash) error

func (*BatchDatabase) DeleteTradeByTxHash

func (db *BatchDatabase) DeleteTradeByTxHash(txhash common.Hash)

func (*BatchDatabase) Get

func (db *BatchDatabase) Get(key []byte) ([]byte, error)

func (*BatchDatabase) GetListOrderByHashes

func (db *BatchDatabase) GetListOrderByHashes(hashes []string) []*tomox_state.OrderItem

func (*BatchDatabase) GetObject

func (db *BatchDatabase) GetObject(hash common.Hash, val interface{}) (interface{}, error)

func (*BatchDatabase) GetOrderByTxHash

func (db *BatchDatabase) GetOrderByTxHash(txhash common.Hash) []*tomox_state.OrderItem

func (*BatchDatabase) Has

func (db *BatchDatabase) Has(key []byte) (bool, error)

func (*BatchDatabase) HasObject

func (db *BatchDatabase) HasObject(hash common.Hash) (bool, error)

func (*BatchDatabase) InitBulk

func (db *BatchDatabase) InitBulk() *mgo.Session

func (*BatchDatabase) IsEmptyKey

func (db *BatchDatabase) IsEmptyKey(key []byte) bool

func (*BatchDatabase) NewBatch

func (db *BatchDatabase) NewBatch() ethdb.Batch

func (*BatchDatabase) Put

func (db *BatchDatabase) Put(key []byte, val []byte) error

func (*BatchDatabase) PutObject

func (db *BatchDatabase) PutObject(hash common.Hash, val interface{}) error

type BatchItem

type BatchItem struct {
	Value interface{}
}

type Comparator

type Comparator func(a, b []byte) int

type Config

type Config struct {
	DataDir        string `toml:",omitempty"`
	DBEngine       string `toml:",omitempty"`
	DBName         string `toml:",omitempty"`
	ConnectionUrl  string `toml:",omitempty"`
	ReplicaSetName string `toml:",omitempty"`
}

type DecodeBytes

type DecodeBytes func([]byte, interface{}) error

type EncodeToBytes

type EncodeToBytes func(interface{}) ([]byte, error)

type FormatBytes

type FormatBytes func([]byte) string

type MongoDatabase

type MongoDatabase struct {
	Session *mgo.Session
	// contains filtered or unexported fields
}

func NewMongoDBEngine

func NewMongoDBEngine(cfg *Config) *MongoDatabase

func NewMongoDatabase

func NewMongoDatabase(session *mgo.Session, dbName string, mongoURL string, replicaSetName string, cacheLimit int) (*MongoDatabase, error)

InitSession initializes a new session with mongodb

func (*MongoDatabase) Close

func (db *MongoDatabase) Close()

func (*MongoDatabase) CommitBulk

func (db *MongoDatabase) CommitBulk(sc *mgo.Session) error

func (*MongoDatabase) CommitOrder

func (db *MongoDatabase) CommitOrder(o *tomox_state.OrderItem) error

func (*MongoDatabase) CommitTrade

func (db *MongoDatabase) CommitTrade(t *Trade) error

func (*MongoDatabase) Delete

func (db *MongoDatabase) Delete(key []byte) error

func (*MongoDatabase) DeleteObject

func (db *MongoDatabase) DeleteObject(hash common.Hash) error

func (*MongoDatabase) DeleteTradeByTxHash

func (db *MongoDatabase) DeleteTradeByTxHash(txhash common.Hash)

func (*MongoDatabase) Get

func (db *MongoDatabase) Get(key []byte) ([]byte, error)

func (*MongoDatabase) GetListOrderByHashes

func (db *MongoDatabase) GetListOrderByHashes(hashes []string) []*tomox_state.OrderItem

func (*MongoDatabase) GetObject

func (db *MongoDatabase) GetObject(hash common.Hash, val interface{}) (interface{}, error)

func (*MongoDatabase) GetOrderByTxHash

func (db *MongoDatabase) GetOrderByTxHash(txhash common.Hash) []*tomox_state.OrderItem

func (*MongoDatabase) Has

func (db *MongoDatabase) Has(key []byte) (bool, error)

func (*MongoDatabase) HasObject

func (db *MongoDatabase) HasObject(hash common.Hash) (bool, error)

func (*MongoDatabase) InitBulk

func (db *MongoDatabase) InitBulk() *mgo.Session

func (*MongoDatabase) IsEmptyKey

func (db *MongoDatabase) IsEmptyKey(key []byte) bool

func (*MongoDatabase) NewBatch

func (db *MongoDatabase) NewBatch() ethdb.Batch

func (*MongoDatabase) Put

func (db *MongoDatabase) Put(key []byte, val []byte) error

func (*MongoDatabase) PutObject

func (db *MongoDatabase) PutObject(hash common.Hash, val interface{}) error

type MongoItem

type MongoItem struct {
	Value interface{}
}

type MongoItemRecord

type MongoItemRecord struct {
	Key   string
	Value string
}

type Order

type Order struct {
	Item *tomox_state.OrderItem
	Key  []byte `json:"orderID"`
}

func (*Order) String

func (order *Order) String() string

type OrderDao

type OrderDao interface {
	// for both leveldb and mongodb
	IsEmptyKey(key []byte) bool
	Close()

	// mongodb methods
	HasObject(hash common.Hash) (bool, error)
	GetObject(hash common.Hash, val interface{}) (interface{}, error)
	PutObject(hash common.Hash, val interface{}) error
	DeleteObject(hash common.Hash) error // won't return error if key not found
	GetOrderByTxHash(txhash common.Hash) []*tomox_state.OrderItem
	GetListOrderByHashes(hashes []string) []*tomox_state.OrderItem
	DeleteTradeByTxHash(txhash common.Hash)
	InitBulk() *mgo.Session
	CommitBulk(sc *mgo.Session) error

	// leveldb methods
	Put(key []byte, value []byte) error
	Get(key []byte) ([]byte, error)
	Has(key []byte) (bool, error)
	Delete(key []byte) error
	NewBatch() ethdb.Batch
}

type OrderHistoryItem

type OrderHistoryItem struct {
	TxHash       common.Hash
	FilledAmount *big.Int
	Status       string
}

type OrderItemBSON

type OrderItemBSON struct {
	Quantity        string           `json:"quantity,omitempty" bson:"quantity"`
	Price           string           `json:"price,omitempty" bson:"price"`
	ExchangeAddress string           `json:"exchangeAddress,omitempty" bson:"exchangeAddress"`
	UserAddress     string           `json:"userAddress,omitempty" bson:"userAddress"`
	BaseToken       string           `json:"baseToken,omitempty" bson:"baseToken"`
	QuoteToken      string           `json:"quoteToken,omitempty" bson:"quoteToken"`
	Status          string           `json:"status,omitempty" bson:"status"`
	Side            string           `json:"side,omitempty" bson:"side"`
	Type            string           `json:"type,omitempty" bson:"type"`
	Hash            string           `json:"hash,omitempty" bson:"hash"`
	Signature       *SignatureRecord `json:"signature,omitempty" bson:"signature"`
	FilledAmount    string           `json:"filledAmount,omitempty" bson:"filledAmount"`
	Nonce           string           `json:"nonce,omitempty" bson:"nonce"`
	PairName        string           `json:"pairName,omitempty" bson:"pairName"`
	CreatedAt       time.Time        `json:"createdAt,omitempty" bson:"createdAt"`
	UpdatedAt       time.Time        `json:"updatedAt,omitempty" bson:"updatedAt"`
	OrderID         string           `json:"orderID,omitempty" bson:"orderID"`
	NextOrder       string           `json:"nextOrder,omitempty" bson:"nextOrder"`
	PrevOrder       string           `json:"prevOrder,omitempty" bson:"prevOrder"`
	OrderList       string           `json:"orderList,omitempty" bson:"orderList"`
	Key             string           `json:"key" bson:"key"`
}

type PublicTomoXAPI

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

PublicTomoXAPI provides the tomoX RPC service that can be use publicly without security implications.

func NewPublicTomoXAPI

func NewPublicTomoXAPI(t *TomoX) *PublicTomoXAPI

NewPublicTomoXAPI create a new RPC tomoX service.

func (*PublicTomoXAPI) GetOrderNonce

func (api *PublicTomoXAPI) GetOrderNonce(address common.Address) (*big.Int, error)

GetOrderNonce returns the latest orderNonce of the given address

func (*PublicTomoXAPI) GetPendingOrders

func (api *PublicTomoXAPI) GetPendingOrders(pairName string) ([]*tomox_state.OrderItem, error)

GetPendingOrders returns pending orders of the given pair

func (*PublicTomoXAPI) Version

func (api *PublicTomoXAPI) Version(ctx context.Context) string

Version returns the TomoX sub-protocol version.

type SettleBalance

type SettleBalance struct {
	Taker TradeResult
	Maker TradeResult
}

func GetSettleBalance

func GetSettleBalance(quotePrice *big.Int, takerSide string, takerFeeRate *big.Int, baseToken, quoteToken common.Address, makerPrice *big.Int, makerFeeRate *big.Int, baseTokenDecimal *big.Int, quoteTokenDecimal *big.Int, quantityToTrade *big.Int) (*SettleBalance, error)

func (*SettleBalance) String

func (settleBalance *SettleBalance) String() string

type SignatureRecord

type SignatureRecord struct {
	V byte   `json:"V" bson:"V"`
	R string `json:"R" bson:"R"`
	S string `json:"S" bson:"S"`
}

type TomoX

type TomoX struct {
	Triegc     *prque.Prque         // Priority queue mapping block numbers to tries to gc
	StateCache tomox_state.Database // State database to reuse between imports (contains state cache)    *tomox_state.TomoXStateDB
	// contains filtered or unexported fields
}

func New

func New(cfg *Config) *TomoX

func (*TomoX) APIs

func (tomox *TomoX) APIs() []rpc.API

APIs returns the RPC descriptors the TomoX implementation offers

func (*TomoX) ApplyOrder

func (tomox *TomoX) ApplyOrder(coinbase common.Address, ipcEndpoint string, statedb *state.StateDB, tomoXstatedb *tomox_state.TomoXStateDB, orderBook common.Hash, order *tomox_state.OrderItem) ([]map[string]string, []*tomox_state.OrderItem, error)

func (*TomoX) CommitOrder

func (tomox *TomoX) CommitOrder(coinbase common.Address, ipcEndpoint string, statedb *state.StateDB, tomoXstatedb *tomox_state.TomoXStateDB, orderBook common.Hash, order *tomox_state.OrderItem) ([]map[string]string, []*tomox_state.OrderItem, error)

func (*TomoX) GetDB

func (tomox *TomoX) GetDB() OrderDao

func (*TomoX) GetMongoDB

func (tomox *TomoX) GetMongoDB() OrderDao

func (*TomoX) GetTokenDecimal

func (tomox *TomoX) GetTokenDecimal(ipcEndpoint string, tokenAddr common.Address) (*big.Int, error)

func (*TomoX) GetTomoxState

func (tomox *TomoX) GetTomoxState(block *types.Block) (*tomox_state.TomoXStateDB, error)

func (*TomoX) GetTomoxStateRoot

func (tomox *TomoX) GetTomoxStateRoot(block *types.Block) (common.Hash, error)

func (*TomoX) IsSDKNode

func (tomox *TomoX) IsSDKNode() bool

func (*TomoX) Overflow

func (tomox *TomoX) Overflow() bool

Overflow returns an indication if the message queue is full.

func (*TomoX) ProcessOrderPending

func (tomox *TomoX) ProcessOrderPending(coinbase common.Address, ipcEndpoint string, pending map[common.Address]types.OrderTransactions, statedb *state.StateDB, tomoXstatedb *tomox_state.TomoXStateDB) []TxDataMatch

func (*TomoX) Protocols

func (tomox *TomoX) Protocols() []p2p.Protocol

func (*TomoX) RollbackReorgTxMatch

func (tomox *TomoX) RollbackReorgTxMatch(txhash common.Hash)

func (*TomoX) SettleBalance

func (tomox *TomoX) SettleBalance(
	ipcEndpoint string,
	maker, taker common.Address,
	baseToken, quoteToken common.Address,
	isTakerBuy bool,
	makerFeeRate, takerFeeRate, baseFee *big.Int,
	quantity *big.Int,
	price *big.Int,
) (map[common.Address]map[string]interface{}, error)

func (*TomoX) Start

func (tomox *TomoX) Start(server *p2p.Server) error

func (*TomoX) Stop

func (tomox *TomoX) Stop() error

func (*TomoX) SyncDataToSDKNode

func (tomox *TomoX) SyncDataToSDKNode(txDataMatch TxDataMatch, txHash common.Hash, txMatchTime time.Time, statedb *state.StateDB) error

there are 3 tasks need to complete to update data in SDK nodes after matching

  1. txMatchData.Order: order has been processed. This order should be put to `orders` collection with status sdktypes.OrderStatusOpen
  2. txMatchData.Trades: includes information of matched orders. a. PutObject them to `trades` collection b. Update status of regrading orders to sdktypes.OrderStatusFilled

func (*TomoX) UpdateOrderCache

func (tomox *TomoX) UpdateOrderCache(baseToken, quoteToken common.Address, orderId uint64, txhash common.Hash, lastState OrderHistoryItem)

func (*TomoX) Version

func (tomox *TomoX) Version() uint64

Version returns the TomoX sub-protocols version number.

type Trade

type Trade struct {
	Taker          common.Address `json:"taker" bson:"taker"`
	Maker          common.Address `json:"maker" bson:"maker"`
	BaseToken      common.Address `json:"baseToken" bson:"baseToken"`
	QuoteToken     common.Address `json:"quoteToken" bson:"quoteToken"`
	MakerOrderHash common.Hash    `json:"makerOrderHash" bson:"makerOrderHash"`
	TakerOrderHash common.Hash    `json:"takerOrderHash" bson:"takerOrderHash"`
	MakerExchange  common.Address `json:"makerExchange" bson:"makerExchange"`
	TakerExchange  common.Address `json:"takerExchange" bson:"takerExchange"`
	Hash           common.Hash    `json:"hash" bson:"hash"`
	TxHash         common.Hash    `json:"txHash" bson:"txHash"`
	PairName       string         `json:"pairName" bson:"pairName"`
	PricePoint     *big.Int       `json:"pricepoint" bson:"pricepoint"`
	Amount         *big.Int       `json:"amount" bson:"amount"`
	MakeFee        *big.Int       `json:"makeFee" bson:"makeFee"`
	TakeFee        *big.Int       `json:"takeFee" bson:"takeFee"`
	Status         string         `json:"status" bson:"status"`
	CreatedAt      time.Time      `json:"createdAt" bson:"createdAt"`
	UpdatedAt      time.Time      `json:"updatedAt" bson:"updatedAt"`
	TakerOrderSide string         `json:"takerOrderSide" bson:"takerOrderSide"`
}

func (*Trade) ComputeHash

func (t *Trade) ComputeHash() common.Hash

ComputeHash returns hashes the trade The OrderHash, Amount, Taker and TradeNonce attributes must be set before attempting to compute the trade hash

func (*Trade) GetBSON

func (t *Trade) GetBSON() (interface{}, error)

func (*Trade) SetBSON

func (t *Trade) SetBSON(raw bson.Raw) error

type TradeBSON

type TradeBSON struct {
	Taker          string    `json:"taker" bson:"taker"`
	Maker          string    `json:"maker" bson:"maker"`
	BaseToken      string    `json:"baseToken" bson:"baseToken"`
	QuoteToken     string    `json:"quoteToken" bson:"quoteToken"`
	MakerOrderHash string    `json:"makerOrderHash" bson:"makerOrderHash"`
	TakerOrderHash string    `json:"takerOrderHash" bson:"takerOrderHash"`
	MakerExchange  string    `json:"makerExchange" bson:"makerExchange"`
	TakerExchange  string    `json:"takerExchange" bson:"takerExchange"`
	Hash           string    `json:"hash" bson:"hash"`
	TxHash         string    `json:"txHash" bson:"txHash"`
	PairName       string    `json:"pairName" bson:"pairName"`
	Amount         string    `json:"amount" bson:"amount"`
	MakeFee        string    `json:"makeFee" bson:"makeFee"`
	TakeFee        string    `json:"takeFee" bson:"takeFee"`
	PricePoint     string    `json:"pricepoint" bson:"pricepoint"`
	Status         string    `json:"status" bson:"status"`
	CreatedAt      time.Time `json:"createdAt" bson:"createdAt"`
	UpdatedAt      time.Time `json:"updatedAt" bson:"updatedAt"`
	TakerOrderSide string    `json:"takerOrderSide" bson:"takerOrderSide"`
}

type TradeResult

type TradeResult struct {
	Fee         *big.Int
	InToken     common.Address
	InQuantity  *big.Int
	InTotal     *big.Int
	OutToken    common.Address
	OutQuantity *big.Int
	OutTotal    *big.Int
}

type TxDataMatch

type TxDataMatch struct {
	Order         []byte // serialized data of order has been processed in this tx
	Trades        []map[string]string
	RejectedOders []*tomox_state.OrderItem
}

func (TxDataMatch) DecodeOrder

func (tx TxDataMatch) DecodeOrder() (*tomox_state.OrderItem, error)

func (TxDataMatch) GetRejectedOrders

func (tx TxDataMatch) GetRejectedOrders() []*tomox_state.OrderItem

func (TxDataMatch) GetTrades

func (tx TxDataMatch) GetTrades() []map[string]string

type TxMatchBatch

type TxMatchBatch struct {
	Data      []TxDataMatch
	Timestamp int64
	TxHash    common.Hash
}

func DecodeTxMatchesBatch

func DecodeTxMatchesBatch(data []byte) (TxMatchBatch, error)

Directories

Path Synopsis
Package state provides a caching layer atop the Ethereum state trie.
Package state provides a caching layer atop the Ethereum state trie.

Jump to

Keyboard shortcuts

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