multiversx_chain_vm::vm_hooks

Trait VMHooksHandlerSource

Source
pub trait VMHooksHandlerSource: Debug {
Show 22 methods // Required methods fn m_types_lock(&self) -> MutexGuard<'_, TxManagedTypes>; fn halt_with_error(&self, status: ReturnCode, message: &str) -> !; fn input_ref(&self) -> &TxInput; fn random_next_bytes(&self, length: usize) -> Vec<u8> ; fn result_lock(&self) -> MutexGuard<'_, TxResult>; fn storage_read_any_address( &self, address: &VMAddress, key: &[u8], ) -> Vec<u8> ; fn storage_write(&self, key: &[u8], value: &[u8]); fn get_previous_block_info(&self) -> &BlockInfo; fn get_current_block_info(&self) -> &BlockInfo; fn back_transfers_lock(&self) -> MutexGuard<'_, BackTransfers>; fn account_data(&self, address: &VMAddress) -> Option<AccountData>; fn account_code(&self, address: &VMAddress) -> Vec<u8> ; fn perform_async_call( &self, to: VMAddress, egld_value: BigUint, func_name: TxFunctionName, args: Vec<Vec<u8>>, ) -> !; fn perform_execute_on_dest_context( &self, to: VMAddress, egld_value: BigUint, func_name: TxFunctionName, args: Vec<Vec<u8>>, ) -> Vec<Vec<u8>>; fn perform_deploy( &self, egld_value: BigUint, contract_code: Vec<u8>, code_metadata: VMCodeMetadata, args: Vec<Vec<u8>>, ) -> (VMAddress, Vec<Vec<u8>>); fn perform_transfer_execute( &self, to: VMAddress, egld_value: BigUint, func_name: TxFunctionName, arguments: Vec<Vec<u8>>, ); // Provided methods fn vm_error(&self, message: &str) -> ! { ... } fn current_address(&self) -> &VMAddress { ... } fn tx_hash(&self) -> H256 { ... } fn push_tx_log(&self, tx_log: TxLog) { ... } fn storage_read(&self, key: &[u8]) -> Vec<u8> { ... } fn current_account_data(&self) -> AccountData { ... }
}
Expand description

Abstracts away the borrowing of a managed types structure.

Required Methods§

Source

fn m_types_lock(&self) -> MutexGuard<'_, TxManagedTypes>

Source

fn halt_with_error(&self, status: ReturnCode, message: &str) -> !

Source

fn input_ref(&self) -> &TxInput

Source

fn random_next_bytes(&self, length: usize) -> Vec<u8>

Random number generator, based on the blockchain randomness source.

Source

fn result_lock(&self) -> MutexGuard<'_, TxResult>

Source

fn storage_read_any_address(&self, address: &VMAddress, key: &[u8]) -> Vec<u8>

Source

fn storage_write(&self, key: &[u8], value: &[u8])

Source

fn get_previous_block_info(&self) -> &BlockInfo

Source

fn get_current_block_info(&self) -> &BlockInfo

Source

fn back_transfers_lock(&self) -> MutexGuard<'_, BackTransfers>

Source

fn account_data(&self, address: &VMAddress) -> Option<AccountData>

For ownership reasons, needs to return a clone.

Can be optimized, but is not a priority right now.

Source

fn account_code(&self, address: &VMAddress) -> Vec<u8>

Source

fn perform_async_call( &self, to: VMAddress, egld_value: BigUint, func_name: TxFunctionName, args: Vec<Vec<u8>>, ) -> !

Source

fn perform_execute_on_dest_context( &self, to: VMAddress, egld_value: BigUint, func_name: TxFunctionName, args: Vec<Vec<u8>>, ) -> Vec<Vec<u8>>

Source

fn perform_deploy( &self, egld_value: BigUint, contract_code: Vec<u8>, code_metadata: VMCodeMetadata, args: Vec<Vec<u8>>, ) -> (VMAddress, Vec<Vec<u8>>)

Source

fn perform_transfer_execute( &self, to: VMAddress, egld_value: BigUint, func_name: TxFunctionName, arguments: Vec<Vec<u8>>, )

Provided Methods§

Source

fn vm_error(&self, message: &str) -> !

Source

fn current_address(&self) -> &VMAddress

Source

fn tx_hash(&self) -> H256

Source

fn push_tx_log(&self, tx_log: TxLog)

Source

fn storage_read(&self, key: &[u8]) -> Vec<u8>

Source

fn current_account_data(&self) -> AccountData

For ownership reasons, needs to return a clone.

Can be optimized, but is not a priority right now.

Implementors§