ethereum

package
v0.0.41 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2019 License: Apache-2.0 Imports: 20 Imported by: 9

Documentation

Index

Constants

View Source
const (
	ERC20TotalSupply = "0x18160ddd" // totalSupply()
	ERC20Symbol      = "0x95d89b41" // symbol()
	ERC20Name        = "0x06fdde03" // name()
	ERC20Decimals    = "0x313ce567" // decimals()

)

sha3 result of erc20 method

View Source
const FeeRateBase = 100000

Variables

View Source
var EIP712_DOMAIN_TYPEHASH []byte
View Source
var EIP712_ORDER_TYPE []byte

Functions

func GetHash

func GetHash(order *sdk.Order) []byte

func GetIsMakerOnlyFromOrderData

func GetIsMakerOnlyFromOrderData(data string) bool

func GetOrderData

func GetOrderData(
	version uint64,
	isSell bool,
	isMarketOrder bool,
	expiredAt, rawMakerFeeRate, rawTakerFeeRate, rawMakerRebateRate uint64,
	salt uint64,
	isMakerOnly bool,
) string

func GetOrderExpireTsFromOrderData

func GetOrderExpireTsFromOrderData(data string) uint64

func GetRawMakerFeeRateFromOrderData

func GetRawMakerFeeRateFromOrderData(data string) uint16

func GetRawMakerRebateRateFromOrderData

func GetRawMakerRebateRateFromOrderData(data string) uint16

func GetRawTakerFeeRateFromOrderData

func GetRawTakerFeeRateFromOrderData(data string) uint16

func IsValidSignature

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

func PersonalSign

func PersonalSign(message []byte, privateKey string) ([]byte, error)

Types

type Erc20Service added in v0.0.3

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

func (*Erc20Service) AllowanceOf added in v0.0.30

func (e *Erc20Service) AllowanceOf(tokenAddress, proxyAddress, address string) (error, *big.Int)

func (*Erc20Service) BalanceOf added in v0.0.30

func (e *Erc20Service) BalanceOf(tokenAddress, address string) (error, *big.Int)

func (*Erc20Service) Decimals added in v0.0.3

func (e *Erc20Service) Decimals(address string) (error, int)

func (*Erc20Service) Name added in v0.0.3

func (e *Erc20Service) Name(address string) (error, string)

func (*Erc20Service) Symbol added in v0.0.3

func (e *Erc20Service) Symbol(address string) (error, string)

func (*Erc20Service) TotalSupply added in v0.0.3

func (e *Erc20Service) TotalSupply(address string) (error, *big.Int)

type Ethereum

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

func NewEthereum

func NewEthereum(rpcUrl string, hybridExAddr string) *Ethereum

func (*Ethereum) EnableDebug added in v0.0.19

func (e *Ethereum) EnableDebug(b bool)

func (*Ethereum) GetBlockByNumber

func (e *Ethereum) GetBlockByNumber(number uint64) (sdk.Block, error)

func (*Ethereum) GetBlockNumber

func (e *Ethereum) GetBlockNumber() (uint64, error)

func (*Ethereum) GetHotFeeDiscount

func (e *Ethereum) GetHotFeeDiscount(address string) decimal.Decimal

func (*Ethereum) GetTokenAllowance

func (e *Ethereum) GetTokenAllowance(tokenAddress, proxyAddress, address string) decimal.Decimal

func (*Ethereum) GetTokenBalance

func (e *Ethereum) GetTokenBalance(tokenAddress, address string) decimal.Decimal

func (*Ethereum) GetTransaction

func (e *Ethereum) GetTransaction(ID string) (sdk.Transaction, error)

func (*Ethereum) GetTransactionAndReceipt

func (e *Ethereum) GetTransactionAndReceipt(ID string) (sdk.Transaction, sdk.TransactionReceipt, error)

func (*Ethereum) GetTransactionCount

func (e *Ethereum) GetTransactionCount(address string) (int, error)

func (*Ethereum) GetTransactionReceipt

func (e *Ethereum) GetTransactionReceipt(ID string) (sdk.TransactionReceipt, error)

func (*Ethereum) IsValidSignature

func (e *Ethereum) IsValidSignature(address string, message string, signature string) (bool, error)

func (*Ethereum) SendRawTransaction

func (e *Ethereum) SendRawTransaction(tx interface{}) (string, error)

func (*Ethereum) SendTransaction

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

type EthereumBlock

type EthereumBlock struct {
	*ethrpc.Block
}

func (*EthereumBlock) GetTransactions

func (block *EthereumBlock) GetTransactions() []sdk.Transaction

func (*EthereumBlock) Hash added in v0.0.39

func (block *EthereumBlock) Hash() string

func (*EthereumBlock) Number

func (block *EthereumBlock) Number() uint64

func (*EthereumBlock) ParentHash added in v0.0.39

func (block *EthereumBlock) ParentHash() string

func (*EthereumBlock) Timestamp

func (block *EthereumBlock) Timestamp() uint64

type EthereumHydro

type EthereumHydro struct {
	*Ethereum
	*EthereumHydroProtocol
}

func NewEthereumHydro

func NewEthereumHydro(rpcURL, hybridExAddr string) *EthereumHydro

type EthereumHydroProtocol

type EthereumHydroProtocol struct{}

func (*EthereumHydroProtocol) GenerateOrderData

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

func (*EthereumHydroProtocol) GetMatchOrderCallData

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

func (*EthereumHydroProtocol) GetOrderHash

func (*EthereumHydroProtocol) GetOrderHash(order *sdk.Order) []byte

func (*EthereumHydroProtocol) IsValidOrderSignature

func (*EthereumHydroProtocol) IsValidOrderSignature(address string, orderID string, signature string) bool

type EthereumTransaction

type EthereumTransaction struct {
	*ethrpc.Transaction
}

func (*EthereumTransaction) GetBlockHash added in v0.0.39

func (t *EthereumTransaction) GetBlockHash() string

func (*EthereumTransaction) GetBlockNumber added in v0.0.39

func (t *EthereumTransaction) GetBlockNumber() uint64

func (*EthereumTransaction) GetFrom added in v0.0.39

func (t *EthereumTransaction) GetFrom() string

func (*EthereumTransaction) GetGas added in v0.0.39

func (t *EthereumTransaction) GetGas() int

func (*EthereumTransaction) GetGasPrice added in v0.0.39

func (t *EthereumTransaction) GetGasPrice() big.Int

func (*EthereumTransaction) GetHash

func (t *EthereumTransaction) GetHash() string

func (*EthereumTransaction) GetTo added in v0.0.39

func (t *EthereumTransaction) GetTo() string

func (*EthereumTransaction) GetValue added in v0.0.39

func (t *EthereumTransaction) GetValue() big.Int

type EthereumTransactionReceipt

type EthereumTransactionReceipt struct {
	*ethrpc.TransactionReceipt
}

func (*EthereumTransactionReceipt) GetBlockHash added in v0.0.39

func (r *EthereumTransactionReceipt) GetBlockHash() string

func (*EthereumTransactionReceipt) GetBlockNumber

func (r *EthereumTransactionReceipt) GetBlockNumber() uint64

func (*EthereumTransactionReceipt) GetLogs added in v0.0.39

func (r *EthereumTransactionReceipt) GetLogs() (rst []sdk.IReceiptLog)

func (*EthereumTransactionReceipt) GetResult

func (r *EthereumTransactionReceipt) GetResult() bool

func (*EthereumTransactionReceipt) GetTxHash added in v0.0.39

func (r *EthereumTransactionReceipt) GetTxHash() string

func (*EthereumTransactionReceipt) GetTxIndex added in v0.0.39

func (r *EthereumTransactionReceipt) GetTxIndex() int

type IErc20 added in v0.0.3

type IErc20 interface {
	Symbol(address string) (error, string)
	Decimals(address string) (error, int)
	Name(address string) (error, string)
	TotalSupply(address string) (error, *big.Int)
	BalanceOf(tokenAddress, address string) (error, *big.Int)
	AllowanceOf(tokenAddress, proxyAddress, address string) (error, *big.Int)
}

func NewErc20Service added in v0.0.3

func NewErc20Service(client *ethrpc.EthRPC) IErc20

type ReceiptLog added in v0.0.39

type ReceiptLog struct {
	*ethrpc.Log
}

func (ReceiptLog) GetAddress added in v0.0.39

func (log ReceiptLog) GetAddress() string

func (ReceiptLog) GetBlockHash added in v0.0.39

func (log ReceiptLog) GetBlockHash() string

func (ReceiptLog) GetBlockNum added in v0.0.39

func (log ReceiptLog) GetBlockNum() int

func (ReceiptLog) GetData added in v0.0.39

func (log ReceiptLog) GetData() string

func (ReceiptLog) GetLogIndex added in v0.0.39

func (log ReceiptLog) GetLogIndex() int

func (ReceiptLog) GetRemoved added in v0.0.39

func (log ReceiptLog) GetRemoved() bool

func (ReceiptLog) GetTopics added in v0.0.39

func (log ReceiptLog) GetTopics() []string

func (ReceiptLog) GetTransactionHash added in v0.0.39

func (log ReceiptLog) GetTransactionHash() string

func (ReceiptLog) GetTransactionIndex added in v0.0.39

func (log ReceiptLog) GetTransactionIndex() int

Jump to

Keyboard shortcuts

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