Skip to main content

graph_native/
log.rs

1use crate::types::{Address, BigInt};
2
3/// Trigger data passed to native handlers.
4/// Represents an Ethereum log entry with transaction/block context.
5/// In production, this is populated from graph-node's trigger data.
6#[derive(Debug, Clone)]
7pub struct Log {
8    pub transaction_hash: Vec<u8>,
9    pub transaction_from: Address,
10    pub transaction_gas_price: BigInt,
11    pub log_index: u64,
12    pub block_number: u64,
13    pub block_timestamp: u64,
14    pub address: Address,
15    /// Raw log topics
16    pub topics: Vec<Vec<u8>>,
17    /// Raw log data
18    pub data: Vec<u8>,
19}
20
21impl Log {
22    pub fn new() -> Self {
23        Log {
24            transaction_hash: Vec::new(),
25            transaction_from: Address::zero(),
26            transaction_gas_price: BigInt::zero(),
27            log_index: 0,
28            block_number: 0,
29            block_timestamp: 0,
30            address: Address::zero(),
31            topics: Vec::new(),
32            data: Vec::new(),
33        }
34    }
35}