TempoStateAccess

Trait TempoStateAccess 

Source
pub trait TempoStateAccess<T> {
    type Error;

    // Required methods
    fn basic(&mut self, address: Address) -> Result<AccountInfo, Self::Error>;
    fn sload(
        &mut self,
        address: Address,
        key: U256,
    ) -> Result<U256, Self::Error>;

    // Provided methods
    fn get_fee_token(
        &mut self,
        tx: impl TempoTx,
        validator: Address,
        fee_payer: Address,
        spec: TempoHardfork,
    ) -> Result<Address, Self::Error> { ... }
    fn is_valid_fee_token(
        &mut self,
        fee_token: Address,
        spec: TempoHardfork,
    ) -> Result<bool, Self::Error> { ... }
    fn can_fee_payer_transfer(
        &mut self,
        fee_token: Address,
        fee_payer: Address,
    ) -> Result<bool, Self::Error> { ... }
    fn get_token_balance(
        &mut self,
        token: Address,
        account: Address,
    ) -> Result<U256, Self::Error> { ... }
}
Expand description

Helper trait to perform Tempo-specific operations on top of different state providers.

We provide blanket implementations for revm database, journal and reth state provider.

Generic parameter is used as a workaround to avoid conflicting implementations.

Required Associated Types§

Required Methods§

Source

fn basic(&mut self, address: Address) -> Result<AccountInfo, Self::Error>

Returns [AccountInfo] for the given address.

Source

fn sload(&mut self, address: Address, key: U256) -> Result<U256, Self::Error>

Returns the storage value for the given address and key.

Provided Methods§

Source

fn get_fee_token( &mut self, tx: impl TempoTx, validator: Address, fee_payer: Address, spec: TempoHardfork, ) -> Result<Address, Self::Error>

Resolves user-level of transaction-level fee token preference.

Source

fn is_valid_fee_token( &mut self, fee_token: Address, spec: TempoHardfork, ) -> Result<bool, Self::Error>

Checks if the given token can be used as a fee token.

Source

fn can_fee_payer_transfer( &mut self, fee_token: Address, fee_payer: Address, ) -> Result<bool, Self::Error>

Checks if the fee payer can transfer a given token (is not blacklisted).

Source

fn get_token_balance( &mut self, token: Address, account: Address, ) -> Result<U256, Self::Error>

Returns the balance of the given token for the given account.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<DB: Database> TempoStateAccess<()> for DB

Source§

type Error = <DB as Database>::Error

Source§

impl<T: JournalTr> TempoStateAccess<((), ())> for T

Source§

type Error = <<T as JournalTr>::Database as Database>::Error

Source§

impl<T: StateProvider> TempoStateAccess<((), (), ())> for T

Available on crate feature reth only.
Source§

type Error = ProviderError