mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 15:16:43 +00:00
Cleanup, lint, and enable linters for consenssus/bor module. Disabled linter "gomnd" and "tagliatelle" because they are not easy to fix and the return on the time investment is very low. Disabled linter "prealloc" because it is not easy to guess and pre-allocate the slice accurately in many cases.
49 lines
1.2 KiB
Go
49 lines
1.2 KiB
Go
package bor
|
|
|
|
import (
|
|
"fmt"
|
|
"time"
|
|
|
|
"github.com/ethereum/go-ethereum/common"
|
|
"github.com/ethereum/go-ethereum/common/hexutil"
|
|
)
|
|
|
|
// EventRecord represents state record
|
|
type EventRecord struct {
|
|
ID uint64 `json:"id" yaml:"id"`
|
|
Contract common.Address `json:"contract" yaml:"contract"`
|
|
Data hexutil.Bytes `json:"data" yaml:"data"`
|
|
TxHash common.Hash `json:"tx_hash" yaml:"tx_hash"`
|
|
LogIndex uint64 `json:"log_index" yaml:"log_index"`
|
|
ChainID string `json:"bor_chain_id" yaml:"bor_chain_id"`
|
|
}
|
|
|
|
type EventRecordWithTime struct {
|
|
EventRecord
|
|
Time time.Time `json:"record_time" yaml:"record_time"`
|
|
}
|
|
|
|
// String returns the string representations of span
|
|
func (e *EventRecordWithTime) String() string {
|
|
return fmt.Sprintf(
|
|
"id %v, contract %v, data: %v, txHash: %v, logIndex: %v, chainId: %v, time %s",
|
|
e.ID,
|
|
e.Contract.String(),
|
|
e.Data.String(),
|
|
e.TxHash.Hex(),
|
|
e.LogIndex,
|
|
e.ChainID,
|
|
e.Time.Format(time.RFC3339),
|
|
)
|
|
}
|
|
|
|
func (e *EventRecordWithTime) BuildEventRecord() *EventRecord {
|
|
return &EventRecord{
|
|
ID: e.ID,
|
|
Contract: e.Contract,
|
|
Data: e.Data,
|
|
TxHash: e.TxHash,
|
|
LogIndex: e.LogIndex,
|
|
ChainID: e.ChainID,
|
|
}
|
|
}
|