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

source§

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

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

impl Default for StaticApiVMHooksHandler

source§

fn default() -> StaticApiVMHooksHandler

Returns the “default value” for a type. Read more
source§

impl VMHooksBigFloat for StaticApiVMHooksHandler

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 StaticApiVMHooksHandler

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 StaticApiVMHooksHandler

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_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 StaticApiVMHooksHandler

source§

impl VMHooksCrypto for StaticApiVMHooksHandler

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 StaticApiVMHooksHandler

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 StaticApiVMHooksHandler

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 StaticApiVMHooksHandler

source§

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

source§

impl VMHooksErrorManaged for StaticApiVMHooksHandler

source§

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

source§

impl VMHooksHandlerSource for StaticApiVMHooksHandler

source§

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

source§

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

source§

fn input_ref(&self) -> &TxInput

source§

fn current_address(&self) -> &VMAddress

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 push_tx_log(&self, _tx_log: TxLog)

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) -> 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, _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>> )

source§

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

source§

fn tx_hash(&self) -> H256

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 StaticApiVMHooksHandler

source§

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

source§

impl VMHooksManagedBuffer for StaticApiVMHooksHandler

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 StaticApiVMHooksHandler

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 StaticApiVMHooksHandler

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 StaticApiVMHooksHandler

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 StaticApiVMHooksHandler

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 StaticApiVMHooksHandler

source§

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

source§

impl VMHooksHandler for StaticApiVMHooksHandler

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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> Same for T

§

type Output = T

Should always be Self
source§

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

§

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 Twhere U: TryFrom<T>,

§

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.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V