Documentation
¶
Index ¶
- Constants
- func BatchCall(routeParam string, reqs []BatchReq) error
- func BatchErc20BalanceAndAllowance(routeParam string, reqs []*BatchErc20Req) error
- func BatchTransactionRecipients(reqs []*BatchTransactionRecipientReq, blockNumber string) error
- func BatchTransactions(reqs []*BatchTransactionReq, blockNumber string) error
- func BlockNumber(result interface{}) error
- func Call(result interface{}, ethCall *CallArg, blockNumber string) error
- func ContractCallMethod(a *abi.ABI, contractAddress common.Address) ...
- func ContractSendTransactionMethod(routeParam string, a *abi.ABI, contractAddress common.Address) ...
- func DelegateAbi() *abi.ABI
- func DelegateAddresses() map[common.Address]bool
- func Erc20Abi() *abi.ABI
- func Erc20Allowance(tokenAddress, ownerAddress, spender common.Address, blockParameter string) (*big.Int, error)
- func Erc20Balance(tokenAddress, ownerAddress common.Address, blockParameter string) (*big.Int, error)
- func EstimateGas(callData []byte, to common.Address, blockNumber string) (gas, gasPrice *big.Int, err error)
- func EstimateGasPrice(minGasPrice, maxGasPrice *big.Int) *big.Int
- func GenerateSubmitRingMethodInputsData(ring *types.Ring, feeReceipt common.Address, protocolAbi *abi.ABI) ([]byte, error)
- func GetBalance(result interface{}, address common.Address, blockNumber string) error
- func GetBlockByHash(result types.CheckNull, blockHash string, withObject bool) error
- func GetBlockByNumber(result interface{}, blockNumber *big.Int, withObject bool) error
- func GetBlockTransactionCountByHash(result interface{}, blockHash string, blockParameter string) error
- func GetBlockTransactionCountByNumber(result interface{}, blockNumber string) error
- func GetCancelled(contractAddress common.Address, orderhash common.Hash, blockNumber string) (*big.Int, error)
- func GetCancelledOrFilled(contractAddress common.Address, orderhash common.Hash, blockNumber string) (*big.Int, error)
- func GetCutoff(contractAddress, owner common.Address, blockNumber string) (*big.Int, error)
- func GetCutoffPair(contractAddress, owner, token1, token2 common.Address, blockNumber string) (*big.Int, error)
- func GetFullBlock(blockNumber *big.Int, withObject bool) (interface{}, error)
- func GetSpenderAddress(protocolAddress common.Address) (spender common.Address, err error)
- func GetTransactionByHash(result types.CheckNull, txHash string, blockParameter string) error
- func GetTransactionCount(result interface{}, address common.Address, blockNumber string) error
- func GetTransactionReceipt(result interface{}, txHash string, blockParameter string) error
- func IncludeGasPriceEvaluator()
- func Initialize(accessorOptions config.AccessorOptions, commonOptions config.CommonOptions, ...) error
- func IsRelateProtocol(protocol, delegate common.Address) bool
- func IsSpenderAddress(spender common.Address) bool
- func NewAbi(abiStr string) (*abi.ABI, error)
- func ProtocolAddresses() map[common.Address]*ProtocolAddress
- func ProtocolImplAbi() *abi.ABI
- func SendRawTransaction(result interface{}, tx string) error
- func SignAndSendTransaction(sender common.Address, to common.Address, gas, gasPrice, value *big.Int, ...) (string, error)
- func SupportedDelegateAddress(delegate common.Address) bool
- func TokenRegistryAbi() *abi.ABI
- func TxIsSubmitRing(methodName string) bool
- func WethAbi() *abi.ABI
- type AddressAuthorizedEvent
- type AddressDeAuthorizedEvent
- type AddressNonce
- type ApprovalEvent
- type ApproveMethod
- type BatchBalanceReq
- type BatchBalanceReqs
- type BatchErc20AllowanceReq
- type BatchErc20AllowanceReqs
- type BatchErc20Req
- type BatchReq
- type BatchTransactionRecipientReq
- type BatchTransactionReq
- type Block
- type BlockIterator
- type BlockWithTxAndReceipt
- type BlockWithTxHash
- type BlockWithTxObject
- type CallArg
- type CancelOrderMethod
- type CutoffEvent
- type CutoffMethod
- type CutoffPairEvent
- type CutoffPairMethod
- type FilterQuery
- type GasPriceEvaluator
- type Log
- type LogParameter
- type MutilClient
- type OrderCancelledEvent
- type ProtocolAddress
- type RingMinedEvent
- type RpcClient
- type SubmitRingMethodInputs
- type SyncingResult
- type TokenRegisteredEvent
- type TokenUnRegisteredEvent
- type Transaction
- type TransactionReceipt
- type TransferEvent
- type TransferMethod
- type WethDepositEvent
- type WethWithdrawalEvent
- type WethWithdrawalMethod
Constants ¶
View Source
const ( USAGE_CLIENT_BLOCK = "usage_client_block_" BLOCKS = "blocks_" )
View Source
const ( EVENT_RING_MINED = "RingMined" EVENT_ORDER_CANCELLED = "OrderCancelled" EVENT_CUTOFF_ALL = "AllOrdersCancelled" EVENT_CUTOFF_PAIR = "OrdersCancelled" EVENT_TOKEN_REGISTERED = "TokenRegistered" EVENT_TOKEN_UNREGISTERED = "TokenUnregistered" EVENT_ADDRESS_AUTHORIZED = "AddressAuthorized" EVENT_ADDRESS_DEAUTHORIZED = "AddressDeauthorized" EVENT_TRANSFER = "Transfer" EVENT_APPROVAL = "Approval" EVENT_WETH_DEPOSIT = "Deposit" EVENT_WETH_WITHDRAWAL = "Withdrawal" )
View Source
const ( METHOD_UNKNOWN = "" METHOD_SUBMIT_RING = "submitRing" METHOD_CANCEL_ORDER = "cancelOrder" METHOD_CUTOFF_ALL = "cancelAllOrders" METHOD_CUTOFF_PAIR = "cancelAllOrdersByTradingPair" METHOD_WETH_DEPOSIT = "deposit" METHOD_WETH_WITHDRAWAL = "withdraw" METHOD_APPROVE = "approve" METHOD_TRANSFER = "transfer" )
Variables ¶
This section is empty.
Functions ¶
func BatchErc20BalanceAndAllowance ¶
func BatchErc20BalanceAndAllowance(routeParam string, reqs []*BatchErc20Req) error
func BatchTransactionRecipients ¶
func BatchTransactionRecipients(reqs []*BatchTransactionRecipientReq, blockNumber string) error
func BatchTransactions ¶
func BatchTransactions(reqs []*BatchTransactionReq, blockNumber string) error
func BlockNumber ¶
func BlockNumber(result interface{}) error
func ContractCallMethod ¶
func DelegateAbi ¶
func DelegateAddresses ¶
func Erc20Allowance ¶
func Erc20Balance ¶
func EstimateGas ¶
func GetBalance ¶
func GetBlockByHash ¶
func GetBlockByNumber ¶
func GetCancelled ¶
func GetCancelledOrFilled ¶
func GetCutoffPair ¶
func GetCutoffPair(contractAddress, owner, token1, token2 common.Address, blockNumber string) (*big.Int, error)
todo(fuk): 需要测试,如果没有,合约是否返回为0
func GetSpenderAddress ¶
func GetTransactionByHash ¶
func GetTransactionCount ¶
func GetTransactionReceipt ¶
func IncludeGasPriceEvaluator ¶
func IncludeGasPriceEvaluator()
func Initialize ¶
func Initialize(accessorOptions config.AccessorOptions, commonOptions config.CommonOptions, wethAddress common.Address) error
func IsRelateProtocol ¶
func IsSpenderAddress ¶
func ProtocolAddresses ¶
func ProtocolAddresses() map[common.Address]*ProtocolAddress
func ProtocolImplAbi ¶
func SendRawTransaction ¶
func SignAndSendTransaction ¶
func TokenRegistryAbi ¶
func TxIsSubmitRing ¶
Types ¶
type AddressAuthorizedEvent ¶
type AddressAuthorizedEvent struct {
ContractAddress common.Address `fieldName:"addr" fieldId:"0"`
Number int `fieldName:"number" fieldId:"1"`
}
func (*AddressAuthorizedEvent) ConvertDown ¶
func (e *AddressAuthorizedEvent) ConvertDown() *types.AddressAuthorizedEvent
type AddressDeAuthorizedEvent ¶
type AddressDeAuthorizedEvent struct {
ContractAddress common.Address `fieldName:"addr" fieldId:"0"`
Number int `fieldName:"number" fieldId:"1"`
}
func (*AddressDeAuthorizedEvent) ConvertDown ¶
func (e *AddressDeAuthorizedEvent) ConvertDown() *types.AddressDeAuthorizedEvent
type AddressNonce ¶
type ApprovalEvent ¶
type ApprovalEvent struct {
Owner common.Address `fieldName:"owner" fieldId:"0"`
Spender common.Address `fieldName:"spender" fieldId:"1"`
Value *big.Int `fieldName:"value" fieldId:"2"`
}
func (*ApprovalEvent) ConvertDown ¶
func (e *ApprovalEvent) ConvertDown() *types.ApprovalEvent
type ApproveMethod ¶
type ApproveMethod struct {
Spender common.Address `fieldName:"spender" fieldId:"0"`
Value *big.Int `fieldName:"value" fieldId:"1"`
}
func (*ApproveMethod) ConvertDown ¶
func (e *ApproveMethod) ConvertDown() *types.ApprovalEvent
type BatchBalanceReq ¶
type BatchBalanceReqs ¶
type BatchBalanceReqs []*BatchBalanceReq
func (BatchBalanceReqs) FromBatchElem ¶
func (reqs BatchBalanceReqs) FromBatchElem(elems []rpc.BatchElem)
func (BatchBalanceReqs) ToBatchElem ¶
func (reqs BatchBalanceReqs) ToBatchElem() []rpc.BatchElem
type BatchErc20AllowanceReq ¶
type BatchErc20AllowanceReqs ¶
type BatchErc20AllowanceReqs []*BatchErc20AllowanceReq
func (BatchErc20AllowanceReqs) FromBatchElem ¶
func (reqs BatchErc20AllowanceReqs) FromBatchElem(elems []rpc.BatchElem)
func (BatchErc20AllowanceReqs) ToBatchElem ¶
func (reqs BatchErc20AllowanceReqs) ToBatchElem() []rpc.BatchElem
type BatchErc20Req ¶
type BatchTransactionRecipientReq ¶
type BatchTransactionRecipientReq struct {
TxHash string
TxContent TransactionReceipt
Err error
}
type BatchTransactionReq ¶
type BatchTransactionReq struct {
TxHash string
TxContent Transaction
Err error
}
type Block ¶
type Block struct {
Number types.Big `json:"number"`
Hash common.Hash `json:"hash"`
ParentHash common.Hash `json:"parentHash"`
Nonce string `json:"nonce"`
Sha3Uncles string `json:"sha3Uncles"`
LogsBloom string `json:"logsBloom"`
TransactionsRoot string `json:"transactionsRoot"`
ReceiptsRoot string `json:"stateRoot"`
Miner string `json:"miner"`
Difficulty types.Big `json:"difficulty"`
TotalDifficulty types.Big `json:"totalDifficulty"`
ExtraData string `json:"extraData"`
Size types.Big `json:"size"`
GasLimit types.Big `json:"gasLimit"`
GasUsed types.Big `json:"gasUsed"`
Timestamp types.Big `json:"timestamp"`
Uncles []string `json:"uncles"`
}
type BlockIterator ¶
type BlockIterator struct {
// contains filtered or unexported fields
}
func NewBlockIterator ¶
func NewBlockIterator(startNumber, endNumber *big.Int, withTxData bool, confirms uint64) *BlockIterator
func (*BlockIterator) Next ¶
func (iterator *BlockIterator) Next() (interface{}, error)
func (*BlockIterator) Prev ¶
func (iterator *BlockIterator) Prev() (interface{}, error)
type BlockWithTxAndReceipt ¶
type BlockWithTxAndReceipt struct {
Block
Transactions []Transaction `json:"transactions"`
Receipts []TransactionReceipt `json:"receipts"`
}
type BlockWithTxHash ¶
type BlockWithTxObject ¶
type BlockWithTxObject struct {
Block
Transactions []Transaction
}
type CancelOrderMethod ¶
type CancelOrderMethod struct {
AddressList [5]common.Address `fieldName:"addresses" fieldId:"0"` // owner, tokenS, tokenB, authAddr
OrderValues [6]*big.Int `fieldName:"orderValues" fieldId:"1"` // amountS, amountB, validSince (second), validUntil (second), lrcFee, and cancelAmount
BuyNoMoreThanB bool `fieldName:"buyNoMoreThanAmountB" fieldId:"2"`
MarginSplit uint8 `fieldName:"marginSplitPercentage" fieldId:"3"`
V uint8 `fieldName:"v" fieldId:"4"`
R [32]byte `fieldName:"r" fieldId:"5"`
S [32]byte `fieldName:"s" fieldId:"6"`
}
func (*CancelOrderMethod) ConvertDown ¶
todo(fuk): modify internal cancelOrderMethod and implement related functions
type CutoffEvent ¶
type CutoffEvent struct {
Owner common.Address `fieldName:"_address" fieldId:"0"`
Cutoff *big.Int `fieldName:"_cutoff" fieldId:"1"`
}
func (*CutoffEvent) ConvertDown ¶
func (e *CutoffEvent) ConvertDown() *types.CutoffEvent
type CutoffMethod ¶
func (*CutoffMethod) ConvertDown ¶
func (method *CutoffMethod) ConvertDown() *types.CutoffEvent
type CutoffPairEvent ¶
type CutoffPairEvent struct {
Owner common.Address `fieldName:"_address" fieldId:"0"`
Token1 common.Address `fieldName:"_token1" fieldId:"1"`
Token2 common.Address `fieldName:"_token2" fieldId:"2"`
Cutoff *big.Int `fieldName:"_cutoff" fieldId:"3"`
}
func (*CutoffPairEvent) ConvertDown ¶
func (e *CutoffPairEvent) ConvertDown() *types.CutoffPairEvent
type CutoffPairMethod ¶
type CutoffPairMethod struct {
Token1 common.Address `fieldName:"token1" fieldId:"0"`
Token2 common.Address `fieldName:"token2" fieldId:"1"`
Cutoff *big.Int `fieldName:"cutoff" fieldId:"2"`
}
func (*CutoffPairMethod) ConvertDown ¶
func (method *CutoffPairMethod) ConvertDown() *types.CutoffPairEvent
type FilterQuery ¶
type GasPriceEvaluator ¶
type GasPriceEvaluator struct {
Blocks []*BlockWithTxAndReceipt
// contains filtered or unexported fields
}
type Log ¶
type Log struct {
LogIndex types.Big `json:"logIndex"`
BlockNumber types.Big `json:"blockNumber"`
BlockHash string `json:"blockHash"`
TransactionHash string `json:"transactionHash"`
TransactionIndex types.Big `json:"transactionIndex"`
Address string `json:"address"`
Data string `json:"data"`
Topics []string `json:"topics"`
Removed bool `json:"removed"`
}
type LogParameter ¶
type LogParameter struct {
Topics []string
}
type MutilClient ¶
type MutilClient struct {
// contains filtered or unexported fields
}
func NewMutilClient ¶
func NewMutilClient(urls []string) *MutilClient
将最近的块放入redis中,获取时,从redis中按照块号获取可用的client与本地保存做交集,然后随机选取client,请求节点
func (*MutilClient) BlockNumber ¶
func (mc *MutilClient) BlockNumber(result interface{}) error
type OrderCancelledEvent ¶
type OrderCancelledEvent struct {
OrderHash common.Hash `fieldName:"_orderHash" fieldId:"0"`
AmountCancelled *big.Int `fieldName:"_amountCancelled" fieldId:"1"` // amountCancelled为多次取消累加总量,根据orderhash以及amountCancelled可以确定其唯一性
}
func (*OrderCancelledEvent) ConvertDown ¶
func (e *OrderCancelledEvent) ConvertDown() *types.OrderCancelledEvent
type ProtocolAddress ¶
type RingMinedEvent ¶
type RingMinedEvent struct {
RingIndex *big.Int `fieldName:"_ringIndex" fieldId:"0"`
RingHash common.Hash `fieldName:"_ringhash" fieldId:"1"`
Miner common.Address `fieldName:"_miner" fieldId:"2"`
FeeRecipient common.Address `fieldName:"_feeRecipient" fieldId:"3"`
OrderInfoList [][32]uint8 `fieldName:"_orderInfoList" fieldId:"4"`
}
func (*RingMinedEvent) ConvertDown ¶
func (e *RingMinedEvent) ConvertDown() (*types.RingMinedEvent, []*types.OrderFilledEvent, error)
type SubmitRingMethodInputs ¶
type SubmitRingMethodInputs struct {
AddressList [][4]common.Address `fieldName:"addressList" fieldId:"0"` // owner,tokenS, wallet, authAddress
UintArgsList [][6]*big.Int `fieldName:"uintArgsList" fieldId:"1"` // amountS, amountB, validSince (second),validUntil (second), lrcFee, rateAmountS.
Uint8ArgsList [][1]uint8 `fieldName:"uint8ArgsList" fieldId:"2"` // marginSplitPercentageList
BuyNoMoreThanBList []bool `fieldName:"buyNoMoreThanAmountBList" fieldId:"3"`
VList []uint8 `fieldName:"vList" fieldId:"4"`
RList [][32]byte `fieldName:"rList" fieldId:"5"`
SList [][32]byte `fieldName:"sList" fieldId:"6"`
FeeRecipient common.Address `fieldName:"feeRecipient" fieldId:"7"`
FeeSelections uint16 `fieldName:"feeSelections" fieldId:"8"`
Protocol common.Address
FeeReceipt common.Address
}
func (*SubmitRingMethodInputs) ConvertDown ¶
func (m *SubmitRingMethodInputs) ConvertDown() (*types.SubmitRingMethodEvent, error)
should add protocol, miner, feeRecipient
type SyncingResult ¶
type TokenRegisteredEvent ¶
type TokenRegisteredEvent struct {
Token common.Address `fieldName:"addr" fieldId:"0"`
Symbol string `fieldName:"symbol" fieldId:"1"`
}
func (*TokenRegisteredEvent) ConvertDown ¶
func (e *TokenRegisteredEvent) ConvertDown() *types.TokenRegisterEvent
type TokenUnRegisteredEvent ¶
type TokenUnRegisteredEvent struct {
Token common.Address `fieldName:"addr" fieldId:"0"`
Symbol string `fieldName:"symbol" fieldId:"1"`
}
func (*TokenUnRegisteredEvent) ConvertDown ¶
func (e *TokenUnRegisteredEvent) ConvertDown() *types.TokenUnRegisterEvent
type Transaction ¶
type Transaction struct {
Hash string `json:"hash"`
Nonce types.Big `json:"nonce"`
BlockHash string `json:"blockHash"`
BlockNumber types.Big `json:"blockNumber"`
TransactionIndex types.Big `json:"transactionIndex"`
From string `json:"from"`
To string `json:"to"`
Value types.Big `json:"value"`
GasPrice types.Big `json:"gasPrice"`
Gas types.Big `json:"gas"`
Input string `json:"input"`
R string `json:"r"`
S string `json:"s"`
V string `json:"v"`
}
func (*Transaction) IsNull ¶
func (tx *Transaction) IsNull() bool
func (*Transaction) IsPending ¶
func (tx *Transaction) IsPending() bool
func (*Transaction) MethodId ¶
func (tx *Transaction) MethodId() string
type TransactionReceipt ¶
type TransactionReceipt struct {
BlockHash string `json:"blockHash"`
BlockNumber types.Big `json:"blockNumber"`
ContractAddress string `json:"contractAddress"`
CumulativeGasUsed types.Big `json:"cumulativeGasUsed"`
From string `json:"from"`
GasUsed types.Big `json:"gasUsed"`
Logs []Log `json:"logs"`
LogsBloom string `json:"logsBloom"`
Root string `json:"root"`
Status *types.Big `json:"status"`
To string `json:"to"`
TransactionHash string `json:"transactionHash"`
TransactionIndex types.Big `json:"transactionIndex"`
}
func (*TransactionReceipt) AfterByzantiumFork ¶
func (receipt *TransactionReceipt) AfterByzantiumFork() bool
func (*TransactionReceipt) Failed ¶
func (receipt *TransactionReceipt) Failed(tx *Transaction) bool
func (*TransactionReceipt) HasNoLog ¶
func (receipt *TransactionReceipt) HasNoLog() bool
func (*TransactionReceipt) StatusInvalid ¶
func (receipt *TransactionReceipt) StatusInvalid() bool
type TransferEvent ¶
type TransferEvent struct {
Sender common.Address `fieldName:"from" fieldId:"0"`
Receiver common.Address `fieldName:"to" fieldId:"1"`
Value *big.Int `fieldName:"value" fieldId:"2"`
}
func (*TransferEvent) ConvertDown ¶
func (e *TransferEvent) ConvertDown() *types.TransferEvent
type TransferMethod ¶
type TransferMethod struct {
Receiver common.Address `fieldName:"to" fieldId:"0"`
Value *big.Int `fieldName:"value" fieldId:"1"`
}
function transfer(address to, uint256 value) public returns (bool);
func (*TransferMethod) ConvertDown ¶
func (e *TransferMethod) ConvertDown() *types.TransferEvent
type WethDepositEvent ¶
type WethDepositEvent struct {
DstAddress common.Address `fieldName:"dst" fieldId:"0"` // 充值到哪个地址
Value *big.Int `fieldName:"wad" fieldId:"1"`
}
event Deposit(address indexed dst, uint wad);
func (*WethDepositEvent) ConvertDown ¶
func (e *WethDepositEvent) ConvertDown() *types.WethDepositEvent
type WethWithdrawalEvent ¶
type WethWithdrawalEvent struct {
SrcAddress common.Address `fieldName:"src" fieldId:"0"`
Value *big.Int `fieldName:"wad" fieldId:"1"`
}
event Withdrawal(address indexed src, uint wad);
func (*WethWithdrawalEvent) ConvertDown ¶
func (e *WethWithdrawalEvent) ConvertDown() *types.WethWithdrawalEvent
type WethWithdrawalMethod ¶
func (*WethWithdrawalMethod) ConvertDown ¶
func (e *WethWithdrawalMethod) ConvertDown() *types.WethWithdrawalEvent
Click to show internal directories.
Click to hide internal directories.