Struct fuel_core::database::vm_database::VmDatabase
source · pub struct VmDatabase { /* private fields */ }
Expand description
Used to store metadata relevant during the execution of a transaction
Implementations§
source§impl VmDatabase
impl VmDatabase
pub fn new<T>(
database: Database,
header: &FuelConsensusHeader<T>,
coinbase: Address
) -> Self
pub fn block_height(&self) -> u32
Trait Implementations§
source§impl Clone for VmDatabase
impl Clone for VmDatabase
source§fn clone(&self) -> VmDatabase
fn clone(&self) -> VmDatabase
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for VmDatabase
impl Debug for VmDatabase
source§impl Default for VmDatabase
impl Default for VmDatabase
source§impl InterpreterStorage for VmDatabase
impl InterpreterStorage for VmDatabase
source§fn block_height(&self) -> Result<u32, Self::DataError>
fn block_height(&self) -> Result<u32, Self::DataError>
Provide the current block height in which the transactions should be
executed.
source§fn timestamp(&self, height: u32) -> Result<Word, Self::DataError>
fn timestamp(&self, height: u32) -> Result<Word, Self::DataError>
Return the timestamp of a given block Read more
source§fn block_hash(&self, block_height: u32) -> Result<Bytes32, Self::DataError>
fn block_hash(&self, block_height: u32) -> Result<Bytes32, Self::DataError>
Provide the block hash from a given height.
source§fn coinbase(&self) -> Result<Address, Self::DataError>
fn coinbase(&self) -> Result<Address, Self::DataError>
Provide the coinbase address for the VM instructions implementation.
source§fn merkle_contract_state_range(
&self,
contract_id: &ContractId,
start_key: &Bytes32,
range: Word
) -> Result<Vec<Option<Cow<'_, Bytes32>>>, Self::DataError>
fn merkle_contract_state_range(
&self,
contract_id: &ContractId,
start_key: &Bytes32,
range: Word
) -> Result<Vec<Option<Cow<'_, Bytes32>>>, Self::DataError>
Fetch a range of values from a key-value mapping in a contract storage.
Returns the full range requested using optional values in case
a requested slot is unset.
source§fn merkle_contract_state_insert_range(
&mut self,
contract_id: &ContractId,
start_key: &Bytes32,
values: &[Bytes32]
) -> Result<Option<()>, Self::DataError>
fn merkle_contract_state_insert_range(
&mut self,
contract_id: &ContractId,
start_key: &Bytes32,
values: &[Bytes32]
) -> Result<Option<()>, Self::DataError>
Insert a range of key-value mappings into contract storage.
Returns None if any of the keys in the range were previously unset.
source§fn merkle_contract_state_remove_range(
&mut self,
contract_id: &ContractId,
start_key: &Bytes32,
range: Word
) -> Result<Option<()>, Self::DataError>
fn merkle_contract_state_remove_range(
&mut self,
contract_id: &ContractId,
start_key: &Bytes32,
range: Word
) -> Result<Option<()>, Self::DataError>
Remove a range of key-values from contract storage.
Returns None if any of the keys in the range were already unset.
§fn deploy_contract(
&mut self,
salt: &Salt,
slots: &[StorageSlot],
contract: &Contract
) -> Result<(), Self::DataError>
fn deploy_contract(
&mut self,
salt: &Salt,
slots: &[StorageSlot],
contract: &Contract
) -> Result<(), Self::DataError>
Deploy a contract into the storage
§fn deploy_contract_with_id(
&mut self,
salt: &Salt,
slots: &[StorageSlot],
contract: &Contract,
root: &Bytes32,
id: &ContractId
) -> Result<(), Self::DataError>
fn deploy_contract_with_id(
&mut self,
salt: &Salt,
slots: &[StorageSlot],
contract: &Contract,
root: &Bytes32,
id: &ContractId
) -> Result<(), Self::DataError>
Deploy a contract into the storage with contract id
§fn storage_contract(
&self,
id: &ContractId
) -> Result<Option<Cow<'_, Contract>>, Self::DataError>
fn storage_contract(
&self,
id: &ContractId
) -> Result<Option<Cow<'_, Contract>>, Self::DataError>
Fetch a previously inserted contract code from the chain state for a
given contract.
§fn storage_contract_insert(
&mut self,
id: &ContractId,
contract: &Contract
) -> Result<Option<Contract>, Self::DataError>
fn storage_contract_insert(
&mut self,
id: &ContractId,
contract: &Contract
) -> Result<Option<Contract>, Self::DataError>
Append a contract to the chain, provided its identifier. Read more
§fn storage_contract_exists(
&self,
id: &ContractId
) -> Result<bool, Self::DataError>
fn storage_contract_exists(
&self,
id: &ContractId
) -> Result<bool, Self::DataError>
Check if a provided contract exists in the chain.
§fn storage_contract_root(
&self,
id: &ContractId
) -> Result<Option<Cow<'_, (Salt, Bytes32)>>, Self::DataError>
fn storage_contract_root(
&self,
id: &ContractId
) -> Result<Option<Cow<'_, (Salt, Bytes32)>>, Self::DataError>
Fetch a previously inserted salt+root tuple from the chain state for a
given contract.
§fn storage_contract_root_insert(
&mut self,
id: &ContractId,
salt: &Salt,
root: &Bytes32
) -> Result<Option<(Salt, Bytes32)>, Self::DataError>
fn storage_contract_root_insert(
&mut self,
id: &ContractId,
salt: &Salt,
root: &Bytes32
) -> Result<Option<(Salt, Bytes32)>, Self::DataError>
Append the salt+root of a contract that was appended to the chain.
§fn merkle_contract_state(
&self,
id: &ContractId,
key: &Bytes32
) -> Result<Option<Cow<'_, Bytes32>>, Self::DataError>
fn merkle_contract_state(
&self,
id: &ContractId,
key: &Bytes32
) -> Result<Option<Cow<'_, Bytes32>>, Self::DataError>
Fetch the value form a key-value mapping in a contract storage.
§fn merkle_contract_state_insert(
&mut self,
contract: &ContractId,
key: &Bytes32,
value: &Bytes32
) -> Result<Option<Bytes32>, Self::DataError>
fn merkle_contract_state_insert(
&mut self,
contract: &ContractId,
key: &Bytes32,
value: &Bytes32
) -> Result<Option<Bytes32>, Self::DataError>
Insert a key-value mapping in a contract storage.
§fn merkle_contract_state_remove(
&mut self,
contract: &ContractId,
key: &Bytes32
) -> Result<Option<Bytes32>, Self::DataError>
fn merkle_contract_state_remove(
&mut self,
contract: &ContractId,
key: &Bytes32
) -> Result<Option<Bytes32>, Self::DataError>
Remove a key-value mapping from a contract storage.
§fn merkle_contract_asset_id_balance(
&self,
id: &ContractId,
asset_id: &AssetId
) -> Result<Option<u64>, Self::DataError>
fn merkle_contract_asset_id_balance(
&self,
id: &ContractId,
asset_id: &AssetId
) -> Result<Option<u64>, Self::DataError>
Fetch the balance of an asset ID in a contract storage.