revm_optimism/transaction/
deposit.rsuse revm::{
context_interface::transaction::CommonTxFields,
primitives::{Address, Bytes, TxKind, B256, U256},
};
pub trait DepositTransaction: CommonTxFields {
fn source_hash(&self) -> B256;
fn to(&self) -> TxKind;
fn mint(&self) -> Option<u128>;
fn is_system_transaction(&self) -> bool;
}
#[derive(Clone, Default, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct TxDeposit {
pub source_hash: B256,
pub from: Address,
pub to: TxKind,
pub mint: Option<u128>,
pub value: U256,
pub gas_limit: u64,
pub is_system_transaction: bool,
pub input: Bytes,
}
impl CommonTxFields for TxDeposit {
fn caller(&self) -> Address {
self.from
}
fn gas_limit(&self) -> u64 {
self.gas_limit
}
fn value(&self) -> U256 {
self.value
}
fn input(&self) -> &Bytes {
&self.input
}
fn nonce(&self) -> u64 {
panic!("There is no nonce in a deposit transaction");
}
}
impl DepositTransaction for TxDeposit {
fn source_hash(&self) -> B256 {
self.source_hash
}
fn to(&self) -> TxKind {
self.to
}
fn mint(&self) -> Option<u128> {
self.mint
}
fn is_system_transaction(&self) -> bool {
self.is_system_transaction
}
}