revm_context_interface::transaction

Trait Transaction

Source
pub trait Transaction {
    type TransactionError: TransactionError;
    type TransactionType: Into<TransactionType>;
    type AccessList: AccessListTrait;
    type Legacy: LegacyTx;
    type Eip2930: Eip2930Tx<AccessList = Self::AccessList>;
    type Eip1559: Eip1559Tx<AccessList = Self::AccessList>;
    type Eip4844: Eip4844Tx<AccessList = Self::AccessList>;
    type Eip7702: Eip7702Tx<AccessList = Self::AccessList>;

    // Required method
    fn tx_type(&self) -> Self::TransactionType;

    // Provided methods
    fn legacy(&self) -> &Self::Legacy { ... }
    fn eip2930(&self) -> &Self::Eip2930 { ... }
    fn eip1559(&self) -> &Self::Eip1559 { ... }
    fn eip4844(&self) -> &Self::Eip4844 { ... }
    fn eip7702(&self) -> &Self::Eip7702 { ... }
    fn common_fields(&self) -> &dyn CommonTxFields { ... }
    fn max_fee(&self) -> u128 { ... }
    fn effective_gas_price(&self, base_fee: U256) -> U256 { ... }
    fn kind(&self) -> TxKind { ... }
    fn access_list(&self) -> Option<&Self::AccessList> { ... }
}
Expand description

Main Transaction trait that abstracts and specifies all transaction currently supported by Ethereum.

Access to any associated type is gaited behind tx_type function.

It can be extended to support new transaction types and only transaction types can be deprecated by not returning tx_type.

Required Associated Types§

Source

type TransactionError: TransactionError

An error that occurs when validating a transaction.

Source

type TransactionType: Into<TransactionType>

Transaction type.

Source

type AccessList: AccessListTrait

Access list type.

Source

type Legacy: LegacyTx

Source

type Eip2930: Eip2930Tx<AccessList = Self::AccessList>

Source

type Eip1559: Eip1559Tx<AccessList = Self::AccessList>

Source

type Eip4844: Eip4844Tx<AccessList = Self::AccessList>

Source

type Eip7702: Eip7702Tx<AccessList = Self::AccessList>

Required Methods§

Source

fn tx_type(&self) -> Self::TransactionType

Transaction type. Depending on this field other functions should be called. If transaction is Legacy, then legacy() should be called.

Provided Methods§

Source

fn legacy(&self) -> &Self::Legacy

Legacy transaction.

Source

fn eip2930(&self) -> &Self::Eip2930

EIP-2930 transaction.

Source

fn eip1559(&self) -> &Self::Eip1559

EIP-1559 transaction.

Source

fn eip4844(&self) -> &Self::Eip4844

EIP-4844 transaction.

Source

fn eip7702(&self) -> &Self::Eip7702

EIP-7702 transaction.

Source

fn common_fields(&self) -> &dyn CommonTxFields

Common fields for all transactions.

Source

fn max_fee(&self) -> u128

Maximum fee that can be paid for the transaction.

Source

fn effective_gas_price(&self, base_fee: U256) -> U256

Effective gas price is gas price field for Legacy and Eip2930 transaction While for transactions after Eip1559 it is minimum of max_fee and base+max_priority_fee.

Source

fn kind(&self) -> TxKind

Transaction kind.

Source

fn access_list(&self) -> Option<&Self::AccessList>

Returns access list.

Implementations on Foreign Types§

Source§

impl<'a, T: 'a + Transaction + ?Sized> Transaction for &'a T

Source§

impl<T: Transaction + ?Sized> Transaction for Box<T>

Source§

impl<T: Transaction + ?Sized> Transaction for Rc<T>

Source§

impl<T: Transaction + ?Sized> Transaction for Arc<T>

Implementors§