sdk

package
v0.0.0-...-a475e2e Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block interface {
	Number() uint64
	Timestamp() uint64
	GetTransactions() []Transaction

	Hash() string
	ParentHash() string
}

type BlockChain

type BlockChain interface {
	GetTokenBalance(tokenAddress, address string) decimal.Decimal
	GetTokenAllowance(tokenAddress, proxyAddress, address string) decimal.Decimal
	GetHotFeeDiscount(address string) decimal.Decimal

	GetBlockNumber() (uint64, error)
	GetBlockByNumber(blockNumber uint64) (Block, error)

	GetTransaction(ID string) (Transaction, error)
	GetTransactionReceipt(ID string) (TransactionReceipt, error)
	GetTransactionAndReceipt(ID string) (Transaction, TransactionReceipt, error)

	IsValidSignature(address string, message string, signature string) (bool, error)

	SendTransaction(txAttributes map[string]interface{}, privateKey []byte) (transactionHash string, err error)
	SendRawTransaction(tx interface{}) (string, error)
}

type Hydro

type Hydro interface {
	HydroProtocol
	BlockChain
}

type HydroProtocol

type HydroProtocol interface {
	GenerateOrderData(version, expiredAtSeconds, salt int64, asMakerFeeRate, asTakerFeeRate, makerRebateRate decimal.Decimal, isSell, isMarket, isMakerOnly bool) string
	GetOrderHash(*Order) []byte
	GetMatchOrderCallData(*Order, []*Order, []*big.Int) []byte

	IsValidOrderSignature(address string, orderID string, signature string) bool
}

type IReceiptLog

type IReceiptLog interface {
	GetRemoved() bool
	GetLogIndex() int
	GetTransactionIndex() int
	GetTransactionHash() string
	GetBlockNum() int
	GetBlockHash() string
	GetAddress() string
	GetData() string
	GetTopics() []string
}

type MockBlockchain

type MockBlockchain struct {
	BlockChain
	mock.Mock
}

func (*MockBlockchain) GetBlockByNumber

func (m *MockBlockchain) GetBlockByNumber(blockNumber uint64) (Block, error)

func (*MockBlockchain) GetBlockNumber

func (m *MockBlockchain) GetBlockNumber() (uint64, error)

func (*MockBlockchain) GetHotFeeDiscount

func (m *MockBlockchain) GetHotFeeDiscount(address string) decimal.Decimal

func (*MockBlockchain) GetTokenAllowance

func (m *MockBlockchain) GetTokenAllowance(tokenAddress, proxyAddress, address string) decimal.Decimal

func (*MockBlockchain) GetTokenBalance

func (m *MockBlockchain) GetTokenBalance(tokenAddress string, address string) decimal.Decimal

func (*MockBlockchain) GetTransaction

func (m *MockBlockchain) GetTransaction(ID string) (Transaction, error)

func (*MockBlockchain) GetTransactionAndReceipt

func (m *MockBlockchain) GetTransactionAndReceipt(ID string) (Transaction, TransactionReceipt, error)

func (*MockBlockchain) GetTransactionReceipt

func (m *MockBlockchain) GetTransactionReceipt(ID string) (TransactionReceipt, error)

func (*MockBlockchain) IsValidSignature

func (m *MockBlockchain) IsValidSignature(address string, message string, signature string) (bool, error)

func (*MockBlockchain) SendRawTransaction

func (m *MockBlockchain) SendRawTransaction(tx interface{}) (string, error)

func (*MockBlockchain) SendTransaction

func (m *MockBlockchain) SendTransaction(txAttributes map[string]interface{}, privateKey []byte) (transactionHash string, err error)

type MockHydro

type MockHydro struct {
	HydroProtocol
	BlockChain
}

func NewMockHydro

func NewMockHydro() *MockHydro

type MockHydroProtocol

type MockHydroProtocol struct {
	HydroProtocol
	mock.Mock
}

func (*MockHydroProtocol) GenerateOrderData

func (m *MockHydroProtocol) GenerateOrderData(version, expiredAtSeconds, salt int64, asMakerFeeRate, asTakerFeeRate, makerRebateRate decimal.Decimal, isSell, isMarket, isMakerOnly bool) string

func (*MockHydroProtocol) GetMatchOrderCallData

func (m *MockHydroProtocol) GetMatchOrderCallData(takerOrder *Order, makerOrders []*Order, baseTokenFilledAmounts []*big.Int) []byte

func (*MockHydroProtocol) GetOrderHash

func (m *MockHydroProtocol) GetOrderHash(order *Order) []byte

type Order

type Order struct {
	Trader           string
	BaseTokenAmount  *big.Int
	QuoteTokenAmount *big.Int
	GasTokenAmount   *big.Int
	Data             string
	Signature        string

	Relayer           string
	BaseTokenAddress  string
	QuoteTokenAddress string
}

func NewOrderWithData

func NewOrderWithData(
	trader, relayer, baseTokenAddress, quoteTokenAddress string,
	baseTokenAmount, quoteTokenAmount, gasTokenAddress *big.Int,
	data string,
	signature string,
) *Order

type OrderAddressSet

type OrderAddressSet struct {
	BaseToken  string `json:"baseToken"`
	QuoteToken string `json:"quoteToken"`
	Relayer    string `json:"relayer"`
}

type OrderParam

type OrderParam struct {
	Trader           string          `json:"trader"`
	BaseTokenAmount  *big.Int        `json:"base_token_amount"`
	QuoteTokenAmount *big.Int        `json:"quote_token_amount"`
	GasTokenAmount   *big.Int        `json:"gas_token_amount"`
	Data             string          `json:"data"`
	Signature        *OrderSignature `json:"signature"`
}

type OrderSignature

type OrderSignature struct {
	Config [32]byte
	R      [32]byte
	S      [32]byte
}

type Transaction

type Transaction interface {
	GetBlockHash() string
	GetBlockNumber() uint64
	GetFrom() string
	GetGas() int
	GetGasPrice() big.Int
	GetHash() string
	GetTo() string
	GetValue() big.Int
}

type TransactionReceipt

type TransactionReceipt interface {
	GetResult() bool
	GetBlockNumber() uint64

	GetBlockHash() string
	GetTxHash() string
	GetTxIndex() int

	GetLogs() []IReceiptLog
}

Directories

Path Synopsis
rlp encoding standard https://github.com/ethereum/wiki/wiki/RLP
rlp encoding standard https://github.com/ethereum/wiki/wiki/RLP

Jump to

Keyboard shortcuts

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