maili_common/deposit/
mod.rs

1//! Tramsaction types for Optimism.
2
3mod envelope;
4pub use envelope::DepositTxEnvelope;
5
6mod source;
7pub use source::{
8    DepositSourceDomain, DepositSourceDomainIdentifier, L1InfoDepositSource, UpgradeDepositSource,
9    UserDepositSource,
10};
11
12use alloy_consensus::Transaction;
13use alloy_primitives::B256;
14
15/// Identifier for an Optimism deposit transaction
16pub const DEPOSIT_TX_TYPE_ID: u8 = 126; // 0x7E
17
18/// A trait representing a deposit transaction with specific attributes.
19pub trait DepositTransaction: Transaction {
20    /// Returns the hash that uniquely identifies the source of the deposit.
21    ///
22    /// # Returns
23    /// An `Option<B256>` containing the source hash if available.
24    fn source_hash(&self) -> Option<B256>;
25
26    /// Returns the optional mint value of the deposit transaction.
27    ///
28    /// # Returns
29    /// An `Option<u128>` representing the ETH value to mint on L2, if any.
30    fn mint(&self) -> Option<u128>;
31
32    /// Indicates whether the transaction is exempt from the L2 gas limit.
33    ///
34    /// # Returns
35    /// A `bool` indicating if the transaction is a system transaction.
36    fn is_system_transaction(&self) -> bool;
37}