foundry_primitives/network/
receipt.rs

1use alloy_network::ReceiptResponse;
2use alloy_primitives::{Address, B256, BlockHash, TxHash};
3use alloy_rpc_types::TransactionReceipt;
4use op_alloy_rpc_types::L1BlockInfo;
5use serde::{Deserialize, Serialize};
6
7use crate::FoundryReceiptEnvelope;
8
9#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
10#[serde(rename_all = "camelCase")]
11pub struct FoundryTxReceipt {
12    /// Regular eth transaction receipt including deposit receipts
13    #[serde(flatten)]
14    pub inner: TransactionReceipt<FoundryReceiptEnvelope<alloy_rpc_types_eth::Log>>,
15    /// L1 block info of the transaction.
16    #[serde(flatten)]
17    pub l1_block_info: L1BlockInfo,
18}
19
20impl ReceiptResponse for FoundryTxReceipt {
21    fn contract_address(&self) -> Option<Address> {
22        self.inner.contract_address
23    }
24
25    fn status(&self) -> bool {
26        self.inner.inner.status()
27    }
28
29    fn block_hash(&self) -> Option<BlockHash> {
30        self.inner.block_hash
31    }
32
33    fn block_number(&self) -> Option<u64> {
34        self.inner.block_number
35    }
36
37    fn transaction_hash(&self) -> TxHash {
38        self.inner.transaction_hash
39    }
40
41    fn transaction_index(&self) -> Option<u64> {
42        self.inner.transaction_index()
43    }
44
45    fn gas_used(&self) -> u64 {
46        self.inner.gas_used()
47    }
48
49    fn effective_gas_price(&self) -> u128 {
50        self.inner.effective_gas_price()
51    }
52
53    fn blob_gas_used(&self) -> Option<u64> {
54        self.inner.blob_gas_used()
55    }
56
57    fn blob_gas_price(&self) -> Option<u128> {
58        self.inner.blob_gas_price()
59    }
60
61    fn from(&self) -> Address {
62        self.inner.from()
63    }
64
65    fn to(&self) -> Option<Address> {
66        self.inner.to()
67    }
68
69    fn cumulative_gas_used(&self) -> u64 {
70        self.inner.cumulative_gas_used()
71    }
72
73    fn state_root(&self) -> Option<B256> {
74        self.inner.state_root()
75    }
76}