fc_rpc_v2_types/log.rs
1// This file is part of Frontier.
2
3// Copyright (C) Parity Technologies (UK) Ltd.
4// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
5
6// This program is free software: you can redistribute it and/or modify
7// it under the terms of the GNU General Public License as published by
8// the Free Software Foundation, either version 3 of the License, or
9// (at your option) any later version.
10
11// This program is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14// GNU General Public License for more details.
15
16// You should have received a copy of the GNU General Public License
17// along with this program. If not, see <https://www.gnu.org/licenses/>.
18
19use ethereum_types::{Address, H256, U256};
20use serde::{Deserialize, Serialize};
21
22use crate::bytes::Bytes;
23
24/// Log represents a contract log event, which is emitted by a transaction.
25/// These events are generated by the LOG opcode and stored/indexed by the node.
26#[derive(Clone, Debug, Eq, PartialEq, Default, Hash, Serialize, Deserialize)]
27#[serde(rename_all = "camelCase")]
28pub struct Log {
29 // Consensus fields:
30 /// Address of the contract that generated the event.
31 pub address: Address,
32 /// List of topics provided by the contract.
33 pub topics: Vec<H256>,
34 /// Additional data fields of the log.
35 pub data: Bytes,
36
37 // Derived fields:
38 /// Hash of block in which the transaction was included.
39 pub block_hash: Option<H256>,
40 /// Number of the block in which the transaction was included.
41 pub block_number: Option<U256>,
42 /// Transaction hash.
43 pub transaction_hash: Option<H256>,
44 /// Index of the transaction in the block.
45 pub transaction_index: Option<U256>,
46 /// Index of the log in the block.
47 pub log_index: Option<U256>,
48
49 /// Whether this log was removed due to a chain reorganisation.
50 #[serde(default)]
51 pub removed: bool,
52}