sdk

package
v0.0.29 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2019 License: Apache-2.0 Imports: 3 Imported by: 3

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
}

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 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 {
	GetHash() string
}

type TransactionReceipt

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

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