multiversx_chain_vm::vm_hooks

Struct DebugApiVMHooksHandler

Source
pub struct DebugApiVMHooksHandler(/* private fields */);
Expand description

A simple wrapper around a managed type container RefCell.

Implements VMHooksManagedTypes and thus can be used as a basis of a minimal static API.

Implementations§

Source§

impl DebugApiVMHooksHandler

Source

pub fn new(tx_context_arc: Arc<TxContext>) -> Self

Trait Implementations§

Source§

impl Debug for DebugApiVMHooksHandler

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl VMHooksBigFloat for DebugApiVMHooksHandler

Source§

fn bf_from_parts( &self, integral_part: i32, fractional_part: i32, exponent: i32, ) -> RawHandle

Source§

fn bf_from_frac(&self, numerator: i64, denominator: i64) -> RawHandle

Source§

fn bf_from_sci(&self, significand: i64, exponent: i64) -> RawHandle

Source§

fn bf_add(&self, dest: RawHandle, x: RawHandle, y: RawHandle)

Source§

fn bf_sub(&self, dest: RawHandle, x: RawHandle, y: RawHandle)

Source§

fn bf_mul(&self, dest: RawHandle, x: RawHandle, y: RawHandle)

Source§

fn bf_div(&self, dest: RawHandle, x: RawHandle, y: RawHandle)

Source§

fn bf_abs(&self, dest: RawHandle, x: RawHandle)

Source§

fn bf_neg(&self, dest: RawHandle, x: RawHandle)

Source§

fn bf_cmp(&self, x: RawHandle, y: RawHandle) -> i32

Source§

fn bf_sign(&self, x: RawHandle) -> i32

Source§

fn bf_clone(&self, dest: RawHandle, x: RawHandle)

Source§

fn bf_sqrt(&self, dest: RawHandle, x: RawHandle)

Source§

fn bf_pow(&self, dest: RawHandle, x: RawHandle, exp: i32)

Source§

fn bf_floor(&self, dest: RawHandle, x: RawHandle)

Source§

fn bf_ceil(&self, dest: RawHandle, x: RawHandle)

Source§

fn bf_trunc(&self, dest: RawHandle, x: RawHandle)

Source§

fn bf_is_bi(&self, x: RawHandle) -> bool

Source§

fn bf_set_i64(&self, dest: RawHandle, value: i64)

Source§

fn bf_set_bi(&self, dest: RawHandle, bi: RawHandle)

Source§

fn bf_get_const_pi(&self, dest: RawHandle)

Source§

fn bf_get_const_e(&self, dest: RawHandle)

Source§

impl VMHooksBigInt for DebugApiVMHooksHandler

Source§

fn bi_new(&self, value: i64) -> RawHandle

Source§

fn bi_set_int64(&self, destination: RawHandle, value: i64)

Source§

fn bi_unsigned_byte_length(&self, handle: RawHandle) -> usize

Source§

fn bi_get_unsigned_bytes(&self, handle: RawHandle) -> Vec<u8>

Source§

fn bi_set_unsigned_bytes(&self, destination: RawHandle, bytes: &[u8])

Source§

fn bi_get_signed_bytes(&self, handle: RawHandle) -> Vec<u8>

Source§

fn bi_set_signed_bytes(&self, destination: RawHandle, bytes: &[u8])

Source§

fn bi_is_int64(&self, destination_handle: RawHandle) -> i32

Source§

fn bi_get_int64(&self, destination_handle: RawHandle) -> i64

Source§

fn bi_add(&self, dest: RawHandle, x: RawHandle, y: RawHandle)

Source§

fn bi_sub(&self, dest: RawHandle, x: RawHandle, y: RawHandle)

Source§

fn bi_mul(&self, dest: RawHandle, x: RawHandle, y: RawHandle)

Source§

fn bi_t_div(&self, dest: RawHandle, x: RawHandle, y: RawHandle)

Source§

fn bi_t_mod(&self, dest: RawHandle, x: RawHandle, y: RawHandle)

Source§

fn bi_abs(&self, dest: RawHandle, x: RawHandle)

Source§

fn bi_neg(&self, dest: RawHandle, x: RawHandle)

Source§

fn bi_sign(&self, x: RawHandle) -> i32

Source§

fn bi_cmp(&self, x: RawHandle, y: RawHandle) -> i32

Source§

fn bi_sqrt(&self, dest: RawHandle, x: RawHandle)

Source§

fn bi_pow(&self, dest: RawHandle, x: RawHandle, y: RawHandle)

Source§

fn bi_log2(&self, x: RawHandle) -> i32

Source§

fn bi_and(&self, dest: RawHandle, x: RawHandle, y: RawHandle)

Source§

fn bi_or(&self, dest: RawHandle, x: RawHandle, y: RawHandle)

Source§

fn bi_xor(&self, dest: RawHandle, x: RawHandle, y: RawHandle)

Source§

fn bi_shr(&self, dest: RawHandle, x: RawHandle, bits: usize)

Source§

fn bi_shl(&self, dest: RawHandle, x: RawHandle, bits: usize)

Source§

impl VMHooksBlockchain for DebugApiVMHooksHandler

Source§

fn is_contract_address(&self, address_bytes: &[u8]) -> bool

Source§

fn managed_caller(&self, dest_handle: RawHandle)

Source§

fn managed_sc_address(&self, dest_handle: RawHandle)

Source§

fn managed_owner_address(&self, dest_handle: RawHandle)

Source§

fn get_shard_of_address(&self, address_bytes: &[u8]) -> i32

Source§

fn is_smart_contract(&self, address_bytes: &[u8]) -> bool

Source§

fn load_balance(&self, address_bytes: &[u8], dest: RawHandle)

Source§

fn get_tx_hash(&self, dest: RawHandle)

Source§

fn get_gas_left(&self) -> u64

Source§

fn get_block_timestamp(&self) -> u64

Source§

fn get_block_nonce(&self) -> u64

Source§

fn get_block_round(&self) -> u64

Source§

fn get_block_epoch(&self) -> u64

Source§

fn get_block_random_seed(&self, dest: RawHandle)

Source§

fn get_prev_block_timestamp(&self) -> u64

Source§

fn get_prev_block_nonce(&self) -> u64

Source§

fn get_prev_block_round(&self) -> u64

Source§

fn get_prev_block_epoch(&self) -> u64

Source§

fn get_prev_block_random_seed(&self, dest: RawHandle)

Source§

fn get_current_esdt_nft_nonce( &self, address_bytes: &[u8], token_id_bytes: &[u8], ) -> u64

Source§

fn big_int_get_esdt_external_balance( &self, address_bytes: &[u8], token_id_bytes: &[u8], nonce: u64, dest: RawHandle, )

Source§

fn managed_get_code_metadata(&self, address_handle: i32, response_handle: i32)

Source§

fn managed_is_builtin_function(&self, function_name_handle: i32) -> bool

Source§

fn managed_get_esdt_token_data( &self, address_handle: RawHandle, token_id_handle: RawHandle, nonce: u64, value_handle: RawHandle, properties_handle: RawHandle, hash_handle: RawHandle, name_handle: RawHandle, attributes_handle: RawHandle, creator_handle: RawHandle, royalties_handle: RawHandle, uris_handle: RawHandle, )

Source§

fn managed_get_back_transfers( &self, esdt_transfer_value_handle: RawHandle, call_value_handle: RawHandle, )

Source§

fn check_esdt_frozen( &self, address_handle: RawHandle, token_id_handle: RawHandle, _nonce: u64, ) -> bool

Source§

fn get_esdt_local_roles_bits(&self, token_id_handle: RawHandle) -> u64

Source§

fn set_esdt_data_values( &self, esdt_data: &EsdtData, instance: &EsdtInstance, value_handle: RawHandle, properties_handle: RawHandle, hash_handle: RawHandle, name_handle: RawHandle, attributes_handle: RawHandle, creator_handle: RawHandle, royalties_handle: RawHandle, uris_handle: RawHandle, )

Source§

fn reset_esdt_data_values( &self, value_handle: RawHandle, properties_handle: RawHandle, hash_handle: RawHandle, name_handle: RawHandle, attributes_handle: RawHandle, creator_handle: RawHandle, royalties_handle: RawHandle, uris_handle: RawHandle, )

Source§

impl VMHooksCallValue for DebugApiVMHooksHandler

Source§

impl VMHooksCrypto for DebugApiVMHooksHandler

Source§

fn sha256_managed(&self, dest: RawHandle, data_handle: RawHandle)

Source§

fn keccak256_managed(&self, dest: RawHandle, data_handle: RawHandle)

Source§

fn verify_ed25519_managed( &self, key: RawHandle, message: RawHandle, signature: RawHandle, )

Should crash if the signature is invalid.
Source§

impl VMHooksEndpointArgument for DebugApiVMHooksHandler

Source§

fn get_num_arguments(&self) -> i32

Source§

fn get_argument_len(&self, arg_index: i32) -> usize

Source§

fn load_argument_managed_buffer(&self, arg_index: i32, dest: RawHandle)

Source§

fn get_argument_i64(&self, arg_index: i32) -> i64

Source§

fn get_argument_u64(&self, arg_index: i32) -> u64

Source§

fn load_callback_closure_buffer(&self, dest: RawHandle)

Source§

impl VMHooksEndpointFinish for DebugApiVMHooksHandler

Source§

fn finish_slice_u8(&self, slice: &[u8])

Source§

fn finish_big_int_raw(&self, handle: RawHandle)

Source§

fn finish_big_uint_raw(&self, handle: RawHandle)

Source§

fn finish_managed_buffer_raw(&self, handle: RawHandle)

Source§

fn finish_i64(&self, value: i64)

Source§

fn finish_u64(&self, value: u64)

Source§

impl VMHooksError for DebugApiVMHooksHandler

Source§

fn signal_error(&self, message: &[u8]) -> !

Source§

impl VMHooksErrorManaged for DebugApiVMHooksHandler

Source§

fn signal_error_from_buffer(&self, message_handle: RawHandle) -> !

Source§

impl VMHooksHandlerSource for DebugApiVMHooksHandler

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. Read more
Source§

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

Source§

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

Source§

fn perform_execute_on_dest_context( &self, to: VMAddress, egld_value: BigUint, func_name: TxFunctionName, arguments: 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>>, )

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. Read more
Source§

impl VMHooksLog for DebugApiVMHooksHandler

Source§

fn managed_write_log(&self, topics_handle: RawHandle, data_handle: RawHandle)

Source§

impl VMHooksManagedBuffer for DebugApiVMHooksHandler

Source§

fn mb_new_empty(&self) -> RawHandle

Source§

fn mb_new_from_bytes(&self, bytes: &[u8]) -> RawHandle

Source§

fn mb_len(&self, handle: RawHandle) -> usize

Source§

fn mb_set(&self, handle: RawHandle, value: &[u8])

Source§

unsafe fn mb_copy_bytes(&self, handle: RawHandle, dest_ptr: *mut u8) -> usize

Copies bytes from a stored managed buffer to the given pointer. Read more
Source§

fn mb_load_slice( &self, source_handle: RawHandle, starting_position: usize, dest_slice: &mut [u8], ) -> i32

Source§

fn mb_copy_slice( &self, source_handle: RawHandle, starting_position: usize, slice_len: usize, dest_handle: RawHandle, ) -> i32

Source§

fn mb_set_slice( &self, dest_handle: RawHandle, starting_position: usize, source_slice: &[u8], ) -> i32

Source§

fn mb_append(&self, accumulator_handle: RawHandle, data_handle: RawHandle)

Source§

fn mb_append_bytes(&self, accumulator_handle: RawHandle, bytes: &[u8])

Source§

fn mb_eq(&self, handle1: RawHandle, handle2: RawHandle) -> i32

Source§

fn mb_to_hex(&self, source_handle: RawHandle, dest_handle: RawHandle)

Source§

impl VMHooksManagedMap for DebugApiVMHooksHandler

Source§

fn mm_new(&self) -> RawHandle

Source§

fn mm_get( &self, map_handle: RawHandle, key_handle: RawHandle, out_value_handle: RawHandle, )

Source§

fn mm_put( &self, map_handle: RawHandle, key_handle: RawHandle, value_handle: RawHandle, )

Source§

fn mm_remove( &self, map_handle: RawHandle, key_handle: RawHandle, out_value_handle: RawHandle, )

Source§

fn mm_contains(&self, map_handle: RawHandle, key_handle: RawHandle) -> bool

Source§

impl VMHooksManagedTypes for DebugApiVMHooksHandler

Source§

fn mb_to_big_int_unsigned(&self, buffer_handle: RawHandle, bi_handle: RawHandle)

Source§

fn mb_to_big_int_signed(&self, buffer_handle: RawHandle, bi_handle: RawHandle)

Source§

fn mb_from_big_int_unsigned( &self, buffer_handle: RawHandle, bi_handle: RawHandle, )

Source§

fn mb_from_big_int_signed(&self, buffer_handle: RawHandle, bi_handle: RawHandle)

Source§

fn bi_to_string(&self, bi_handle: RawHandle, str_handle: RawHandle)

Source§

fn mb_set_random(&self, dest_handle: RawHandle, length: usize)

Source§

impl VMHooksSend for DebugApiVMHooksHandler

Source§

fn perform_transfer_execute_esdt( &self, to: VMAddress, token: Vec<u8>, amount: BigUint, _gas_limit: u64, func_name: TxFunctionName, arguments: Vec<Vec<u8>>, )

Source§

fn perform_transfer_execute_nft( &self, to: VMAddress, token: Vec<u8>, nonce: u64, amount: BigUint, _gas_limit: u64, func_name: TxFunctionName, arguments: Vec<Vec<u8>>, )

Source§

fn perform_transfer_execute_multi( &self, to: VMAddress, payments: Vec<TxTokenTransfer>, _gas_limit: u64, endpoint_name: TxFunctionName, arguments: Vec<Vec<u8>>, )

Source§

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

Source§

fn transfer_value_execute( &self, to_handle: RawHandle, amount_handle: RawHandle, _gas_limit: u64, endpoint_name_handle: RawHandle, arg_buffer_handle: RawHandle, ) -> Result<(), &'static [u8]>

Source§

fn multi_transfer_esdt_nft_execute( &self, to_handle: RawHandle, payments_handle: RawHandle, gas_limit: u64, endpoint_name_handle: RawHandle, arg_buffer_handle: RawHandle, )

Source§

fn async_call_raw( &self, to_handle: RawHandle, egld_value_handle: RawHandle, endpoint_name_handle: RawHandle, arg_buffer_handle: RawHandle, ) -> !

Source§

fn create_async_call_raw( &self, to_handle: RawHandle, egld_value_handle: RawHandle, endpoint_name_handle: RawHandle, arg_buffer_handle: RawHandle, success_callback: &[u8], error_callback: &[u8], _gas: u64, _extra_gas_for_callback: u64, callback_closure_handle: RawHandle, )

Source§

fn deploy_contract( &self, _gas: u64, egld_value_handle: RawHandle, code_handle: RawHandle, code_metadata_handle: RawHandle, arg_buffer_handle: RawHandle, new_address_handle: RawHandle, result_handle: RawHandle, )

Source§

fn deploy_from_source_contract( &self, _gas: u64, egld_value_handle: RawHandle, source_contract_address_handle: RawHandle, code_metadata_handle: RawHandle, arg_buffer_handle: RawHandle, new_address_handle: RawHandle, result_handle: RawHandle, )

Source§

fn upgrade_from_source_contract( &self, sc_address_handle: RawHandle, _gas: u64, egld_value_handle: RawHandle, source_contract_address_handle: RawHandle, code_metadata_handle: RawHandle, arg_buffer_handle: RawHandle, )

Source§

fn upgrade_contract( &self, sc_address_handle: RawHandle, _gas: u64, egld_value_handle: RawHandle, code_handle: RawHandle, code_metadata_handle: RawHandle, arg_buffer_handle: RawHandle, )

Source§

fn execute_on_dest_context_raw( &self, _gas: u64, to_handle: RawHandle, egld_value_handle: RawHandle, endpoint_name_handle: RawHandle, arg_buffer_handle: RawHandle, result_handle: RawHandle, )

Source§

fn clean_return_data(&self)

Source§

fn delete_from_return_data(&self, index: usize)

Source§

impl VMHooksStorageRead for DebugApiVMHooksHandler

Source§

fn storage_load_managed_buffer_raw( &self, key_handle: RawHandle, dest: RawHandle, )

Source§

fn storage_load_from_address( &self, address_handle: RawHandle, key_handle: RawHandle, dest: RawHandle, )

Source§

impl VMHooksStorageWrite for DebugApiVMHooksHandler

Source§

fn storage_store_managed_buffer_raw( &self, key_handle: RawHandle, value_handle: RawHandle, )

Source§

impl VMHooksHandler for DebugApiVMHooksHandler

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.