Struct elrond_wasm_node::VmApiImpl
source · [−]pub struct VmApiImpl {}
Expand description
The reference to the API implementation based on Arwen hooks. It continas no data, can be embedded at no cost. Cloning it is a no-op.
Trait Implementations
sourceimpl BigIntApi for VmApiImpl
impl BigIntApi for VmApiImpl
fn bi_new(&self, value: i64) -> Handle
fn bi_unsigned_byte_length(&self, x: Handle) -> usize
fn bi_get_unsigned_bytes(&self, handle: Handle) -> BoxedBytes
fn bi_set_unsigned_bytes(&self, destination: Handle, bytes: &[u8])
fn bi_signed_byte_length(&self, x: Handle) -> usize
fn bi_get_signed_bytes(&self, handle: Handle) -> BoxedBytes
fn bi_set_signed_bytes(&self, destination: Handle, bytes: &[u8])
fn bi_to_i64(&self, reference: Handle) -> Option<i64>
fn bi_add(&self, dest: Handle, x: Handle, y: Handle)
fn bi_sub(&self, dest: Handle, x: Handle, y: Handle)
fn bi_sub_unsigned(&self, dest: Handle, x: Handle, y: Handle)
fn bi_mul(&self, dest: Handle, x: Handle, y: Handle)
fn bi_t_div(&self, dest: Handle, x: Handle, y: Handle)
fn bi_t_mod(&self, dest: Handle, x: Handle, y: Handle)
fn bi_abs(&self, dest: Handle, x: Handle)
fn bi_neg(&self, dest: Handle, x: Handle)
fn bi_sign(&self, x: Handle) -> Sign
fn bi_cmp(&self, x: Handle, y: Handle) -> Ordering
fn bi_sqrt(&self, dest: Handle, x: Handle)
fn bi_pow(&self, dest: Handle, x: Handle, y: Handle)
fn bi_log2(&self, x: Handle) -> u32
fn bi_and(&self, dest: Handle, x: Handle, y: Handle)
fn bi_or(&self, dest: Handle, x: Handle, y: Handle)
fn bi_xor(&self, dest: Handle, x: Handle, y: Handle)
fn bi_shr(&self, dest: Handle, x: Handle, bits: usize)
fn bi_shl(&self, dest: Handle, x: Handle, bits: usize)
fn bi_new_zero(&self) -> i32
sourceimpl BlockchainApi for VmApiImpl
impl BlockchainApi for VmApiImpl
type BlockchainApiImpl = VmApiImpl
fn blockchain_api_impl() -> Self::BlockchainApiImpl
sourceimpl BlockchainApiImpl for VmApiImpl
impl BlockchainApiImpl for VmApiImpl
fn get_sc_address_legacy(&self) -> Address
fn get_sc_address_handle(&self) -> Handle
fn get_owner_address_legacy(&self) -> Address
fn get_owner_address_handle(&self) -> Handle
fn get_shard_of_address_legacy(&self, address: &Address) -> u32
fn get_shard_of_address(&self, address_handle: Handle) -> u32
fn is_smart_contract_legacy(&self, address: &Address) -> bool
fn is_smart_contract(&self, address_handle: Handle) -> bool
fn get_caller_legacy(&self) -> Address
fn get_caller_handle(&self) -> Handle
fn get_balance_legacy(&self, address: &Address) -> Handle
fn get_balance_handle(&self, address_handle: Handle) -> Handle
fn get_state_root_hash_legacy(&self) -> H256
fn get_state_root_hash<M: ManagedTypeApi>(&self) -> ManagedByteArray<M, 32>
fn get_tx_hash_legacy(&self) -> H256
fn get_tx_hash<M: ManagedTypeApi>(&self) -> ManagedByteArray<M, 32>
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_legacy(&self) -> Box<[u8; 48]>ⓘNotable traits for Box<F, A>impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;
fn get_block_random_seed<M: ManagedTypeApi>(&self) -> ManagedByteArray<M, 48>
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_legacy(&self) -> Box<[u8; 48]>ⓘNotable traits for Box<F, A>impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;
fn get_prev_block_random_seed<M: ManagedTypeApi>(
&self
) -> ManagedByteArray<M, 48>
fn get_current_esdt_nft_nonce<M: ManagedTypeApi>(
&self,
address: &ManagedAddress<M>,
token: &TokenIdentifier<M>
) -> u64
fn get_esdt_balance<M: ManagedTypeApi>(
&self,
address: &ManagedAddress<M>,
token: &TokenIdentifier<M>,
nonce: u64
) -> BigUint<M>
fn get_esdt_token_data<M: ManagedTypeApi>(
&self,
address: &ManagedAddress<M>,
token: &TokenIdentifier<M>,
nonce: u64
) -> EsdtTokenData<M>
fn get_esdt_local_roles<M: ManagedTypeApi>(
&self,
token_id: &TokenIdentifier<M>
) -> EsdtLocalRoleFlags
sourceimpl CallValueApi for VmApiImpl
impl CallValueApi for VmApiImpl
type CallValueApiImpl = VmApiImpl
fn call_value_api_impl() -> Self::CallValueApiImpl
sourceimpl CallValueApiImpl for VmApiImpl
impl CallValueApiImpl for VmApiImpl
fn check_not_payable(&self)
sourcefn egld_value(&self) -> Handle
fn egld_value(&self) -> Handle
Retrieves the EGLD call value from the VM. Will return 0 in case of an ESDT transfer (cannot have both EGLD and ESDT transfer simultaneously). Read more
sourcefn esdt_value(&self) -> Handle
fn esdt_value(&self) -> Handle
Retrieves the ESDT call value from the VM. Will return 0 in case of an EGLD transfer (cannot have both EGLD and ESDT transfer simultaneously). Read more
sourcefn token(&self) -> Handle
fn token(&self) -> Handle
Returns the call value token identifier of the current call. The identifier is wrapped in a TokenIdentifier object, to hide underlying logic. Read more
sourcefn esdt_token_nonce(&self) -> u64
fn esdt_token_nonce(&self) -> u64
Returns the nonce of the received ESDT token. Will return 0 in case of EGLD or fungible ESDT transfer. Read more
sourcefn esdt_token_type(&self) -> EsdtTokenType
fn esdt_token_type(&self) -> EsdtTokenType
Returns the ESDT token type. Will return “Fungible” for EGLD. Read more
fn esdt_num_transfers(&self) -> usize
fn esdt_value_by_index(&self, index: usize) -> Handle
fn token_by_index(&self, index: usize) -> Handle
fn esdt_token_nonce_by_index(&self, index: usize) -> u64
fn esdt_token_type_by_index(&self, index: usize) -> EsdtTokenType
fn get_all_esdt_transfers<M: ManagedTypeApi>(
&self
) -> ManagedVec<M, EsdtTokenPayment<M>>
sourcefn require_egld(&self) -> i32
fn require_egld(&self) -> i32
Will return the EGLD call value, but also fail with an error if ESDT is sent. Especially used in the auto-generated call value processing. Read more
sourcefn require_esdt(&self, token: &[u8]) -> i32
fn require_esdt(&self, token: &[u8]) -> i32
Will return the ESDT call value, but also fail with an error if EGLD or the wrong ESDT token is sent. Especially used in the auto-generated call value processing. Read more
sourcefn payment_token_pair(&self) -> (i32, i32)
fn payment_token_pair(&self) -> (i32, i32)
Returns both the call value (either EGLD or ESDT) and the token identifier. Especially used in the `#[payable(“*”)] auto-generated snippets. The method might seem redundant, but there is such a hook in Arwen that might be used in this scenario in the future. Read more
sourceimpl CryptoApi for VmApiImpl
impl CryptoApi for VmApiImpl
type CryptoApiImpl = VmApiImpl
fn crypto_api_impl() -> Self::CryptoApiImpl
sourceimpl CryptoApiImpl for VmApiImpl
impl CryptoApiImpl for VmApiImpl
fn sha256_legacy(&self, data: &[u8]) -> [u8; 32]
fn sha256(&self, data_handle: Handle) -> Handle
fn keccak256_legacy(&self, data: &[u8]) -> [u8; 32]
fn keccak256(&self, data_handle: Handle) -> Handle
fn ripemd160(&self, data: &[u8]) -> [u8; 20]
fn verify_bls(&self, key: &[u8], message: &[u8], signature: &[u8]) -> bool
fn verify_ed25519(&self, key: &[u8], message: &[u8], signature: &[u8]) -> bool
sourcefn verify_secp256k1(&self, key: &[u8], message: &[u8], signature: &[u8]) -> bool
fn verify_secp256k1(&self, key: &[u8], message: &[u8], signature: &[u8]) -> bool
Note: the signature is minimum 2 bytes in length, the second byte encodes the length of the remaining signature bytes. Read more
fn verify_custom_secp256k1(
&self,
key: &[u8],
message: &[u8],
signature: &[u8],
hash_type: MessageHashType
) -> bool
fn encode_secp256k1_der_signature(&self, r: &[u8], s: &[u8]) -> BoxedBytes
sourceimpl EllipticCurveApi for VmApiImpl
impl EllipticCurveApi for VmApiImpl
fn ec_create(&self, name: &[u8]) -> Handle
fn ec_get_values(
&self,
ec_handle: Handle,
field_order_handle: Handle,
base_point_order_handle: Handle,
eq_constant_handle: Handle,
x_base_point_handle: Handle,
y_base_point_handle: Handle
)
fn ec_curve_length(&self, ec_handle: Handle) -> u32
fn ec_private_key_byte_length(&self, ec_handle: Handle) -> u32
fn ec_add(
&self,
x_result_handle: Handle,
y_result_handle: Handle,
ec_handle: Handle,
x_first_point: Handle,
y_first_point: Handle,
x_second_point: Handle,
y_second_point: Handle
)
fn ec_double(
&self,
x_result_handle: Handle,
y_result_handle: Handle,
ec_handle: Handle,
x_point_handle: Handle,
y_point_handle: Handle
)
fn ec_is_on_curve(
&self,
ec_handle: Handle,
x_point_handle: Handle,
y_point_handle: Handle
) -> bool
fn ec_scalar_mult(
&self,
x_result_handle: Handle,
y_result_handle: Handle,
ec_handle: Handle,
x_point_handle: Handle,
y_point_handle: Handle,
data: &[u8]
)
fn ec_scalar_base_mult(
&self,
x_result_handle: Handle,
y_result_handle: Handle,
ec_handle: Handle,
data: &[u8]
)
fn ec_marshal(
&self,
ec_handle: Handle,
x_pair_handle: Handle,
y_pair_handle: Handle
) -> BoxedBytes
fn ec_marshal_compressed(
&self,
ec_handle: Handle,
x_pair_handle: Handle,
y_pair_handle: Handle
) -> BoxedBytes
fn ec_unmarshal(
&self,
x_result_handle: Handle,
y_result_handle: Handle,
ec_handle: Handle,
data: &[u8]
)
fn ec_unmarshal_compressed(
&self,
x_result_handle: Handle,
y_result_handle: Handle,
ec_handle: Handle,
data: &[u8]
)
fn ec_generate_key(
&self,
x_pub_key_handle: Handle,
y_pub_key_handle: Handle,
ec_handle: Handle
) -> BoxedBytes
sourceimpl EndpointArgumentApi for VmApiImpl
impl EndpointArgumentApi for VmApiImpl
type EndpointArgumentApiImpl = VmApiImpl
fn argument_api_impl() -> Self::EndpointArgumentApiImpl
sourceimpl EndpointArgumentApiImpl for VmApiImpl
impl EndpointArgumentApiImpl for VmApiImpl
Interface to only be used by code generated by the macros. The smart contract code doesn’t have access to these methods directly.
fn get_num_arguments(&self) -> i32
fn get_argument_len(&self, arg_index: i32) -> usize
fn copy_argument_to_slice(&self, arg_index: i32, slice: &mut [u8])
fn get_argument_vec_u8(&self, arg_index: i32) -> Vec<u8>
fn get_argument_boxed_bytes(&self, arg_index: i32) -> BoxedBytes
fn get_argument_big_uint_raw(&self, arg_id: i32) -> i32
fn get_argument_big_int_raw(&self, arg_id: i32) -> i32
fn get_argument_managed_buffer_raw(&self, arg_id: i32) -> Handle
fn get_argument_u64(&self, arg_id: i32) -> u64
fn get_argument_i64(&self, arg_id: i32) -> i64
fn check_num_arguments(&self, expected: i32)
sourceimpl EndpointFinishApi for VmApiImpl
impl EndpointFinishApi for VmApiImpl
type EndpointFinishApiImpl = VmApiImpl
fn finish_api_impl() -> Self::EndpointFinishApiImpl
sourceimpl EndpointFinishApiImpl for VmApiImpl
impl EndpointFinishApiImpl for VmApiImpl
Interface to only be used by code generated by the macros. The smart contract code doesn’t have access to these methods directly.
fn finish_slice_u8(&self, slice: &[u8])
fn finish_big_int_raw(&self, handle: i32)
fn finish_big_uint_raw(&self, handle: i32)
fn finish_managed_buffer_raw(&self, handle: Handle)
fn finish_u64(&self, value: u64)
fn finish_i64(&self, value: i64)
sourceimpl ErrorApi for VmApiImpl
impl ErrorApi for VmApiImpl
type ErrorApiImpl = VmApiImpl
fn error_api_impl() -> Self
sourceimpl ErrorApiImpl for VmApiImpl
impl ErrorApiImpl for VmApiImpl
fn signal_error(&self, message: &[u8]) -> !
fn signal_error_from_buffer(&self, message_handle: Handle) -> !
sourceimpl LogApi for VmApiImpl
impl LogApi for VmApiImpl
type LogApiImpl = VmApiImpl
fn log_api_impl() -> Self::LogApiImpl
sourceimpl LogApiImpl for VmApiImpl
impl LogApiImpl for VmApiImpl
Interface to only be used by code generated by the macros. The smart contract code doesn’t have access to these methods directly.
sourceimpl ManagedBufferApi for VmApiImpl
impl ManagedBufferApi for VmApiImpl
fn mb_new_empty(&self) -> Handle
fn mb_new_from_bytes(&self, bytes: &[u8]) -> Handle
fn mb_len(&self, handle: Handle) -> usize
fn mb_to_boxed_bytes(&self, handle: Handle) -> BoxedBytes
sourcefn mb_load_slice(
&self,
source_handle: Handle,
starting_position: usize,
dest_slice: &mut [u8]
) -> Result<(), InvalidSliceError>
fn mb_load_slice(
&self,
source_handle: Handle,
starting_position: usize,
dest_slice: &mut [u8]
) -> Result<(), InvalidSliceError>
TODO: investigate the impact of using Result<(), ()>
on the wasm output.
sourcefn mb_copy_slice(
&self,
source_handle: Handle,
starting_pos: usize,
slice_len: usize,
dest_handle: Handle
) -> Result<(), InvalidSliceError>
fn mb_copy_slice(
&self,
source_handle: Handle,
starting_pos: usize,
slice_len: usize,
dest_handle: Handle
) -> Result<(), InvalidSliceError>
TODO: investigate the impact of using Result<(), ()>
on the wasm output.
fn mb_copy_to_slice_pad_right(&self, handle: Handle, destination: &mut [u8])
fn mb_overwrite(&self, handle: Handle, bytes: &[u8])
fn mb_set_slice(
&self,
dest_handle: Handle,
starting_position: usize,
source_slice: &[u8]
) -> Result<(), InvalidSliceError>
fn mb_set_random(&self, dest_handle: Handle, length: usize)
fn mb_append(&self, accumulator_handle: Handle, data_handle: Handle)
fn mb_append_bytes(&self, accumulator_handle: Handle, bytes: &[u8])
fn mb_eq(&self, handle1: Handle, handle2: Handle) -> bool
sourceimpl ManagedTypeApi for VmApiImpl
impl ManagedTypeApi for VmApiImpl
type ManagedTypeApiImpl = VmApiImpl
fn managed_type_impl() -> Self
sourceimpl ManagedTypeApiImpl for VmApiImpl
impl ManagedTypeApiImpl for VmApiImpl
fn mb_to_big_int_unsigned(&self, buffer_handle: Handle) -> Handle
fn mb_to_big_int_signed(&self, buffer_handle: Handle) -> Handle
fn mb_from_big_int_unsigned(&self, big_int_handle: Handle) -> Handle
fn mb_from_big_int_signed(&self, big_int_handle: Handle) -> Handle
fn validate_token_identifier(&self, token_id_handle: i32) -> bool
sourceimpl PrintApi for VmApiImpl
impl PrintApi for VmApiImpl
type PrintApiImpl = VmApiImpl
fn print_api_impl() -> Self::PrintApiImpl
sourceimpl PrintApiImpl for VmApiImpl
impl PrintApiImpl for VmApiImpl
fn print_biguint(&self, _bu_handle: i32)
fn print_managed_buffer(&self, _mb_handle: i32)
sourceimpl SendApi for VmApiImpl
impl SendApi for VmApiImpl
type SendApiImpl = VmApiImpl
fn send_api_impl() -> Self::SendApiImpl
sourceimpl SendApiImpl for VmApiImpl
impl SendApiImpl for VmApiImpl
sourcefn direct_egld<M, D>(
&self,
to: &ManagedAddress<M>,
amount: &BigUint<M>,
data: D
) where
M: ManagedTypeApi,
D: Into<ManagedBuffer<M>>,
fn direct_egld<M, D>(
&self,
to: &ManagedAddress<M>,
amount: &BigUint<M>,
data: D
) where
M: ManagedTypeApi,
D: Into<ManagedBuffer<M>>,
Sends EGLD to a given address, directly. Used especially for sending EGLD to regular accounts. Read more
sourcefn direct_egld_execute<M: ManagedTypeApi>(
&self,
to: &ManagedAddress<M>,
amount: &BigUint<M>,
gas_limit: u64,
endpoint_name: &ManagedBuffer<M>,
arg_buffer: &ManagedArgBuffer<M>
) -> Result<(), &'static [u8]>
fn direct_egld_execute<M: ManagedTypeApi>(
&self,
to: &ManagedAddress<M>,
amount: &BigUint<M>,
gas_limit: u64,
endpoint_name: &ManagedBuffer<M>,
arg_buffer: &ManagedArgBuffer<M>
) -> Result<(), &'static [u8]>
Sends EGLD to an address (optionally) and executes like an async call, but without callback.
sourcefn direct_esdt_execute<M: ManagedTypeApi>(
&self,
to: &ManagedAddress<M>,
token: &TokenIdentifier<M>,
amount: &BigUint<M>,
gas_limit: u64,
endpoint_name: &ManagedBuffer<M>,
arg_buffer: &ManagedArgBuffer<M>
) -> Result<(), &'static [u8]>
fn direct_esdt_execute<M: ManagedTypeApi>(
&self,
to: &ManagedAddress<M>,
token: &TokenIdentifier<M>,
amount: &BigUint<M>,
gas_limit: u64,
endpoint_name: &ManagedBuffer<M>,
arg_buffer: &ManagedArgBuffer<M>
) -> Result<(), &'static [u8]>
Sends ESDT to an address and executes like an async call, but without callback.
sourcefn direct_esdt_nft_execute<M: ManagedTypeApi>(
&self,
to: &ManagedAddress<M>,
token: &TokenIdentifier<M>,
nonce: u64,
amount: &BigUint<M>,
gas_limit: u64,
endpoint_name: &ManagedBuffer<M>,
arg_buffer: &ManagedArgBuffer<M>
) -> Result<(), &'static [u8]>
fn direct_esdt_nft_execute<M: ManagedTypeApi>(
&self,
to: &ManagedAddress<M>,
token: &TokenIdentifier<M>,
nonce: u64,
amount: &BigUint<M>,
gas_limit: u64,
endpoint_name: &ManagedBuffer<M>,
arg_buffer: &ManagedArgBuffer<M>
) -> Result<(), &'static [u8]>
Sends ESDT NFT to an address and executes like an async call, but without callback.
fn direct_multi_esdt_transfer_execute<M: ManagedTypeApi>(
&self,
to: &ManagedAddress<M>,
payments: &ManagedVec<M, EsdtTokenPayment<M>>,
gas_limit: u64,
endpoint_name: &ManagedBuffer<M>,
arg_buffer: &ManagedArgBuffer<M>
) -> Result<(), &'static [u8]>
sourcefn async_call_raw<M: ManagedTypeApi>(
&self,
to: &ManagedAddress<M>,
amount: &BigUint<M>,
endpoint_name: &ManagedBuffer<M>,
arg_buffer: &ManagedArgBuffer<M>
) -> !
fn async_call_raw<M: ManagedTypeApi>(
&self,
to: &ManagedAddress<M>,
amount: &BigUint<M>,
endpoint_name: &ManagedBuffer<M>,
arg_buffer: &ManagedArgBuffer<M>
) -> !
Sends an asynchronous call to another contract. Calling this method immediately terminates tx execution. Using it directly is generally discouraged. Read more
sourcefn deploy_contract<M: ManagedTypeApi>(
&self,
gas: u64,
amount: &BigUint<M>,
code: &ManagedBuffer<M>,
code_metadata: CodeMetadata,
arg_buffer: &ManagedArgBuffer<M>
) -> (ManagedAddress<M>, ManagedVec<M, ManagedBuffer<M>>)
fn deploy_contract<M: ManagedTypeApi>(
&self,
gas: u64,
amount: &BigUint<M>,
code: &ManagedBuffer<M>,
code_metadata: CodeMetadata,
arg_buffer: &ManagedArgBuffer<M>
) -> (ManagedAddress<M>, ManagedVec<M, ManagedBuffer<M>>)
Deploys a new contract in the same shard.
Unlike async_call_raw
, the deployment is synchronous and tx execution continues afterwards.
Also unlike async_call_raw
, it uses an argument buffer to pass arguments
If the deployment fails, Option::None is returned Read more
sourcefn deploy_from_source_contract<M: ManagedTypeApi>(
&self,
gas: u64,
amount: &BigUint<M>,
source_contract_address: &ManagedAddress<M>,
code_metadata: CodeMetadata,
arg_buffer: &ManagedArgBuffer<M>
) -> (ManagedAddress<M>, ManagedVec<M, ManagedBuffer<M>>)
fn deploy_from_source_contract<M: ManagedTypeApi>(
&self,
gas: u64,
amount: &BigUint<M>,
source_contract_address: &ManagedAddress<M>,
code_metadata: CodeMetadata,
arg_buffer: &ManagedArgBuffer<M>
) -> (ManagedAddress<M>, ManagedVec<M, ManagedBuffer<M>>)
Deploys a new contract in the same shard by re-using the code of an already deployed source contract. The deployment is done synchronously and the new contract’s address is returned. If the deployment fails, Option::None is returned Read more
fn upgrade_from_source_contract<M: ManagedTypeApi>(
&self,
sc_address: &ManagedAddress<M>,
gas: u64,
amount: &BigUint<M>,
source_contract_address: &ManagedAddress<M>,
code_metadata: CodeMetadata,
arg_buffer: &ManagedArgBuffer<M>
)
sourcefn upgrade_contract<M: ManagedTypeApi>(
&self,
sc_address: &ManagedAddress<M>,
gas: u64,
amount: &BigUint<M>,
code: &ManagedBuffer<M>,
code_metadata: CodeMetadata,
arg_buffer: &ManagedArgBuffer<M>
)
fn upgrade_contract<M: ManagedTypeApi>(
&self,
sc_address: &ManagedAddress<M>,
gas: u64,
amount: &BigUint<M>,
code: &ManagedBuffer<M>,
code_metadata: CodeMetadata,
arg_buffer: &ManagedArgBuffer<M>
)
Upgrades a child contract of the currently executing contract. The upgrade is synchronous, and the current transaction will fail if the upgrade fails. The child contract’s new init function will be called with the provided arguments Read more
sourcefn execute_on_dest_context_raw<M: ManagedTypeApi>(
&self,
gas: u64,
to: &ManagedAddress<M>,
amount: &BigUint<M>,
endpoint_name: &ManagedBuffer<M>,
arg_buffer: &ManagedArgBuffer<M>
) -> ManagedVec<M, ManagedBuffer<M>>
fn execute_on_dest_context_raw<M: ManagedTypeApi>(
&self,
gas: u64,
to: &ManagedAddress<M>,
amount: &BigUint<M>,
endpoint_name: &ManagedBuffer<M>,
arg_buffer: &ManagedArgBuffer<M>
) -> ManagedVec<M, ManagedBuffer<M>>
Same shard, in-line execution of another contract.
sourcefn execute_on_dest_context_raw_custom_result_range<M, F>(
&self,
gas: u64,
to: &ManagedAddress<M>,
amount: &BigUint<M>,
endpoint_name: &ManagedBuffer<M>,
arg_buffer: &ManagedArgBuffer<M>,
range_closure: F
) -> ManagedVec<M, ManagedBuffer<M>> where
M: ManagedTypeApi,
F: FnOnce(usize, usize) -> (usize, usize),
fn execute_on_dest_context_raw_custom_result_range<M, F>(
&self,
gas: u64,
to: &ManagedAddress<M>,
amount: &BigUint<M>,
endpoint_name: &ManagedBuffer<M>,
arg_buffer: &ManagedArgBuffer<M>,
range_closure: F
) -> ManagedVec<M, ManagedBuffer<M>> where
M: ManagedTypeApi,
F: FnOnce(usize, usize) -> (usize, usize),
Same shard, in-line execution of another contract.
Allows the contract to specify which result range to extract as sync call result.
This is a workaround to handle nested sync calls.
Please do not use this method unless there is absolutely no other option.
Will be eliminated after some future Arwen hook redesign.
range_closure
takes the number of results before, the number of results after,
and is expected to return the start index (inclusive) and end index (exclusive). Read more
fn execute_on_dest_context_by_caller_raw<M: ManagedTypeApi>(
&self,
gas: u64,
to: &ManagedAddress<M>,
amount: &BigUint<M>,
endpoint_name: &ManagedBuffer<M>,
arg_buffer: &ManagedArgBuffer<M>
) -> ManagedVec<M, ManagedBuffer<M>>
fn execute_on_same_context_raw<M: ManagedTypeApi>(
&self,
gas: u64,
to: &ManagedAddress<M>,
amount: &BigUint<M>,
endpoint_name: &ManagedBuffer<M>,
arg_buffer: &ManagedArgBuffer<M>
) -> ManagedVec<M, ManagedBuffer<M>>
fn execute_on_dest_context_readonly_raw<M: ManagedTypeApi>(
&self,
gas: u64,
to: &ManagedAddress<M>,
endpoint_name: &ManagedBuffer<M>,
arg_buffer: &ManagedArgBuffer<M>
) -> ManagedVec<M, ManagedBuffer<M>>
sourcefn storage_store_tx_hash_key<M: ManagedTypeApi>(&self, data: &ManagedBuffer<M>)
fn storage_store_tx_hash_key<M: ManagedTypeApi>(&self, data: &ManagedBuffer<M>)
Used to store data between async call and callback.
sourcefn storage_load_tx_hash_key<M: ManagedTypeApi>(&self) -> ManagedBuffer<M>
fn storage_load_tx_hash_key<M: ManagedTypeApi>(&self) -> ManagedBuffer<M>
Used to store data between async call and callback.
sourcefn call_local_esdt_built_in_function<M: ManagedTypeApi>(
&self,
gas: u64,
function_name: &ManagedBuffer<M>,
arg_buffer: &ManagedArgBuffer<M>
) -> ManagedVec<M, ManagedBuffer<M>>
fn call_local_esdt_built_in_function<M: ManagedTypeApi>(
&self,
gas: u64,
function_name: &ManagedBuffer<M>,
arg_buffer: &ManagedArgBuffer<M>
) -> ManagedVec<M, ManagedBuffer<M>>
Allows synchronously calling a local function by name. Execution is resumed afterwards. You should never have to call this function directly. Use the other specific methods instead. Read more
sourceimpl StaticVarApi for VmApiImpl
impl StaticVarApi for VmApiImpl
type StaticVarApiImpl = VmApiImpl
fn static_var_api_impl() -> Self::StaticVarApiImpl
sourceimpl StaticVarApiImpl for VmApiImpl
impl StaticVarApiImpl for VmApiImpl
fn with_lockable_static_buffer<R, F: FnOnce(&mut LockableStaticBuffer) -> R>(
&self,
f: F
) -> R
fn set_external_view_target_address_handle(&self, handle: Handle)
fn get_external_view_target_address_handle(&self) -> Handle
sourceimpl StorageReadApi for VmApiImpl
impl StorageReadApi for VmApiImpl
type StorageReadApiImpl = VmApiImpl
fn storage_read_api_impl() -> Self::StorageReadApiImpl
sourceimpl StorageReadApiImpl for VmApiImpl
impl StorageReadApiImpl for VmApiImpl
fn storage_load_len(&self, key: &[u8]) -> usize
fn storage_load_vec_u8(&self, key: &[u8]) -> Vec<u8>
fn storage_load_boxed_bytes(&self, key: &[u8]) -> BoxedBytes
fn storage_load_big_uint_raw(&self, key: &[u8]) -> i32
fn storage_load_managed_buffer_raw(&self, key_handle: Handle) -> Handle
fn storage_load_managed_buffer_len(&self, key_handle: Handle) -> usize
fn storage_load_u64(&self, key: &[u8]) -> u64
fn storage_load_i64(&self, key: &[u8]) -> i64
fn storage_load_from_address(
&self,
address_handle: Handle,
key_handle: Handle
) -> Handle
fn storage_read_api_init(&self)
sourceimpl StorageWriteApi for VmApiImpl
impl StorageWriteApi for VmApiImpl
type StorageWriteApiImpl = VmApiImpl
fn storage_write_api_impl() -> Self::StorageWriteApiImpl
sourceimpl StorageWriteApiImpl for VmApiImpl
impl StorageWriteApiImpl for VmApiImpl
fn storage_store_slice_u8(&self, key: &[u8], value: &[u8])
fn storage_store_big_uint_raw(&self, key: &[u8], handle: i32)
fn storage_store_managed_buffer_raw(
&self,
key_handle: Handle,
value_handle: Handle
)
fn storage_store_managed_buffer_clear(&self, key_handle: Handle)
fn storage_store_u64(&self, key: &[u8], value: u64)
fn storage_store_i64(&self, key: &[u8], value: i64)
sourceimpl VMApi for VmApiImpl
impl VMApi for VmApiImpl
fn has_location(location: EndpointLocationAbi) -> bool
fn init_static()
impl CallTypeApi for VmApiImpl
impl Eq for VmApiImpl
impl StorageMapperApi for VmApiImpl
Auto Trait Implementations
impl RefUnwindSafe for VmApiImpl
impl Send for VmApiImpl
impl Sync for VmApiImpl
impl Unpin for VmApiImpl
impl UnwindSafe for VmApiImpl
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more