pub trait StateProvider:
BlockHashReader
+ AccountReader
+ BytecodeReader
+ StateRootProvider
+ StorageRootProvider
+ StateProofProvider
+ HashedPostStateProvider {
// Required method
fn storage(
&self,
account: Address,
storage_key: StorageKey,
) -> ProviderResult<Option<StorageValue>>;
// Provided methods
fn account_code(&self, addr: &Address) -> ProviderResult<Option<Bytecode>> { ... }
fn account_balance(&self, addr: &Address) -> ProviderResult<Option<U256>> { ... }
fn account_nonce(&self, addr: &Address) -> ProviderResult<Option<u64>> { ... }
fn into_evm_state_provider(self) -> EvmStateProviderAdapter<Self>
where Self: Sized { ... }
}Expand description
An abstraction for a type that provides state data.
Required Methods§
Provided Methods§
Sourcefn account_code(&self, addr: &Address) -> ProviderResult<Option<Bytecode>>
fn account_code(&self, addr: &Address) -> ProviderResult<Option<Bytecode>>
Get account code by its address.
Returns None if the account doesn’t exist or account is not a contract
Sourcefn account_balance(&self, addr: &Address) -> ProviderResult<Option<U256>>
fn account_balance(&self, addr: &Address) -> ProviderResult<Option<U256>>
Get account balance by its address.
Returns None if the account doesn’t exist
Sourcefn account_nonce(&self, addr: &Address) -> ProviderResult<Option<u64>>
fn account_nonce(&self, addr: &Address) -> ProviderResult<Option<u64>>
Get account nonce by its address.
Returns None if the account doesn’t exist
Sourcefn into_evm_state_provider(self) -> EvmStateProviderAdapter<Self>where
Self: Sized,
fn into_evm_state_provider(self) -> EvmStateProviderAdapter<Self>where
Self: Sized,
Wraps this provider for EVM execution without allocating or cloning it.
Call this on a reference to borrow the provider, or on a box to retain ownership.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".