TempoStateAccess

Trait TempoStateAccess 

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: Uint<256, 4>,
    ) -> Result<Uint<256, 4>, 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<Uint<256, 4>, 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§

type Error

Required Methods§

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

Returns [AccountInfo] for the given address.

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

Returns the storage value for the given address and key.

Provided Methods§

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.

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.

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).

fn get_token_balance( &mut self, token: Address, account: Address, ) -> Result<Uint<256, 4>, 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§

§

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

§

type Error = <DB as Database>::Error

§

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

§

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

§

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

Available on crate feature reth only.
§

type Error = ProviderError