pub trait Database {
type Error: DBErrorMarker;
// Required methods
fn basic(
&mut self,
address: Address,
) -> Result<Option<AccountInfo>, Self::Error>;
fn code_by_hash(
&mut self,
code_hash: FixedBytes<32>,
) -> Result<Bytecode, Self::Error>;
fn storage(
&mut self,
address: Address,
index: Uint<256, 4>,
) -> Result<Uint<256, 4>, Self::Error>;
fn block_hash(&mut self, number: u64) -> Result<FixedBytes<32>, Self::Error>;
// Provided method
fn storage_by_account_id(
&mut self,
address: Address,
account_id: usize,
storage_key: Uint<256, 4>,
) -> Result<Uint<256, 4>, Self::Error> { ... }
}Expand description
EVM database interface.
Required Associated Types§
Sourcetype Error: DBErrorMarker
type Error: DBErrorMarker
The database error type.
Required Methods§
Sourcefn basic(
&mut self,
address: Address,
) -> Result<Option<AccountInfo>, Self::Error>
fn basic( &mut self, address: Address, ) -> Result<Option<AccountInfo>, Self::Error>
Gets basic account information.
Sourcefn code_by_hash(
&mut self,
code_hash: FixedBytes<32>,
) -> Result<Bytecode, Self::Error>
fn code_by_hash( &mut self, code_hash: FixedBytes<32>, ) -> Result<Bytecode, Self::Error>
Gets account code by its hash.
Sourcefn storage(
&mut self,
address: Address,
index: Uint<256, 4>,
) -> Result<Uint<256, 4>, Self::Error>
fn storage( &mut self, address: Address, index: Uint<256, 4>, ) -> Result<Uint<256, 4>, Self::Error>
Gets storage value of address at index.
Sourcefn block_hash(&mut self, number: u64) -> Result<FixedBytes<32>, Self::Error>
fn block_hash(&mut self, number: u64) -> Result<FixedBytes<32>, Self::Error>
Gets block hash by block number.
Provided Methods§
Sourcefn storage_by_account_id(
&mut self,
address: Address,
account_id: usize,
storage_key: Uint<256, 4>,
) -> Result<Uint<256, 4>, Self::Error>
fn storage_by_account_id( &mut self, address: Address, account_id: usize, storage_key: Uint<256, 4>, ) -> Result<Uint<256, 4>, Self::Error>
Gets storage value of account by its id. By default call Database::storage method.
If basic account sets account_id inside AccountInfo::account_id, evm will call this
function with that given account_id. This can be useful if IndexMap is used to get faster access to the account.