Documentation ¶
Index ¶
- Constants
- func TypeStr(typ TxType) string
- type ApproveContent
- type CancelContent
- type CutoffContent
- type CutoffPairContent
- type OrderFilledContent
- type TransactionContent
- type TransactionEntity
- func (tx *TransactionEntity) Compare(src *TransactionEntity) bool
- func (tx *TransactionEntity) FromApproveEvent(src *types.ApprovalEvent) error
- func (tx *TransactionEntity) FromCancelEvent(src *types.OrderCancelledEvent) error
- func (tx *TransactionEntity) FromCutoffEvent(src *types.CutoffEvent) error
- func (tx *TransactionEntity) FromCutoffPairEvent(src *types.CutoffPairEvent) error
- func (tx *TransactionEntity) FromEthTransferEvent(src *types.EthTransferEvent) error
- func (tx *TransactionEntity) FromOrderFilledEvent(src *types.OrderFilledEvent) error
- func (tx *TransactionEntity) FromTransferEvent(src *types.TransferEvent) error
- func (tx *TransactionEntity) FromUnsupportedContractEvent(src *types.UnsupportedContractEvent) error
- func (tx *TransactionEntity) FromWethDepositEvent(src *types.WethDepositEvent) error
- func (tx *TransactionEntity) FromWethWithdrawalEvent(src *types.WethWithdrawalEvent) error
- type TransactionJsonResult
- func (r *TransactionJsonResult) FromApproveEntity(entity *TransactionEntity) error
- func (r *TransactionJsonResult) FromCancelEntity(entity *TransactionEntity) error
- func (r *TransactionJsonResult) FromCutoffEntity(entity *TransactionEntity) error
- func (r *TransactionJsonResult) FromCutoffPairEntity(entity *TransactionEntity) error
- func (r *TransactionJsonResult) FromFillEntity(entity *TransactionEntity) error
- func (r *TransactionJsonResult) FromOtherEntity(entity *TransactionEntity) error
- func (r *TransactionJsonResult) FromTransferEntity(entity *TransactionEntity) error
- func (r *TransactionJsonResult) FromWethDepositEntity(entity *TransactionEntity) error
- func (r *TransactionJsonResult) FromWethWithdrawalEntity(entity *TransactionEntity) error
- type TransactionView
- func ApproveView(src *types.ApprovalEvent) (TransactionView, error)
- func CancelView(src *types.OrderCancelledEvent) (TransactionView, error)
- func CutoffPairView(src *types.CutoffPairEvent) (TransactionView, error)
- func CutoffView(src *types.CutoffEvent) (TransactionView, error)
- func EthTransferView(src *types.EthTransferEvent) ([]TransactionView, error)
- func OrderFilledView(src *types.OrderFilledEvent) ([]TransactionView, error)
- func TransferView(src *types.TransferEvent) ([]TransactionView, error)
- func UnsupportedContractView(src *types.UnsupportedContractEvent) ([]TransactionView, error)
- func WethDepositView(src *types.WethDepositEvent) ([]TransactionView, error)
- func WethWithdrawalView(src *types.WethWithdrawalEvent) ([]TransactionView, error)
- type TransferContent
- type TxType
- type WethDepositContent
- type WethWithdrawalContent
Constants ¶
View Source
const ( SYMBOL_ETH = "ETH" SYMBOL_WETH = "WETH" SYMBOL_LRC = "LRC" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ApproveContent ¶
type CancelContent ¶
type CutoffContent ¶
type CutoffPairContent ¶
type OrderFilledContent ¶
type OrderFilledContent struct { RingHash string `json:"ring_hash"` OrderHash string `json:"order_hash"` Owner string `json:"owner"` TokenS string `json:"token_s"` TokenB string `json:"token_b"` RingIndex string `json:"ring_index"` AmountS string `json:"amount_s"` AmountB string `json:"amount_b"` LrcReward string `json:"lrc_reward"` LrcFee string `json:"lrc_fee"` SplitS string `json:"split_s"` SplitB string `json:"split_b"` Market string `json:"market"` FillIndex string `json:"fill_index"` }
type TransactionContent ¶
type TransactionContent struct { Market string `json:"market"` OrderHash string `json:"orderHash"` Fill string `json:"fill"` }
todo(后续版本更改)
type TransactionEntity ¶
type TransactionEntity struct { From common.Address `json:"from"` To common.Address `json:"to"` Protocol common.Address `json:"protocol"` BlockNumber int64 `json:"block_number"` Hash common.Hash `json:"hash"` LogIndex int64 `json:"log_index"` Value *big.Int `json:"value"` Content string `json:"content"` Status types.TxStatus `json:"status"` GasLimit *big.Int `json:"gas_limit"` GasUsed *big.Int `json:"gas_used"` GasPrice *big.Int `json:"gas_price"` Nonce *big.Int `json:"nonce"` BlockTime int64 `json:"block_time"` }
func (*TransactionEntity) Compare ¶
func (tx *TransactionEntity) Compare(src *TransactionEntity) bool
Compare return true: is the same
func (*TransactionEntity) FromApproveEvent ¶
func (tx *TransactionEntity) FromApproveEvent(src *types.ApprovalEvent) error
func (*TransactionEntity) FromCancelEvent ¶
func (tx *TransactionEntity) FromCancelEvent(src *types.OrderCancelledEvent) error
func (*TransactionEntity) FromCutoffEvent ¶
func (tx *TransactionEntity) FromCutoffEvent(src *types.CutoffEvent) error
func (*TransactionEntity) FromCutoffPairEvent ¶
func (tx *TransactionEntity) FromCutoffPairEvent(src *types.CutoffPairEvent) error
func (*TransactionEntity) FromEthTransferEvent ¶
func (tx *TransactionEntity) FromEthTransferEvent(src *types.EthTransferEvent) error
func (*TransactionEntity) FromOrderFilledEvent ¶
func (tx *TransactionEntity) FromOrderFilledEvent(src *types.OrderFilledEvent) error
func (*TransactionEntity) FromTransferEvent ¶
func (tx *TransactionEntity) FromTransferEvent(src *types.TransferEvent) error
func (*TransactionEntity) FromUnsupportedContractEvent ¶
func (tx *TransactionEntity) FromUnsupportedContractEvent(src *types.UnsupportedContractEvent) error
func (*TransactionEntity) FromWethDepositEvent ¶
func (tx *TransactionEntity) FromWethDepositEvent(src *types.WethDepositEvent) error
充值和提现from和to都是用户钱包自己的地址,因为合约限制了发送方msg.sender
func (*TransactionEntity) FromWethWithdrawalEvent ¶
func (tx *TransactionEntity) FromWethWithdrawalEvent(src *types.WethWithdrawalEvent) error
type TransactionJsonResult ¶
type TransactionJsonResult struct { Protocol common.Address `json:"protocol"` Owner common.Address `json:"owner"` From common.Address `json:"from"` To common.Address `json:"to"` TxHash common.Hash `json:"txHash"` Symbol string `json:"symbol"` Content TransactionContent `json:"content"` BlockNumber int64 `json:"blockNumber"` Value string `json:"value"` LogIndex int64 `json:"logIndex"` Type string `json:"type"` Status string `json:"status"` CreateTime int64 `json:"createTime"` UpdateTime int64 `json:"updateTime"` GasPrice string `json:"gas_price"` GasLimit string `json:"gas_limit"` GasUsed string `json:"gas_used"` Nonce string `json:"nonce"` }
func NewResult ¶
func NewResult(tx *TransactionView) TransactionJsonResult
func (*TransactionJsonResult) FromApproveEntity ¶
func (r *TransactionJsonResult) FromApproveEntity(entity *TransactionEntity) error
func (*TransactionJsonResult) FromCancelEntity ¶
func (r *TransactionJsonResult) FromCancelEntity(entity *TransactionEntity) error
func (*TransactionJsonResult) FromCutoffEntity ¶
func (r *TransactionJsonResult) FromCutoffEntity(entity *TransactionEntity) error
func (*TransactionJsonResult) FromCutoffPairEntity ¶
func (r *TransactionJsonResult) FromCutoffPairEntity(entity *TransactionEntity) error
func (*TransactionJsonResult) FromFillEntity ¶
func (r *TransactionJsonResult) FromFillEntity(entity *TransactionEntity) error
func (*TransactionJsonResult) FromOtherEntity ¶
func (r *TransactionJsonResult) FromOtherEntity(entity *TransactionEntity) error
普通的eth转账及其他合约无需转换
func (*TransactionJsonResult) FromTransferEntity ¶
func (r *TransactionJsonResult) FromTransferEntity(entity *TransactionEntity) error
func (*TransactionJsonResult) FromWethDepositEntity ¶
func (r *TransactionJsonResult) FromWethDepositEntity(entity *TransactionEntity) error
func (*TransactionJsonResult) FromWethWithdrawalEntity ¶
func (r *TransactionJsonResult) FromWethWithdrawalEntity(entity *TransactionEntity) error
type TransactionView ¶
type TransactionView struct { Symbol string `json:"symbol"` Owner common.Address `json:"owner"` // 用户地址 TxHash common.Hash `json:"tx_hash"` BlockNumber int64 `json:"block_number"` LogIndex int64 `json:"log_index"` Amount *big.Int `json:"amount"` Nonce *big.Int `json:"nonce"` Type TxType `json:"type"` Status types.TxStatus `json:"status"` CreateTime int64 `json:"create_time"` UpdateTime int64 `json:"update_time"` }
func ApproveView ¶
func ApproveView(src *types.ApprovalEvent) (TransactionView, error)
func CancelView ¶
func CancelView(src *types.OrderCancelledEvent) (TransactionView, error)
从entity中获取amount&orderHash
func CutoffPairView ¶
func CutoffPairView(src *types.CutoffPairEvent) (TransactionView, error)
从entity中获取token1,token2
func CutoffView ¶
func CutoffView(src *types.CutoffEvent) (TransactionView, error)
func EthTransferView ¶
func EthTransferView(src *types.EthTransferEvent) ([]TransactionView, error)
func OrderFilledView ¶
func OrderFilledView(src *types.OrderFilledEvent) ([]TransactionView, error)
用户币种最多3个tokenS,tokenB,lrc 一个fill只有一个owner,我们这里最多存储3条数据
func TransferView ¶
func TransferView(src *types.TransferEvent) ([]TransactionView, error)
func UnsupportedContractView ¶
func UnsupportedContractView(src *types.UnsupportedContractEvent) ([]TransactionView, error)
func WethDepositView ¶
func WethDepositView(src *types.WethDepositEvent) ([]TransactionView, error)
func WethWithdrawalView ¶
func WethWithdrawalView(src *types.WethWithdrawalEvent) ([]TransactionView, error)
type TransferContent ¶
type TxType ¶
type TxType uint8
const ( // common type TX_TYPE_UNKNOWN TxType = 0 TX_TYPE_APPROVE TxType = 1 TX_TYPE_SEND TxType = 2 TX_TYPE_RECEIVE TxType = 3 TX_TYPE_SELL TxType = 4 TX_TYPE_BUY TxType = 5 TX_TYPE_CONVERT_INCOME TxType = 7 TX_TYPE_CONVERT_OUTCOME TxType = 8 TX_TYPE_CANCEL_ORDER TxType = 9 TX_TYPE_CUTOFF TxType = 10 TX_TYPE_CUTOFF_PAIR TxType = 11 TX_TYPE_UNSUPPORTED_CONTRACT TxType = 12 TX_TYPE_LRC_FEE TxType = 13 TX_TYPE_LRC_REWARD TxType = 14 )
send/receive/sell/buy/wrap/unwrap/cancelOrder/approve
func StrToTxType ¶
type WethDepositContent ¶
type WethWithdrawalContent ¶
Click to show internal directories.
Click to hide internal directories.