pub struct StaticApiVMHooksHandler(/* private fields */);
Expand description
A simple wrapper around a managed type container Mutex.
Implements VMHooksManagedTypes
and thus can be used as a basis of a minimal static API.
Implementations§
Trait Implementations§
Source§impl Debug for StaticApiVMHooksHandler
impl Debug for StaticApiVMHooksHandler
Source§impl Default for StaticApiVMHooksHandler
impl Default for StaticApiVMHooksHandler
Source§fn default() -> StaticApiVMHooksHandler
fn default() -> StaticApiVMHooksHandler
Returns the “default value” for a type. Read more
Source§impl VMHooksBigFloat for StaticApiVMHooksHandler
impl VMHooksBigFloat for StaticApiVMHooksHandler
fn bf_from_parts( &self, integral_part: i32, fractional_part: i32, exponent: i32, ) -> RawHandle
fn bf_from_frac(&self, numerator: i64, denominator: i64) -> RawHandle
fn bf_from_sci(&self, significand: i64, exponent: i64) -> RawHandle
fn bf_add(&self, dest: RawHandle, x: RawHandle, y: RawHandle)
fn bf_sub(&self, dest: RawHandle, x: RawHandle, y: RawHandle)
fn bf_mul(&self, dest: RawHandle, x: RawHandle, y: RawHandle)
fn bf_div(&self, dest: RawHandle, x: RawHandle, y: RawHandle)
fn bf_abs(&self, dest: RawHandle, x: RawHandle)
fn bf_neg(&self, dest: RawHandle, x: RawHandle)
fn bf_cmp(&self, x: RawHandle, y: RawHandle) -> i32
fn bf_sign(&self, x: RawHandle) -> i32
fn bf_clone(&self, dest: RawHandle, x: RawHandle)
fn bf_sqrt(&self, dest: RawHandle, x: RawHandle)
fn bf_pow(&self, dest: RawHandle, x: RawHandle, exp: i32)
fn bf_floor(&self, dest: RawHandle, x: RawHandle)
fn bf_ceil(&self, dest: RawHandle, x: RawHandle)
fn bf_trunc(&self, dest: RawHandle, x: RawHandle)
fn bf_is_bi(&self, x: RawHandle) -> bool
fn bf_set_i64(&self, dest: RawHandle, value: i64)
fn bf_set_bi(&self, dest: RawHandle, bi: RawHandle)
fn bf_get_const_pi(&self, dest: RawHandle)
fn bf_get_const_e(&self, dest: RawHandle)
Source§impl VMHooksBigInt for StaticApiVMHooksHandler
impl VMHooksBigInt for StaticApiVMHooksHandler
fn bi_new(&self, value: i64) -> RawHandle
fn bi_set_int64(&self, destination: RawHandle, value: i64)
fn bi_unsigned_byte_length(&self, handle: RawHandle) -> usize
fn bi_get_unsigned_bytes(&self, handle: RawHandle) -> Vec<u8> ⓘ
fn bi_set_unsigned_bytes(&self, destination: RawHandle, bytes: &[u8])
fn bi_get_signed_bytes(&self, handle: RawHandle) -> Vec<u8> ⓘ
fn bi_set_signed_bytes(&self, destination: RawHandle, bytes: &[u8])
fn bi_is_int64(&self, destination_handle: RawHandle) -> i32
fn bi_get_int64(&self, destination_handle: RawHandle) -> i64
fn bi_add(&self, dest: RawHandle, x: RawHandle, y: RawHandle)
fn bi_sub(&self, dest: RawHandle, x: RawHandle, y: RawHandle)
fn bi_mul(&self, dest: RawHandle, x: RawHandle, y: RawHandle)
fn bi_t_div(&self, dest: RawHandle, x: RawHandle, y: RawHandle)
fn bi_t_mod(&self, dest: RawHandle, x: RawHandle, y: RawHandle)
fn bi_abs(&self, dest: RawHandle, x: RawHandle)
fn bi_neg(&self, dest: RawHandle, x: RawHandle)
fn bi_sign(&self, x: RawHandle) -> i32
fn bi_cmp(&self, x: RawHandle, y: RawHandle) -> i32
fn bi_sqrt(&self, dest: RawHandle, x: RawHandle)
fn bi_pow(&self, dest: RawHandle, x: RawHandle, y: RawHandle)
fn bi_log2(&self, x: RawHandle) -> i32
fn bi_and(&self, dest: RawHandle, x: RawHandle, y: RawHandle)
fn bi_or(&self, dest: RawHandle, x: RawHandle, y: RawHandle)
fn bi_xor(&self, dest: RawHandle, x: RawHandle, y: RawHandle)
fn bi_shr(&self, dest: RawHandle, x: RawHandle, bits: usize)
fn bi_shl(&self, dest: RawHandle, x: RawHandle, bits: usize)
Source§impl VMHooksBlockchain for StaticApiVMHooksHandler
impl VMHooksBlockchain for StaticApiVMHooksHandler
fn is_contract_address(&self, address_bytes: &[u8]) -> bool
fn managed_caller(&self, dest_handle: RawHandle)
fn managed_sc_address(&self, dest_handle: RawHandle)
fn managed_owner_address(&self, dest_handle: RawHandle)
fn get_shard_of_address(&self, address_bytes: &[u8]) -> i32
fn is_smart_contract(&self, address_bytes: &[u8]) -> bool
fn load_balance(&self, address_bytes: &[u8], dest: RawHandle)
fn get_tx_hash(&self, dest: RawHandle)
fn get_gas_left(&self) -> u64
fn get_block_timestamp(&self) -> u64
fn get_block_nonce(&self) -> u64
fn get_block_round(&self) -> u64
fn get_block_epoch(&self) -> u64
fn get_block_random_seed(&self, dest: RawHandle)
fn get_prev_block_timestamp(&self) -> u64
fn get_prev_block_nonce(&self) -> u64
fn get_prev_block_round(&self) -> u64
fn get_prev_block_epoch(&self) -> u64
fn get_prev_block_random_seed(&self, dest: RawHandle)
fn get_current_esdt_nft_nonce( &self, address_bytes: &[u8], token_id_bytes: &[u8], ) -> u64
fn big_int_get_esdt_external_balance( &self, address_bytes: &[u8], token_id_bytes: &[u8], nonce: u64, dest: RawHandle, )
fn managed_get_code_metadata(&self, address_handle: i32, response_handle: i32)
fn managed_is_builtin_function(&self, function_name_handle: i32) -> bool
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, )
fn managed_get_back_transfers( &self, esdt_transfer_value_handle: RawHandle, call_value_handle: RawHandle, )
fn check_esdt_frozen( &self, address_handle: RawHandle, token_id_handle: RawHandle, _nonce: u64, ) -> bool
fn get_esdt_local_roles_bits(&self, token_id_handle: RawHandle) -> u64
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, )
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 StaticApiVMHooksHandler
impl VMHooksCallValue for StaticApiVMHooksHandler
fn check_not_payable(&self)
fn load_egld_value(&self, dest: RawHandle)
fn load_all_esdt_transfers(&self, dest_handle: RawHandle)
fn esdt_num_transfers(&self) -> usize
Source§impl VMHooksEndpointArgument for StaticApiVMHooksHandler
impl VMHooksEndpointArgument for StaticApiVMHooksHandler
fn get_num_arguments(&self) -> i32
fn get_argument_len(&self, arg_index: i32) -> usize
fn load_argument_managed_buffer(&self, arg_index: i32, dest: RawHandle)
fn get_argument_i64(&self, arg_index: i32) -> i64
fn get_argument_u64(&self, arg_index: i32) -> u64
fn load_callback_closure_buffer(&self, dest: RawHandle)
Source§impl VMHooksEndpointFinish for StaticApiVMHooksHandler
impl VMHooksEndpointFinish for StaticApiVMHooksHandler
fn finish_slice_u8(&self, slice: &[u8])
fn finish_big_int_raw(&self, handle: RawHandle)
fn finish_big_uint_raw(&self, handle: RawHandle)
fn finish_managed_buffer_raw(&self, handle: RawHandle)
fn finish_i64(&self, value: i64)
fn finish_u64(&self, value: u64)
Source§impl VMHooksError for StaticApiVMHooksHandler
impl VMHooksError for StaticApiVMHooksHandler
fn signal_error(&self, message: &[u8]) -> !
Source§impl VMHooksErrorManaged for StaticApiVMHooksHandler
impl VMHooksErrorManaged for StaticApiVMHooksHandler
fn signal_error_from_buffer(&self, message_handle: RawHandle) -> !
Source§impl VMHooksHandlerSource for StaticApiVMHooksHandler
impl VMHooksHandlerSource for StaticApiVMHooksHandler
fn m_types_lock(&self) -> MutexGuard<'_, TxManagedTypes>
fn halt_with_error(&self, status: ReturnCode, message: &str) -> !
fn input_ref(&self) -> &TxInput
fn current_address(&self) -> &VMAddress
Source§fn random_next_bytes(&self, _length: usize) -> Vec<u8> ⓘ
fn random_next_bytes(&self, _length: usize) -> Vec<u8> ⓘ
Random number generator, based on the blockchain randomness source.
fn result_lock(&self) -> MutexGuard<'_, TxResult>
fn push_tx_log(&self, _tx_log: TxLog)
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>
Source§fn account_data(&self, _address: &VMAddress) -> Option<AccountData>
fn account_data(&self, _address: &VMAddress) -> Option<AccountData>
For ownership reasons, needs to return a clone. Read more
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>>, )
fn vm_error(&self, message: &str) -> !
fn tx_hash(&self) -> H256
fn storage_read(&self, key: &[u8]) -> Vec<u8> ⓘ
Source§fn current_account_data(&self) -> AccountData
fn current_account_data(&self) -> AccountData
For ownership reasons, needs to return a clone. Read more
Source§impl VMHooksLog for StaticApiVMHooksHandler
impl VMHooksLog for StaticApiVMHooksHandler
fn managed_write_log(&self, topics_handle: RawHandle, data_handle: RawHandle)
Source§impl VMHooksManagedBuffer for StaticApiVMHooksHandler
impl VMHooksManagedBuffer for StaticApiVMHooksHandler
fn mb_new_empty(&self) -> RawHandle
fn mb_new_from_bytes(&self, bytes: &[u8]) -> RawHandle
fn mb_len(&self, handle: RawHandle) -> usize
fn mb_set(&self, handle: RawHandle, value: &[u8])
Source§unsafe fn mb_copy_bytes(&self, handle: RawHandle, dest_ptr: *mut u8) -> usize
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
fn mb_load_slice( &self, source_handle: RawHandle, starting_position: usize, dest_slice: &mut [u8], ) -> i32
fn mb_copy_slice( &self, source_handle: RawHandle, starting_position: usize, slice_len: usize, dest_handle: RawHandle, ) -> i32
fn mb_set_slice( &self, dest_handle: RawHandle, starting_position: usize, source_slice: &[u8], ) -> i32
fn mb_append(&self, accumulator_handle: RawHandle, data_handle: RawHandle)
fn mb_append_bytes(&self, accumulator_handle: RawHandle, bytes: &[u8])
fn mb_eq(&self, handle1: RawHandle, handle2: RawHandle) -> i32
fn mb_to_hex(&self, source_handle: RawHandle, dest_handle: RawHandle)
Source§impl VMHooksManagedMap for StaticApiVMHooksHandler
impl VMHooksManagedMap for StaticApiVMHooksHandler
fn mm_new(&self) -> RawHandle
fn mm_get( &self, map_handle: RawHandle, key_handle: RawHandle, out_value_handle: RawHandle, )
fn mm_put( &self, map_handle: RawHandle, key_handle: RawHandle, value_handle: RawHandle, )
fn mm_remove( &self, map_handle: RawHandle, key_handle: RawHandle, out_value_handle: RawHandle, )
fn mm_contains(&self, map_handle: RawHandle, key_handle: RawHandle) -> bool
Source§impl VMHooksManagedTypes for StaticApiVMHooksHandler
impl VMHooksManagedTypes for StaticApiVMHooksHandler
fn mb_to_big_int_unsigned(&self, buffer_handle: RawHandle, bi_handle: RawHandle)
fn mb_to_big_int_signed(&self, buffer_handle: RawHandle, bi_handle: RawHandle)
fn mb_from_big_int_unsigned( &self, buffer_handle: RawHandle, bi_handle: RawHandle, )
fn mb_from_big_int_signed(&self, buffer_handle: RawHandle, bi_handle: RawHandle)
fn bi_to_string(&self, bi_handle: RawHandle, str_handle: RawHandle)
fn mb_set_random(&self, dest_handle: RawHandle, length: usize)
Source§impl VMHooksSend for StaticApiVMHooksHandler
impl VMHooksSend for StaticApiVMHooksHandler
fn perform_transfer_execute_esdt( &self, to: VMAddress, token: Vec<u8>, amount: BigUint, _gas_limit: u64, func_name: TxFunctionName, arguments: Vec<Vec<u8>>, )
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>>, )
fn perform_transfer_execute_multi( &self, to: VMAddress, payments: Vec<TxTokenTransfer>, _gas_limit: u64, endpoint_name: TxFunctionName, arguments: Vec<Vec<u8>>, )
fn perform_upgrade_contract( &self, to: VMAddress, egld_value: BigUint, contract_code: Vec<u8>, code_metadata: VMCodeMetadata, args: Vec<Vec<u8>>, ) -> !
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]>
fn multi_transfer_esdt_nft_execute( &self, to_handle: RawHandle, payments_handle: RawHandle, gas_limit: u64, endpoint_name_handle: RawHandle, arg_buffer_handle: RawHandle, )
fn async_call_raw( &self, to_handle: RawHandle, egld_value_handle: RawHandle, endpoint_name_handle: RawHandle, arg_buffer_handle: RawHandle, ) -> !
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, )
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, )
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, )
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, )
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, )
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, )
fn clean_return_data(&self)
fn delete_from_return_data(&self, index: usize)
Source§impl VMHooksStorageWrite for StaticApiVMHooksHandler
impl VMHooksStorageWrite for StaticApiVMHooksHandler
fn storage_store_managed_buffer_raw( &self, key_handle: RawHandle, value_handle: RawHandle, )
impl VMHooksHandler for StaticApiVMHooksHandler
Auto Trait Implementations§
impl !Freeze for StaticApiVMHooksHandler
impl RefUnwindSafe for StaticApiVMHooksHandler
impl Send for StaticApiVMHooksHandler
impl Sync for StaticApiVMHooksHandler
impl Unpin for StaticApiVMHooksHandler
impl UnwindSafe for StaticApiVMHooksHandler
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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