Struct elrond_wasm_node::VmApiImpl [−][src]
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
fn get_block_random_seed_legacy(&self) -> Box<[u8; 48]>ⓘ
fn get_prev_block_random_seed_legacy(&self) -> Box<[u8; 48]>ⓘ
fn get_esdt_balance(
&self,
m_address: &ManagedAddress<Self>,
token: &TokenIdentifier<Self>,
nonce: u64
) -> BigUint<Self>
fn get_esdt_token_data(
&self,
address: &ManagedAddress<Self>,
token: &TokenIdentifier<Self>,
nonce: u64
) -> EsdtTokenData<Self>
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
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
Returns the call value token identifier of the current call. The identifier is wrapped in a TokenIdentifier object, to hide underlying logic. Read more
Returns the nonce of the received ESDT token. Will return 0 in case of EGLD or fungible ESDT transfer. Read more
Returns the ESDT token type. Will return “Fungible” for EGLD. Read more
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
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
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
Should be no-op. The API implementation is zero-sized.
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_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
Interface to only be used by code generated by the macros. The smart contract code doesn’t have access to these methods directly.
Interface to only be used by code generated by the macros. The smart contract code doesn’t have access to these methods directly.
Interface to only be used by code generated by the macros. The smart contract code doesn’t have access to these methods directly.
The legacy Arwen hook for saving event logs. It does the same, but only accepts 32-byte topics. Only kept for backwards compatibility. Read more
fn 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.
fn 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 direct_egld<D>(
&self,
to: &ManagedAddress<Self>,
amount: &BigUint<Self>,
data: D
) where
D: ManagedInto<Self, ManagedBuffer<Self>>,
fn direct_egld<D>(
&self,
to: &ManagedAddress<Self>,
amount: &BigUint<Self>,
data: D
) where
D: ManagedInto<Self, ManagedBuffer<Self>>,
Sends EGLD to a given address, directly. Used especially for sending EGLD to regular accounts. Read more
fn direct_egld_execute(
&self,
to: &ManagedAddress<Self>,
amount: &BigUint<Self>,
gas_limit: u64,
endpoint_name: &ManagedBuffer<Self>,
arg_buffer: &ManagedArgBuffer<Self>
) -> Result<(), &'static [u8]>
fn direct_egld_execute(
&self,
to: &ManagedAddress<Self>,
amount: &BigUint<Self>,
gas_limit: u64,
endpoint_name: &ManagedBuffer<Self>,
arg_buffer: &ManagedArgBuffer<Self>
) -> Result<(), &'static [u8]>
Sends EGLD to an address (optionally) and executes like an async call, but without callback.
fn direct_esdt_execute(
&self,
to: &ManagedAddress<Self>,
token: &TokenIdentifier<Self>,
amount: &BigUint<Self>,
gas_limit: u64,
endpoint_name: &ManagedBuffer<Self>,
arg_buffer: &ManagedArgBuffer<Self>
) -> Result<(), &'static [u8]>
fn direct_esdt_execute(
&self,
to: &ManagedAddress<Self>,
token: &TokenIdentifier<Self>,
amount: &BigUint<Self>,
gas_limit: u64,
endpoint_name: &ManagedBuffer<Self>,
arg_buffer: &ManagedArgBuffer<Self>
) -> Result<(), &'static [u8]>
Sends ESDT to an address and executes like an async call, but without callback.
fn direct_esdt_nft_execute(
&self,
to: &ManagedAddress<Self>,
token: &TokenIdentifier<Self>,
nonce: u64,
amount: &BigUint<Self>,
gas_limit: u64,
endpoint_name: &ManagedBuffer<Self>,
arg_buffer: &ManagedArgBuffer<Self>
) -> Result<(), &'static [u8]>
fn direct_esdt_nft_execute(
&self,
to: &ManagedAddress<Self>,
token: &TokenIdentifier<Self>,
nonce: u64,
amount: &BigUint<Self>,
gas_limit: u64,
endpoint_name: &ManagedBuffer<Self>,
arg_buffer: &ManagedArgBuffer<Self>
) -> Result<(), &'static [u8]>
Sends ESDT NFT to an address and executes like an async call, but without callback.
fn direct_multi_esdt_transfer_execute(
&self,
to: &ManagedAddress<Self>,
payments: &ManagedVec<Self, EsdtTokenPayment<Self>>,
gas_limit: u64,
endpoint_name: &ManagedBuffer<Self>,
arg_buffer: &ManagedArgBuffer<Self>
) -> Result<(), &'static [u8]>
fn async_call_raw(
&self,
to: &ManagedAddress<Self>,
amount: &BigUint<Self>,
endpoint_name: &ManagedBuffer<Self>,
arg_buffer: &ManagedArgBuffer<Self>
) -> !
fn async_call_raw(
&self,
to: &ManagedAddress<Self>,
amount: &BigUint<Self>,
endpoint_name: &ManagedBuffer<Self>,
arg_buffer: &ManagedArgBuffer<Self>
) -> !
Sends an asynchronous call to another contract. Calling this method immediately terminates tx execution. Using it directly is generally discouraged. Read more
fn deploy_contract(
&self,
gas: u64,
amount: &BigUint<Self>,
code: &ManagedBuffer<Self>,
code_metadata: CodeMetadata,
arg_buffer: &ManagedArgBuffer<Self>
) -> (ManagedAddress<Self>, ManagedVec<Self, ManagedBuffer<Self>>)
fn deploy_contract(
&self,
gas: u64,
amount: &BigUint<Self>,
code: &ManagedBuffer<Self>,
code_metadata: CodeMetadata,
arg_buffer: &ManagedArgBuffer<Self>
) -> (ManagedAddress<Self>, ManagedVec<Self, ManagedBuffer<Self>>)
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
fn deploy_from_source_contract(
&self,
gas: u64,
amount: &BigUint<Self>,
source_contract_address: &ManagedAddress<Self>,
code_metadata: CodeMetadata,
arg_buffer: &ManagedArgBuffer<Self>
) -> (ManagedAddress<Self>, ManagedVec<Self, ManagedBuffer<Self>>)
fn deploy_from_source_contract(
&self,
gas: u64,
amount: &BigUint<Self>,
source_contract_address: &ManagedAddress<Self>,
code_metadata: CodeMetadata,
arg_buffer: &ManagedArgBuffer<Self>
) -> (ManagedAddress<Self>, ManagedVec<Self, ManagedBuffer<Self>>)
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(
&self,
sc_address: &ManagedAddress<Self>,
gas: u64,
amount: &BigUint<Self>,
source_contract_address: &ManagedAddress<Self>,
code_metadata: CodeMetadata,
arg_buffer: &ManagedArgBuffer<Self>
)
fn upgrade_contract(
&self,
sc_address: &ManagedAddress<Self>,
gas: u64,
amount: &BigUint<Self>,
code: &ManagedBuffer<Self>,
code_metadata: CodeMetadata,
arg_buffer: &ManagedArgBuffer<Self>
)
fn upgrade_contract(
&self,
sc_address: &ManagedAddress<Self>,
gas: u64,
amount: &BigUint<Self>,
code: &ManagedBuffer<Self>,
code_metadata: CodeMetadata,
arg_buffer: &ManagedArgBuffer<Self>
)
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
fn execute_on_dest_context_raw(
&self,
gas: u64,
to: &ManagedAddress<Self>,
amount: &BigUint<Self>,
endpoint_name: &ManagedBuffer<Self>,
arg_buffer: &ManagedArgBuffer<Self>
) -> ManagedVec<Self, ManagedBuffer<Self>>
fn execute_on_dest_context_raw(
&self,
gas: u64,
to: &ManagedAddress<Self>,
amount: &BigUint<Self>,
endpoint_name: &ManagedBuffer<Self>,
arg_buffer: &ManagedArgBuffer<Self>
) -> ManagedVec<Self, ManagedBuffer<Self>>
Same shard, in-line execution of another contract.
fn execute_on_dest_context_raw_custom_result_range<F>(
&self,
gas: u64,
to: &ManagedAddress<Self>,
amount: &BigUint<Self>,
endpoint_name: &ManagedBuffer<Self>,
arg_buffer: &ManagedArgBuffer<Self>,
range_closure: F
) -> ManagedVec<Self, ManagedBuffer<Self>> where
F: FnOnce(usize, usize) -> (usize, usize),
fn execute_on_dest_context_raw_custom_result_range<F>(
&self,
gas: u64,
to: &ManagedAddress<Self>,
amount: &BigUint<Self>,
endpoint_name: &ManagedBuffer<Self>,
arg_buffer: &ManagedArgBuffer<Self>,
range_closure: F
) -> ManagedVec<Self, ManagedBuffer<Self>> where
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(
&self,
gas: u64,
to: &ManagedAddress<Self>,
amount: &BigUint<Self>,
endpoint_name: &ManagedBuffer<Self>,
arg_buffer: &ManagedArgBuffer<Self>
) -> ManagedVec<Self, ManagedBuffer<Self>>
fn execute_on_same_context_raw(
&self,
gas: u64,
to: &ManagedAddress<Self>,
amount: &BigUint<Self>,
endpoint_name: &ManagedBuffer<Self>,
arg_buffer: &ManagedArgBuffer<Self>
) -> ManagedVec<Self, ManagedBuffer<Self>>
fn execute_on_dest_context_readonly_raw(
&self,
gas: u64,
to: &ManagedAddress<Self>,
endpoint_name: &ManagedBuffer<Self>,
arg_buffer: &ManagedArgBuffer<Self>
) -> ManagedVec<Self, ManagedBuffer<Self>>
Used to store data between async call and callback.
Used to store data between async call and callback.
fn call_local_esdt_built_in_function(
&self,
gas: u64,
function_name: &ManagedBuffer<Self>,
arg_buffer: &ManagedArgBuffer<Self>
) -> ManagedVec<Self, ManagedBuffer<Self>>
fn call_local_esdt_built_in_function(
&self,
gas: u64,
function_name: &ManagedBuffer<Self>,
arg_buffer: &ManagedArgBuffer<Self>
) -> ManagedVec<Self, ManagedBuffer<Self>>
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
Auto Trait Implementations
impl RefUnwindSafe for VmApiImpl
impl UnwindSafe for VmApiImpl
Blanket Implementations
Mutably borrows from an owned value. Read more