pub trait EvmStateProvider: Send + Sync {
// Required methods
fn basic_account(&self, address: Address) -> ProviderResult<Option<Account>>;
fn block_hash(&self, number: BlockNumber) -> ProviderResult<Option<B256>>;
fn bytecode_by_hash(
&self,
code_hash: B256,
) -> ProviderResult<Option<Bytecode>>;
fn storage(
&self,
account: Address,
storage_key: StorageKey,
) -> ProviderResult<Option<StorageValue>>;
}
Expand description
A helper trait responsible for providing state necessary for EVM execution.
This serves as the data layer for Database
.
Required Methods§
Sourcefn basic_account(&self, address: Address) -> ProviderResult<Option<Account>>
fn basic_account(&self, address: Address) -> ProviderResult<Option<Account>>
Get basic account information.
Returns None
if the account doesn’t exist.
Sourcefn block_hash(&self, number: BlockNumber) -> ProviderResult<Option<B256>>
fn block_hash(&self, number: BlockNumber) -> ProviderResult<Option<B256>>
Get the hash of the block with the given number. Returns None
if no block with this
number exists.
Sourcefn bytecode_by_hash(&self, code_hash: B256) -> ProviderResult<Option<Bytecode>>
fn bytecode_by_hash(&self, code_hash: B256) -> ProviderResult<Option<Bytecode>>
Get account code by hash.
Sourcefn storage(
&self,
account: Address,
storage_key: StorageKey,
) -> ProviderResult<Option<StorageValue>>
fn storage( &self, account: Address, storage_key: StorageKey, ) -> ProviderResult<Option<StorageValue>>
Get storage of the given account.