Trait revm::precompile::primitives::db::Database

source ·
pub trait Database {
    type Error;

    // 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: Uint<256, 4>
    ) -> Result<FixedBytes<32>, Self::Error>;
}
Expand description

EVM database interface.

Required Associated Types§

source

type Error

The database error type.

Required Methods§

source

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

Get basic account information.

source

fn code_by_hash( &mut self, code_hash: FixedBytes<32> ) -> Result<Bytecode, Self::Error>

Get account code by its hash.

source

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

Get storage value of address at index.

source

fn block_hash( &mut self, number: Uint<256, 4> ) -> Result<FixedBytes<32>, Self::Error>

Get block hash by block number.

Implementations on Foreign Types§

source§

impl<'a, T> Database for &'a mut T
where T: 'a + Database + ?Sized,

§

type Error = <T as Database>::Error

source§

fn basic( &mut self, address: Address ) -> Result<Option<AccountInfo>, <&'a mut T as Database>::Error>

source§

fn code_by_hash( &mut self, code_hash: FixedBytes<32> ) -> Result<Bytecode, <&'a mut T as Database>::Error>

source§

fn storage( &mut self, address: Address, index: Uint<256, 4> ) -> Result<Uint<256, 4>, <&'a mut T as Database>::Error>

source§

fn block_hash( &mut self, number: Uint<256, 4> ) -> Result<FixedBytes<32>, <&'a mut T as Database>::Error>

source§

impl<T> Database for Box<T>
where T: Database + ?Sized,

§

type Error = <T as Database>::Error

source§

fn basic( &mut self, address: Address ) -> Result<Option<AccountInfo>, <Box<T> as Database>::Error>

source§

fn code_by_hash( &mut self, code_hash: FixedBytes<32> ) -> Result<Bytecode, <Box<T> as Database>::Error>

source§

fn storage( &mut self, address: Address, index: Uint<256, 4> ) -> Result<Uint<256, 4>, <Box<T> as Database>::Error>

source§

fn block_hash( &mut self, number: Uint<256, 4> ) -> Result<FixedBytes<32>, <Box<T> as Database>::Error>

Implementors§

source§

impl Database for BenchmarkDB

source§

impl<DB: Database> Database for State<DB>

§

type Error = <DB as Database>::Error

source§

impl<E> Database for EmptyDBTyped<E>

§

type Error = E

source§

impl<ExtDB: DatabaseRef> Database for CacheDB<ExtDB>

§

type Error = <ExtDB as DatabaseRef>::Error

source§

impl<M: Middleware> Database for EthersDB<M>

§

type Error = <M as Middleware>::Error

source§

impl<S, BH> Database for DatabaseComponents<S, BH>
where S: State, BH: BlockHash,

source§

impl<T> Database for WrapDatabaseRef<T>
where T: DatabaseRef,

§

type Error = <T as DatabaseRef>::Error