Documentation ¶
Index ¶
- Constants
- Variables
- func BytesToHex(data interface{}) (string, error)
- func ConnectToRPC(rpcURL string) (*ethclient.Client, *big.Int)
- func DecodeTransaction(funcSelectorHex string, txData []byte, _abi interface{}) (string, map[string]interface{}, error)
- func DetermineAddressType(address common.Address, blockNumber *big.Int) int
- func DetermineTxType(tx *types.Transaction, blockNumber *big.Int) int
- func GetBlockHeader(blockNum *big.Int) *types.Header
- func GetDeployedContractAddress(tx *types.Transaction) (common.Address, error)
- func GetL2BlockByHexNumber(number string) (*types.Block, error)
- func Infof(logger *slog.Logger, format string, args ...any)
- func LoadFromJson(filename string, v any)
- func TimeLogger(whichController string) *log.Logger
- func Warnf(logger *slog.Logger, format string, args ...any)
- type AccessList
- type AccessTuple
- type Action
- type ActionOptions
- type BlockTrace
- type CallParams
- type CallTraceResult
- type ERC20Info
- type EventField
- type EventFields
- type EventInfo
- type HistoricalOptions
- type ListenerOptions
- type ProcessedEntity
- type Result
- type Signer
- type StateEntry
- type Trace
- type TraceAction
- type TraceCallResult
- type TraceEntry
- type TraceResult
- type TrackooorOptions
- type Transaction
- type TxData
- type WebhookInstance
Constants ¶
const ( DeploymentTx = iota RegularTx ContractTx )
const ( LegacyTxType = 0x00 AccessListTxType = 0x01 DynamicFeeTxType = 0x02 BlobTxType = 0x03 )
Transaction types.
Variables ¶
var AddressTypeCache map[common.Address]int
var AddressTypeCacheMutex sync.RWMutex
cached data
var AlreadyProcessed map[common.Hash]ProcessedEntity
var AreActionsInitialized bool
var BlockTrackingRequired bool
this is to auto determine whether to track blocks or events
var BlockWaitGroup sync.WaitGroup
wait groups
var Blockscanners map[string]interface{}
var CachedBlocks map[*big.Int]*types.Header
cache blocks as to not query same block number multiple times warning: this may use a lot of memory
var CachedBlocksMutex = sync.RWMutex{} // prevent race condition for map CachedBlocks
var ChainID *big.Int
var Client *ethclient.Client
var DupeDetected bool
var ERC20TokenInfos map[common.Address]ERC20Info
ERC20 data
var EventSigs map[string]interface{} // from data file, maps hex string to event abi
JSON data
var FuncSigs map[string]interface{} // from data file, maps hex string (func selector) to func abi
var RpcURL string
command args (to be set by main.go)
var SwitchingToRealtime bool
var TxTypes = map[int]string{ DeploymentTx: "Deployment", RegularTx: "EOA", ContractTx: "Contract", }
var Verbose bool
var ZeroAddress = common.HexToAddress("0x0000000000000000000000000000000000000000")
constants
Functions ¶
func BytesToHex ¶
func DecodeTransaction ¶
func DecodeTransaction(funcSelectorHex string, txData []byte, _abi interface{}) (string, map[string]interface{}, error)
returns function signature, and map function parameter name to value (argument)
func DetermineAddressType ¶
returns whether an address is a contract or EOA, at a block number, costing 1 query if address uncached. result is cached, which however will not take into the block number. assumes contracts stay as contracts
func DetermineTxType ¶
func DetermineTxType(tx *types.Transaction, blockNumber *big.Int) int
determine action type of transaction. requires 1 RPC request unless cache used. not to be confused with numerical types such as for legacy tx, access list tx etc. three types possible: regular (EOA to EOA), deployment, execution (of smart contracts)
func GetDeployedContractAddress ¶
func GetDeployedContractAddress(tx *types.Transaction) (common.Address, error)
returns deployed contract address given a tx
func GetL2BlockByHexNumber ¶
get a block by number hex string, or `latest` / `pending` / `earliest`
func LoadFromJson ¶
func TimeLogger ¶
Types ¶
type AccessTuple ¶
type AccessTuple struct { Address common.Address `json:"address" gencodec:"required"` StorageKeys []common.Hash `json:"storageKeys" gencodec:"required"` }
AccessTuple is the element type of an access list.
type ActionOptions ¶
type BlockTrace ¶
type BlockTrace struct { Output hexutil.Bytes `json:"output"` StateDiff any `json:"stateDiff"` Traces []Trace `json:"trace"` }
func Trace_replayBlockTransactions ¶
func Trace_replayBlockTransactions(blockNum uint64, traceType []string) ([]BlockTrace, error)
traceType is one or more of "trace", "stateDiff"
type CallParams ¶
type CallTraceResult ¶
type EventField ¶
type HistoricalOptions ¶
type ListenerOptions ¶
type ListenerOptions struct {
ListenToDeployments bool
}
type ProcessedEntity ¶
already processed blocks, txs or events
type Signer ¶
type Signer interface { // Sender returns the sender address of the transaction. Sender(tx *Transaction) (common.Address, error) // SignatureValues returns the raw R, S, V values corresponding to the // given signature. SignatureValues(tx *Transaction, sig []byte) (r, s, v *big.Int, err error) ChainID() *big.Int // Hash returns 'signature hash', i.e. the transaction hash that is signed by the // private key. This hash does not uniquely identify the transaction. Hash(tx *Transaction) common.Hash // Equal returns true if the given signer is the same as the receiver. Equal(Signer) bool }
Signer encapsulates transaction signature handling. The name of this type is slightly misleading because Signers don't actually sign, they're just for validating and processing of signatures.
Note that this interface is not a stable API and may change at any time to accommodate new protocol rules.
type StateEntry ¶
type StateEntry struct { // these can either be "=" indicating nothing changed // or a json struct indicating whats changed Balance json.RawMessage `json:"balance"` Code json.RawMessage `json:"code"` Nonce json.RawMessage `json:"nonce,omitempty"` Storage json.RawMessage `json:"storage,omitempty"` }
type Trace ¶
type Trace struct { Action Action `json:"action"` BlockHash string `json:"blockHash"` BlockNumber int `json:"blockNumber"` Result Result `json:"result"` Subtraces int `json:"subtraces"` TraceAddress []int `json:"traceAddress"` TransactionHash string `json:"transactionHash"` TransactionPosition int `json:"transactionPosition"` Type string `json:"type"` }
func Trace_transaction ¶
type TraceAction ¶
type TraceCallResult ¶
type TraceCallResult struct { Output string `json:"output"` StateDiff map[common.Address]StateEntry `json:"stateDiff"` Trace []TraceEntry `json:"trace"` VmTrace interface{} `json:"vmTrace"` // Use interface{} for null or future extensibility }
func Trace_call ¶
func Trace_call(callParams CallParams, traceType []string) (TraceCallResult, error)
referencing https://docs.alchemy.com/reference/trace-call traceType - Type of trace, one or more of: "trace", "stateDiff"
type TraceEntry ¶
type TraceEntry struct { Action TraceAction `json:"action"` Result *CallTraceResult `json:"result,omitempty"` Subtraces int `json:"subtraces"` TraceAddress []int `json:"traceAddress"` Type string `json:"type"` Error string `json:"error,omitempty"` }
type TraceResult ¶
type TraceResult struct { From common.Address `json:"from"` To common.Address `json:"to"` Gas uint64 `json:"gas"` GasUsed uint64 `json:"gasUsed"` Input []byte `json:"input"` Output []byte `json:"output"` Value *big.Int `json:"value"` Type string `json:"type"` Calls []TraceResult `json:"calls"` }
func Debug_traceTransaction ¶
func Debug_traceTransaction(txHash common.Hash) (TraceResult, error)
func (*TraceResult) UnmarshalJSON ¶
func (t *TraceResult) UnmarshalJSON(input []byte) error
type TrackooorOptions ¶
type TrackooorOptions struct { RpcURL string FilterAddresses []common.Address // global list of addresses to filter for FilterEventTopics [][]common.Hash // global list of event topics to filter for AddressProperties map[common.Address]map[string]interface{} // e.g. map address to "name":"USDC" Actions map[string]ActionOptions // map action name to its options AutoFetchABI bool MaxRequestsPerSecond int ListenerOptions ListenerOptions HistoricalOptions HistoricalOptions IsL2Chain bool // will account for invalid tx types }
config options for trackooors
var Options TrackooorOptions
type Transaction ¶
type Transaction struct {
// contains filtered or unexported fields
}
Transaction is an Ethereum transaction.
type WebhookInstance ¶
type WebhookInstance struct { WebhookURL string Username string Avatar_url string RetrySendingMessages bool }
var DiscordWebhook WebhookInstance
global webhook instance
func (WebhookInstance) SendEmbedMessages ¶
func (w WebhookInstance) SendEmbedMessages(embeds []discordwebhook.Embed) error
func (WebhookInstance) SendFile ¶
func (w WebhookInstance) SendFile(imgData []byte, imgFilename string) error
func (WebhookInstance) SendMessage ¶
func (w WebhookInstance) SendMessage(msg string) error