Documentation ¶
Index ¶
Constants ¶
View Source
const ( TronTopic = "ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" EthTopic = "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" EthNftTransferSingleTopic = "0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62" PolygonTopic = "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Block ¶
type Block struct { Id int64 `json:"id" gorm:"column:id"` BlockHash string `json:"hash" gorm:"column:hash"` BlockTime string `json:"timestamp" gorm:"column:block_time"` BlockStatus string `json:"blockStatus" gorm:"column:block_status"` BlockNumber string `json:"number" gorm:"column:block_number"` ParentHash string `json:"parentHash" gorm:"column:parent_hash"` BlockReward string `json:"blockReward" gorm:"column:block_reward"` FeeRecipient string `json:"feeRecipient" gorm:"column:fee_recipient"` TotalDifficulty string `json:"totalDifficulty" gorm:"column:total_difficulty"` BlockSize string `json:"size" gorm:"column:block_size"` GasLimit string `json:"gasLimit" gorm:"column:gas_limit"` GasUsed string `json:"gasUsed" gorm:"column:gas_used"` BaseFee string `json:"baseFeePerGas" gorm:"column:base_fee_per_gas"` ExtraData string `json:"extraData" gorm:"column:extra_data"` Root string `json:"stateRoot" gorm:"column:state_root"` Transactions []string `json:"transactions" gorm:"column:transactions"` TxRoot string `json:"transactionsRoot" gorm:"column:transactions_root"` ReceiptRoot string `json:"receiptsRoot" gorm:"column:receipts_root"` Coinbase string `json:"miner" gorm:"column:miner"` Nonce string `json:"nonce" gorm:"column:nonce"` }
type BlockChainInterface ¶
type BlockChainInterface interface { GetTx(txHash string, log *logrus.Entry) *TxInterface GetReceipt(txHash string, log *logrus.Entry) (*ReceiptInterface, error) GetReceiptByBlock(blockHash, number string, log *logrus.Entry) ([]*ReceiptInterface, error) GetBlockByNumber(blockNumber string, log *logrus.Entry, flag bool) (*BlockInterface, []*TxInterface) GetBlockByHash(blockHash string, log *logrus.Entry, flag bool) (*BlockInterface, []*TxInterface) GetMultiBlockByNumber(blockNumber string, log *logrus.Entry, flag bool) ([]*BlockInterface, []*TxInterface) CheckAddress(tx []byte, addrList map[string]int64) bool Monitor() }
BlockChainInterface 公链接口
type BlockInterface ¶
type Logs ¶
type Logs struct { BlockHash string `json:"blockHash" gorm:"column:block_hash"` Address string `json:"address" gorm:"column:address"` LogIndex string `json:"logIndex" gorm:"column:log_index"` Data string `json:"data" gorm:"column:data"` Removed bool `json:"removed" gorm:"column:removed"` Topics []string `json:"topics" gorm:"column:topics"` BlockNumber string `json:"blockNumber" gorm:"column:block_number"` TransactionIndex string `json:"transactionIndex" gorm:"column:transaction_index"` TransactionHash string `json:"transactionHash" gorm:"column:transaction_hash"` }
type NodeTask ¶
type NodeTask struct { Id int64 `json:"id" gorm:"column:id"` NodeId string `json:"nodeId" gorm:"column:node_id"` BlockNumber string `json:"blockNumber" gorm:"column:block_number"` BlockHash string `json:"blockHash" gorm:"column:block_hash"` TxHash string `json:"txHash" gorm:"column:tx_hash"` TaskType int `json:"taskType" gorm:"column:task_type"` // 0:保留 1:同步Tx. 2:同步Block 3:同步Receipt 4:区块Tx 5:区块Receipt 6: 批量区块 BlockChain int `json:"blockChain" gorm:"column:block_chain"` TaskStatus int `json:"taskStatus" gorm:"column:task_status"` //0: 初始 1: 成功. 2: 失败. 3: 执行中 其他:重试次数 CreateTime time.Time `json:"createTime" gorm:"column:create_time"` LogTime time.Time `json:"logTime" gorm:"column:log_time"` }
type Receipt ¶
type Receipt struct { Id int64 `json:"id"` BlockHash string `json:"blockHash" gorm:"column:block_hash"` LogsBloom string `json:"logsBloom" gorm:"column:logs_bloom"` ContractAddress string `json:"contractAddress" gorm:"column:contract_address"` TransactionIndex string `json:"transactionIndex" gorm:"column:transaction_index"` Type string `json:"type" gorm:"column:tx_type"` TransactionHash string `json:"transactionHash" gorm:"column:transaction_hash"` GasUsed string `json:"gasUsed" gorm:"column:gas_used"` BlockNumber string `json:"blockNumber" gorm:"column:block_number"` CumulativeGasUsed string `json:"cumulativeGasUsed" gorm:"column:cumulative_gas_used"` From string `json:"from" gorm:"column:from_addr"` To string `json:"to" gorm:"column:to_addr"` EffectiveGasPrice string `json:"effectiveGasPrice" gorm:"column:effective_gas_price"` Logs []*Logs `json:"logs" gorm:"column:logs"` CreateTime string `json:"createTime" gorm:"column:create_time"` // 2006-01-02 Status string `json:"status" gorm:"column:status"` }
type ReceiptInterface ¶
type StoreTaskInterface ¶
type StoreTaskInterface interface { SendNodeTask(list []*NodeTask, partitions []int64) []*kafka.Message UpdateNodeTaskStatus(key string, status int) error UpdateNodeTaskStatusWithBatch(keys []string, status int) error GetNodeTask(blockchain int64, key string) (int64, *NodeTask, error) DelNodeTask(blockchain int64, key string) (int64, *NodeTask, error) ResetNodeTask(blockchain int64, oldKey, key string) error StoreNodeTask(key string, task *NodeTask, append bool) GetAllKeyForNodeTask(blockchain int64) ([]string, error) StoreContract(blockchain int64, contract string, data string) error GetContract(blockchain int64, contract string) (string, error) GetAllKeyForContract(blockchain int64) ([]string, error) StoreErrTxNodeTask(blockchain int64, key string, data any) error GetErrTxNodeTask(blockchain int64, key string) (int64, *NodeTask, error) DelErrTxNodeTask(blockchain int64, key string) (*NodeTask, error) GetAllKeyForErrTx(blockchain int64) ([]string, error) GetMonitorAddress(blockChain int64) ([]string, error) StoreLatestBlock(blockchain int64, key string, data any, number string) error StoreNodeId(blockchain int64, key string, data any) error GetAllNodeId(blockchain int64) ([]string, error) StoreClusterNode(blockChain int64, prefix string, data any) error GetClusterNode(blockChain int64, prefix string) (map[string]int64, error) StoreClusterHealthStatus(blockChain int64, data map[string]int64) error }
type TronReceipt ¶
type TronReceipt struct { Id string `json:"id"` Fee int64 `json:"fee"` BlockNumber int64 `json:"blockNumber"` BlockTimeStamp int64 `json:"blockTimeStamp"` From string `json:"from" gorm:"column:from_addr"` To string `json:"to" gorm:"column:to_addr"` ContractResult []string `json:"contractResult"` ContractAddress string `json:"contract_address"` Receipt struct { EnergyFee int64 `json:"energy_fee"` EnergyUsageTotal int64 `json:"energy_usage_total"` NetUsage int64 `json:"net_usage"` Result string `json:"result"` EnergyPenaltyTotal int64 `json:"energy_penalty_total"` } `json:"receipt"` Log []*Logs `json:"log"` InternalTransactions []struct { CallerAddress string `json:"caller_address"` Note string `json:"note"` TransferToAddress string `json:"transferTo_address"` CallValueInfo any `json:"callValueInfo" ` Hash string `json:"hash"` Extra string `json:"extra"` Rejected bool `json:"rejected"` } `json:"internal_transactions"` }
type Tx ¶
type Tx struct { Id int64 `json:"id" gorm:"column:id"` TxHash string `json:"hash" gorm:"column:hash"` TxTime string `json:"txTime" gorm:"column:tx_time"` TxStatus string `json:"txStatus" gorm:"column:tx_status"` BlockNumber string `json:"blockNumber" gorm:"column:block_number"` FromAddr string `json:"from" gorm:"column:from_addr"` ToAddr string `json:"to" gorm:"column:to_addr"` Value string `json:"value" gorm:"column:value"` Fee string `json:"fee" gorm:"column:fee"` GasPrice string `json:"gasPrice" gorm:"column:gas_price"` MaxPrice string `json:"maxFeePerGas" gorm:"column:max_fee_per_gas"` GasLimit string `json:"gas" gorm:"column:gas"` GasUsed string `json:"gasUsed" gorm:"column:gas_used"` BaseFee string `json:"baseFeePerGas" gorm:"column:base_fee_per_gas"` PriorityFee string `json:"maxPriorityFeePerGas" gorm:"column:max_priority_fee_per_gas"` InputData string `json:"input" gorm:"column:input_data"` BlockHash string `json:"blockHash" gorm:"column:block_hash"` TransactionIndex string `json:"transactionIndex" gorm:"column:transaction_index"` Type string `json:"type" gorm:"column:tx_type"` Receipt string `json:"receipt" gorm:"-"` }
type TxInterface ¶
type TxInterface struct { TxHash string `json:"hash" gorm:"column:hash"` Tx interface{} `json:"tx"` }
Click to show internal directories.
Click to hide internal directories.