pub struct InterfaceImpl {
config: ExecutionConfig,
context: Arc<Mutex<ExecutionContext>>,
}Expand description
an implementation of the Interface trait (see massa-sc-runtime crate)
Fields§
§config: ExecutionConfigexecution configuration
context: Arc<Mutex<ExecutionContext>>thread-safe shared access to the execution context (see context.rs)
Implementations§
source§impl InterfaceImpl
impl InterfaceImpl
sourcepub fn new(
config: ExecutionConfig,
context: Arc<Mutex<ExecutionContext>>,
) -> InterfaceImpl
pub fn new( config: ExecutionConfig, context: Arc<Mutex<ExecutionContext>>, ) -> InterfaceImpl
creates a new InterfaceImpl
§Arguments
config: execution configurationcontext: thread-safe shared access to the current execution context (see context.rs)
fn bypass_event_limitation(&self, call_stack: Vec<Address>) -> bool
Trait Implementations§
source§impl Clone for InterfaceImpl
impl Clone for InterfaceImpl
source§fn clone(&self) -> InterfaceImpl
fn clone(&self) -> InterfaceImpl
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Interface for InterfaceImpl
impl Interface for InterfaceImpl
Implementation of the Interface trait providing functions for massa-sc-runtime to call
in order to interact with the execution context during bytecode execution.
See the massa-sc-runtime crate for a functional description of the trait and its methods.
Note that massa-sc-runtime uses basic types (str for addresses, u64 for amounts…) for genericity.
source§fn print(&self, message: &str) -> Result<()>
fn print(&self, message: &str) -> Result<()>
prints a message in the node logs at log level 3 (debug)
source§fn init_call(&self, address: &str, raw_coins: u64) -> Result<Vec<u8>>
fn init_call(&self, address: &str, raw_coins: u64) -> Result<Vec<u8>>
Initialize the call when bytecode calls a function from another bytecode This function transfers the coins passed as parameter, prepares the current execution context by pushing a new element on the top of the call stack, and returns the target bytecode from the ledger.
§Arguments
address: string representation of the target address on which the bytecode will be calledraw_coins: raw representation (without decimal factor) of the amount of coins to transfer from the caller address to the target address at the beginning of the call
§Returns
The target bytecode or an error
source§fn finish_call(&self) -> Result<()>
fn finish_call(&self) -> Result<()>
Called to finish the call process after a bytecode calls a function from another one. This function just pops away the top element of the call stack.
source§fn get_module(&self, bytecode: &[u8], gas_limit: u64) -> Result<RuntimeModule>
fn get_module(&self, bytecode: &[u8], gas_limit: u64) -> Result<RuntimeModule>
Get the module from cache if possible, compile it if not
§Returns
A massa-sc-runtime CL compiled module & the remaining gas after loading the module
source§fn get_tmp_module(
&self,
bytecode: &[u8],
gas_limit: u64,
) -> Result<RuntimeModule>
fn get_tmp_module( &self, bytecode: &[u8], gas_limit: u64, ) -> Result<RuntimeModule>
Compile and return a temporary module
§Returns
A massa-sc-runtime SP compiled module & the remaining gas after loading the module
source§fn get_balance(&self) -> Result<u64>
fn get_balance(&self) -> Result<u64>
Gets the balance of the current address address (top of the stack).
§Returns
The raw representation (no decimal factor) of the balance of the address, or zero if the address is not found in the ledger.
[DeprecatedByNewRuntime] Replaced by get_balance_wasmv1
source§fn get_balance_for(&self, address: &str) -> Result<u64>
fn get_balance_for(&self, address: &str) -> Result<u64>
Gets the balance of arbitrary address passed as argument.
§Arguments
- address: string representation of the address for which to get the balance
§Returns
The raw representation (no decimal factor) of the balance of the address, or zero if the address is not found in the ledger.
[DeprecatedByNewRuntime] Replaced by get_balance_wasmv1
source§fn get_balance_wasmv1(&self, address: Option<String>) -> Result<NativeAmount>
fn get_balance_wasmv1(&self, address: Option<String>) -> Result<NativeAmount>
Gets the balance of arbitrary address passed as argument, or the balance of the current address if no argument is passed.
§Arguments
- address: string representation of the address for which to get the balance
§Returns
The raw representation (no decimal factor) of the balance of the address, or zero if the address is not found in the ledger.
source§fn create_module(&self, bytecode: &[u8]) -> Result<String>
fn create_module(&self, bytecode: &[u8]) -> Result<String>
source§fn get_keys(&self, prefix_opt: Option<&[u8]>) -> Result<BTreeSet<Vec<u8>>>
fn get_keys(&self, prefix_opt: Option<&[u8]>) -> Result<BTreeSet<Vec<u8>>>
Get the datastore keys (aka entries) for a given address
§Returns
A list of keys (keys are byte arrays)
[DeprecatedByNewRuntime] Replaced by get_keys_wasmv1
source§fn get_keys_for(
&self,
address: &str,
prefix_opt: Option<&[u8]>,
) -> Result<BTreeSet<Vec<u8>>>
fn get_keys_for( &self, address: &str, prefix_opt: Option<&[u8]>, ) -> Result<BTreeSet<Vec<u8>>>
Get the datastore keys (aka entries) for a given address
§Returns
A list of keys (keys are byte arrays)
[DeprecatedByNewRuntime] Replaced by get_keys_wasmv1
source§fn get_ds_keys_wasmv1(
&self,
prefix: &[u8],
address: Option<String>,
) -> Result<BTreeSet<Vec<u8>>>
fn get_ds_keys_wasmv1( &self, prefix: &[u8], address: Option<String>, ) -> Result<BTreeSet<Vec<u8>>>
Get the datastore keys (aka entries) for a given address, or the current address if none is provided
§Returns
A list of keys (keys are byte arrays)
source§fn raw_get_data_for(&self, address: &str, key: &[u8]) -> Result<Vec<u8>>
fn raw_get_data_for(&self, address: &str, key: &[u8]) -> Result<Vec<u8>>
Gets a datastore value by key for a given address.
§Arguments
- address: string representation of the address
- key: string key of the datastore entry to retrieve
§Returns
The datastore value matching the provided key, if found, otherwise an error.
[DeprecatedByNewRuntime] Replaced by raw_get_data_wasmv1
source§fn raw_set_data(&self, key: &[u8], value: &[u8]) -> Result<()>
fn raw_set_data(&self, key: &[u8], value: &[u8]) -> Result<()>
Sets a datastore entry for the current address (top of the call stack). Fails if the address does not exist. Creates the entry if does not exist.
§Arguments
- address: string representation of the address
- key: string key of the datastore entry to set
- value: new value to set
[DeprecatedByNewRuntime] Replaced by raw_set_data_wasmv1
source§fn raw_set_data_for(
&self,
address: &str,
key: &[u8],
value: &[u8],
) -> Result<()>
fn raw_set_data_for( &self, address: &str, key: &[u8], value: &[u8], ) -> Result<()>
Sets a datastore entry for a given address. Fails if the address does not exist. Creates the entry if it does not exist.
§Arguments
- address: string representation of the address
- key: string key of the datastore entry to set
- value: new value to set
[DeprecatedByNewRuntime] Replaced by raw_set_data_wasmv1
source§fn raw_append_data(&self, key: &[u8], value: &[u8]) -> Result<()>
fn raw_append_data(&self, key: &[u8], value: &[u8]) -> Result<()>
Appends data to a datastore entry for the current address (top of the call stack). Fails if the address or entry does not exist.
§Arguments
- key: string key of the datastore entry
- value: value to append
[DeprecatedByNewRuntime] Replaced by raw_append_data_wasmv1
source§fn raw_append_data_for(
&self,
address: &str,
key: &[u8],
value: &[u8],
) -> Result<()>
fn raw_append_data_for( &self, address: &str, key: &[u8], value: &[u8], ) -> Result<()>
Appends a value to a datastore entry for a given address. Fails if the entry or address does not exist.
§Arguments
- address: string representation of the address
- key: string key of the datastore entry
- value: value to append
[DeprecatedByNewRuntime] Replaced by raw_append_data_wasmv1
source§fn append_ds_value_wasmv1(
&self,
key: &[u8],
value: &[u8],
address: Option<String>,
) -> Result<()>
fn append_ds_value_wasmv1( &self, key: &[u8], value: &[u8], address: Option<String>, ) -> Result<()>
Appends a value to a datastore entry for a given address, or the current address if none is provided Fails if the entry or address does not exist.
§Arguments
- address: string representation of the address
- key: string key of the datastore entry
- value: value to append
source§fn raw_delete_data(&self, key: &[u8]) -> Result<()>
fn raw_delete_data(&self, key: &[u8]) -> Result<()>
Deletes a datastore entry by key for the current address (top of the call stack). Fails if the address or entry does not exist.
§Arguments
- key: string key of the datastore entry to delete
[DeprecatedByNewRuntime] Replaced by raw_delete_data_wasmv1
source§fn raw_delete_data_for(&self, address: &str, key: &[u8]) -> Result<()>
fn raw_delete_data_for(&self, address: &str, key: &[u8]) -> Result<()>
Deletes a datastore entry by key for a given address. Fails if the address or entry does not exist.
§Arguments
- address: string representation of the address
- key: string key of the datastore entry to delete
[DeprecatedByNewRuntime] Replaced by raw_delete_data_wasmv1
source§fn delete_ds_entry_wasmv1(
&self,
key: &[u8],
address: Option<String>,
) -> Result<()>
fn delete_ds_entry_wasmv1( &self, key: &[u8], address: Option<String>, ) -> Result<()>
Deletes a datastore entry by key for a given address, or the current address if none is provided. Fails if the address or entry does not exist.
§Arguments
- address: string representation of the address
- key: string key of the datastore entry to delete
source§fn has_data(&self, key: &[u8]) -> Result<bool>
fn has_data(&self, key: &[u8]) -> Result<bool>
Checks if a datastore entry exists for the current address (top of the call stack).
§Arguments
- key: string key of the datastore entry to retrieve
§Returns
true if the address exists and has the entry matching the provided key in its datastore, otherwise false
[DeprecatedByNewRuntime] Replaced by has_data_wasmv1
source§fn has_data_for(&self, address: &str, key: &[u8]) -> Result<bool>
fn has_data_for(&self, address: &str, key: &[u8]) -> Result<bool>
Checks if a datastore entry exists for a given address.
§Arguments
- address: string representation of the address
- key: string key of the datastore entry to retrieve
§Returns
true if the address exists and has the entry matching the provided key in its datastore, otherwise false
[DeprecatedByNewRuntime] Replaced by has_data_wasmv1
source§fn ds_entry_exists_wasmv1(
&self,
key: &[u8],
address: Option<String>,
) -> Result<bool>
fn ds_entry_exists_wasmv1( &self, key: &[u8], address: Option<String>, ) -> Result<bool>
Checks if a datastore entry exists for a given address, or the current address if none is provided.
§Arguments
- address: string representation of the address
- key: string key of the datastore entry to retrieve
§Returns
true if the address exists and has the entry matching the provided key in its datastore, otherwise false
source§fn caller_has_write_access(&self) -> Result<bool>
fn caller_has_write_access(&self) -> Result<bool>
Check whether or not the caller has write access in the current context
§Returns
true if the caller has write access
source§fn raw_get_bytecode(&self) -> Result<Vec<u8>>
fn raw_get_bytecode(&self) -> Result<Vec<u8>>
Returns bytecode of the current address
[DeprecatedByNewRuntime] Replaced by raw_get_bytecode_wasmv1
source§fn raw_get_bytecode_for(&self, address: &str) -> Result<Vec<u8>>
fn raw_get_bytecode_for(&self, address: &str) -> Result<Vec<u8>>
Returns bytecode of the target address
[DeprecatedByNewRuntime] Replaced by raw_get_bytecode_wasmv1
source§fn get_bytecode_wasmv1(&self, address: Option<String>) -> Result<Vec<u8>>
fn get_bytecode_wasmv1(&self, address: Option<String>) -> Result<Vec<u8>>
Returns bytecode of the target address, or the current address if not provided
source§fn get_op_keys(&self, prefix_opt: Option<&[u8]>) -> Result<Vec<Vec<u8>>>
fn get_op_keys(&self, prefix_opt: Option<&[u8]>) -> Result<Vec<Vec<u8>>>
Get the operation datastore keys (aka entries). Note that the datastore is only accessible to the initial caller level.
§Returns
A list of keys (keys are byte arrays)
[DeprecatedByNewRuntime] Replaced by get_op_keys_wasmv1
source§fn get_op_keys_wasmv1(&self, prefix: &[u8]) -> Result<Vec<Vec<u8>>>
fn get_op_keys_wasmv1(&self, prefix: &[u8]) -> Result<Vec<Vec<u8>>>
Get the operation datastore keys (aka entries). Note that the datastore is only accessible to the initial caller level.
§Returns
A list of keys (keys are byte arrays) that match the given prefix
source§fn op_entry_exists(&self, key: &[u8]) -> Result<bool>
fn op_entry_exists(&self, key: &[u8]) -> Result<bool>
Checks if an operation datastore entry exists in the operation datastore. Note that the datastore is only accessible to the initial caller level.
§Arguments
- key: byte array key of the datastore entry to retrieve
§Returns
true if the entry is matching the provided key in its operation datastore, otherwise false
source§fn address_from_public_key(&self, public_key: &str) -> Result<String>
fn address_from_public_key(&self, public_key: &str) -> Result<String>
source§fn signature_verify(
&self,
data: &[u8],
signature: &str,
public_key: &str,
) -> Result<bool>
fn signature_verify( &self, data: &[u8], signature: &str, public_key: &str, ) -> Result<bool>
source§fn evm_signature_verify(
&self,
message_: &[u8],
signature_: &[u8],
public_key_: &[u8],
) -> Result<bool>
fn evm_signature_verify( &self, message_: &[u8], signature_: &[u8], public_key_: &[u8], ) -> Result<bool>
Verify an EVM signature
Information:
- Expects a SECP256K1 signature in full ETH format. Format: (r, s, v) v will be ignored Length: 65 bytes
- Expects a public key in raw secp256k1 format. Length: 64 bytes
source§fn evm_get_address_from_pubkey(&self, public_key_: &[u8]) -> Result<Vec<u8>>
fn evm_get_address_from_pubkey(&self, public_key_: &[u8]) -> Result<Vec<u8>>
Get an EVM address from a raw secp256k1 public key (64 bytes). Address is the last 20 bytes of the hash of the public key.
source§fn evm_get_pubkey_from_signature(
&self,
hash_: &[u8],
signature_: &[u8],
) -> Result<Vec<u8>>
fn evm_get_pubkey_from_signature( &self, hash_: &[u8], signature_: &[u8], ) -> Result<Vec<u8>>
Get a raw secp256k1 public key from an EVM signature and the signed hash.
source§fn transfer_coins(&self, to_address: &str, raw_amount: u64) -> Result<()>
fn transfer_coins(&self, to_address: &str, raw_amount: u64) -> Result<()>
Transfer coins from the current address (top of the call stack) towards a target address.
§Arguments
to_address: string representation of the address to which the coins are sentraw_amount: raw representation (no decimal factor) of the amount of coins to transfer
[DeprecatedByNewRuntime] Replaced by transfer_coins_wasmv1
source§fn transfer_coins_for(
&self,
from_address: &str,
to_address: &str,
raw_amount: u64,
) -> Result<()>
fn transfer_coins_for( &self, from_address: &str, to_address: &str, raw_amount: u64, ) -> Result<()>
Transfer coins from a given address towards a target address.
§Arguments
from_address: string representation of the address that is sending the coinsto_address: string representation of the address to which the coins are sentraw_amount: raw representation (no decimal factor) of the amount of coins to transfer
[DeprecatedByNewRuntime] Replaced by transfer_coins_wasmv1
source§fn transfer_coins_wasmv1(
&self,
to_address: String,
raw_amount: NativeAmount,
from_address: Option<String>,
) -> Result<()>
fn transfer_coins_wasmv1( &self, to_address: String, raw_amount: NativeAmount, from_address: Option<String>, ) -> Result<()>
Transfer coins from a given address (or the current address if not specified) towards a target address.
§Arguments
to_address: string representation of the address to which the coins are sentraw_amount: raw representation (no decimal factor) of the amount of coins to transferfrom_address: string representation of the address that is sending the coins
source§fn get_owned_addresses(&self) -> Result<Vec<String>>
fn get_owned_addresses(&self) -> Result<Vec<String>>
Returns the list of owned addresses (top of the call stack). Those addresses are the ones the current execution context has write access to, typically it includes the current address itself, but also the ones that were created previously by the current call to allow initializing them.
§Returns
A vector with the string representation of each owned address. Note that the ordering of this vector is deterministic and conserved.
source§fn get_call_stack(&self) -> Result<Vec<String>>
fn get_call_stack(&self) -> Result<Vec<String>>
Returns the addresses in the call stack, from the bottom to the top.
§Returns
A vector with the string representation of each call stack address.
source§fn get_call_coins(&self) -> Result<u64>
fn get_call_coins(&self) -> Result<u64>
Gets the amount of coins that have been transferred at the beginning of the call.
See the init_call method.
§Returns
The raw representation (no decimal factor) of the amount of coins
[DeprecatedByNewRuntime] Replaced by get_call_coins_wasmv1
source§fn get_call_coins_wasmv1(&self) -> Result<NativeAmount>
fn get_call_coins_wasmv1(&self) -> Result<NativeAmount>
Gets the amount of coins that have been transferred at the beginning of the call.
See the init_call method.
§Returns
The amount of coins
source§fn generate_event(&self, data: String) -> Result<()>
fn generate_event(&self, data: String) -> Result<()>
Emits an execution event to be stored.
§Arguments:
data: the string data that is the payload of the event
source§fn generate_event_wasmv1(&self, data: Vec<u8>) -> Result<()>
fn generate_event_wasmv1(&self, data: Vec<u8>) -> Result<()>
Emits an execution event to be stored.
§Arguments:
data: the bytes_array data that is the payload of the event
source§fn get_time(&self) -> Result<u64>
fn get_time(&self) -> Result<u64>
Returns the current time (millisecond UNIX timestamp) Note that in order to ensure determinism, this is actually the time of the context slot.
source§fn unsafe_random(&self) -> Result<i64>
fn unsafe_random(&self) -> Result<i64>
Returns a pseudo-random deterministic i64 number
§Warning
This random number generator is unsafe: it can be both predicted and manipulated before the execution
[DeprecatedByNewRuntime] Replaced by unsafe_random_wasmv1
source§fn unsafe_random_f64(&self) -> Result<f64>
fn unsafe_random_f64(&self) -> Result<f64>
Returns a pseudo-random deterministic f64 number
§Warning
This random number generator is unsafe: it can be both predicted and manipulated before the execution
[DeprecatedByNewRuntime] Replaced by unsafe_random_wasmv1
source§fn unsafe_random_wasmv1(&self, num_bytes: u64) -> Result<Vec<u8>>
fn unsafe_random_wasmv1(&self, num_bytes: u64) -> Result<Vec<u8>>
Returns a pseudo-random deterministic byte array, with the given number of bytes
§Warning
This random number generator is unsafe: it can be both predicted and manipulated before the execution
source§fn send_message(
&self,
target_address: &str,
target_function: &str,
validity_start: (u64, u8),
validity_end: (u64, u8),
max_gas: u64,
raw_fee: u64,
raw_coins: u64,
data: &[u8],
filter: Option<(&str, Option<&[u8]>)>,
) -> Result<()>
fn send_message( &self, target_address: &str, target_function: &str, validity_start: (u64, u8), validity_end: (u64, u8), max_gas: u64, raw_fee: u64, raw_coins: u64, data: &[u8], filter: Option<(&str, Option<&[u8]>)>, ) -> Result<()>
Adds an asynchronous message to the context speculative asynchronous pool
§Arguments
target_address: Destination address hash in format stringtarget_function: Name of the message handling functionvalidity_start: Tuple containing the period and thread of the validity start slotvalidity_end: Tuple containing the period and thread of the validity end slotmax_gas: Maximum gas for the message executionfee: Fee to payraw_coins: Coins given by the senderdata: Message data
source§fn get_current_period(&self) -> Result<u64>
fn get_current_period(&self) -> Result<u64>
Returns the period of the current execution slot
[DeprecatedByNewRuntime] Replaced by get_current_slot
source§fn get_current_thread(&self) -> Result<u8>
fn get_current_thread(&self) -> Result<u8>
Returns the thread of the current execution slot
[DeprecatedByNewRuntime] Replaced by get_current_slot
source§fn get_current_slot(&self) -> Result<Slot>
fn get_current_slot(&self) -> Result<Slot>
Returns the current execution slot
source§fn raw_set_bytecode(&self, bytecode: &[u8]) -> Result<()>
fn raw_set_bytecode(&self, bytecode: &[u8]) -> Result<()>
Sets the bytecode of the current address
[DeprecatedByNewRuntime] Replaced by raw_set_bytecode_wasmv1
source§fn raw_set_bytecode_for(&self, address: &str, bytecode: &[u8]) -> Result<()>
fn raw_set_bytecode_for(&self, address: &str, bytecode: &[u8]) -> Result<()>
Sets the bytecode of an arbitrary address. Fails if the address does not exist, is an user address, or if the context doesn’t have write access rights on it.
[DeprecatedByNewRuntime] Replaced by raw_set_bytecode_wasmv1
source§fn set_bytecode_wasmv1(
&self,
bytecode: &[u8],
address: Option<String>,
) -> Result<()>
fn set_bytecode_wasmv1( &self, bytecode: &[u8], address: Option<String>, ) -> Result<()>
Sets the bytecode of an arbitrary address, or the current address if not provided. Fails if the address does not exist, is an user address, or if the context doesn’t have write access rights on it.
source§fn get_deferred_call_quote(
&self,
target_slot: (u64, u8),
gas_limit: u64,
params_size: u64,
) -> Result<(bool, u64)>
fn get_deferred_call_quote( &self, target_slot: (u64, u8), gas_limit: u64, params_size: u64, ) -> Result<(bool, u64)>
source§fn deferred_call_register(
&self,
target_addr: &str,
target_func: &str,
target_slot: (u64, u8),
max_gas: u64,
params: &[u8],
coins: u64,
) -> Result<String>
fn deferred_call_register( &self, target_addr: &str, target_func: &str, target_slot: (u64, u8), max_gas: u64, params: &[u8], coins: u64, ) -> Result<String>
Register deferred call
§Arguments
- target_addr: string representation of the target address
- target_func: string representation of the target function
- target_slot: tuple containing the period and thread of the target slot
- max_gas: the gas limit for the call
- coins: the amount of coins to send
- params: byte array of the parameters
§Returns
The id of the call
source§fn deferred_call_exists(&self, id: &str) -> Result<bool>
fn deferred_call_exists(&self, id: &str) -> Result<bool>
source§fn deferred_call_cancel(&self, id: &str) -> Result<()>
fn deferred_call_cancel(&self, id: &str) -> Result<()>
source§fn native_amount_from_str_wasmv1(&self, amount: &str) -> Result<NativeAmount>
fn native_amount_from_str_wasmv1(&self, amount: &str) -> Result<NativeAmount>
Returns a NativeAmount from a string
source§fn native_amount_to_string_wasmv1(
&self,
amount: &NativeAmount,
) -> Result<String>
fn native_amount_to_string_wasmv1( &self, amount: &NativeAmount, ) -> Result<String>
Returns a string from a NativeAmount
source§fn check_native_amount_wasmv1(&self, amount: &NativeAmount) -> Result<bool>
fn check_native_amount_wasmv1(&self, amount: &NativeAmount) -> Result<bool>
Checks if the given native amount is valid
source§fn add_native_amount_wasmv1(
&self,
amount1: &NativeAmount,
amount2: &NativeAmount,
) -> Result<NativeAmount>
fn add_native_amount_wasmv1( &self, amount1: &NativeAmount, amount2: &NativeAmount, ) -> Result<NativeAmount>
Adds two native amounts, saturating at the numeric bounds instead of overflowing.
source§fn sub_native_amount_wasmv1(
&self,
amount1: &NativeAmount,
amount2: &NativeAmount,
) -> Result<NativeAmount>
fn sub_native_amount_wasmv1( &self, amount1: &NativeAmount, amount2: &NativeAmount, ) -> Result<NativeAmount>
Subtracts two native amounts, saturating at the numeric bounds instead of overflowing.
source§fn scalar_mul_native_amount_wasmv1(
&self,
amount: &NativeAmount,
factor: u64,
) -> Result<NativeAmount>
fn scalar_mul_native_amount_wasmv1( &self, amount: &NativeAmount, factor: u64, ) -> Result<NativeAmount>
Multiplies a native amount by a factor, saturating at the numeric bounds instead of overflowing.
source§fn scalar_div_rem_native_amount_wasmv1(
&self,
dividend: &NativeAmount,
divisor: u64,
) -> Result<(NativeAmount, NativeAmount)>
fn scalar_div_rem_native_amount_wasmv1( &self, dividend: &NativeAmount, divisor: u64, ) -> Result<(NativeAmount, NativeAmount)>
Divides a native amount by a divisor, return an error if the divisor is 0.
source§fn div_rem_native_amount_wasmv1(
&self,
dividend: &NativeAmount,
divisor: &NativeAmount,
) -> Result<(u64, NativeAmount)>
fn div_rem_native_amount_wasmv1( &self, dividend: &NativeAmount, divisor: &NativeAmount, ) -> Result<(u64, NativeAmount)>
Divides a native amount by a divisor, return an error if the divisor is 0.
source§fn save_gas_remaining_before_subexecution(&self, gas_remaining: u64)
fn save_gas_remaining_before_subexecution(&self, gas_remaining: u64)
Try to get a write lock on the execution context then set the
gas_used_until_the_last_subexecution field to the given gas_remaining value.
If the context is locked, this function does nothing but log a warning.
fn get_interface_version(&self) -> Result<u32>
fn increment_recursion_counter(&self) -> Result<()>
fn decrement_recursion_counter(&self) -> Result<()>
fn set_ds_value_wasmv1( &self, key: &[u8], value: &[u8], address: Option<String>, ) -> Result<()>
source§fn validate_address(&self, address: &str) -> Result<bool>
fn validate_address(&self, address: &str) -> Result<bool>
source§fn is_address_eoa(&self, address_: &str) -> Result<bool>
fn is_address_eoa(&self, address_: &str) -> Result<bool>
fn get_origin_operation_id(&self) -> Result<Option<String>>
source§fn init_call_wasmv1(
&self,
address: &str,
raw_coins: NativeAmount,
) -> Result<Vec<u8>>
fn init_call_wasmv1( &self, address: &str, raw_coins: NativeAmount, ) -> Result<Vec<u8>>
fn base58_check_to_bytes_wasmv1(&self, s: &str) -> Result<Vec<u8>>
fn bytes_to_base58_check_wasmv1(&self, data: &[u8]) -> String
fn check_address_wasmv1(&self, to_check: &str) -> Result<bool>
fn check_pubkey_wasmv1(&self, to_check: &str) -> Result<bool>
fn check_signature_wasmv1(&self, to_check: &str) -> Result<bool>
fn get_address_category_wasmv1(&self, to_check: &str) -> Result<AddressCategory>
fn get_address_version_wasmv1(&self, address: &str) -> Result<u64>
fn get_pubkey_version_wasmv1(&self, pubkey: &str) -> Result<u64>
fn get_signature_version_wasmv1(&self, signature: &str) -> Result<u64>
fn checked_add_native_time_wasmv1( &self, time1: &NativeTime, time2: &NativeTime, ) -> Result<NativeTime>
fn checked_sub_native_time_wasmv1( &self, time1: &NativeTime, time2: &NativeTime, ) -> Result<NativeTime>
fn checked_mul_native_time_wasmv1( &self, time: &NativeTime, factor: u64, ) -> Result<NativeTime>
fn checked_scalar_div_native_time_wasmv1( &self, dividend: &NativeTime, divisor: u64, ) -> Result<(NativeTime, NativeTime)>
fn checked_div_native_time_wasmv1( &self, dividend: &NativeTime, divisor: &NativeTime, ) -> Result<(u64, NativeTime)>
fn compare_address_wasmv1( &self, left: &str, right: &str, ) -> Result<ComparisonResult>
fn compare_native_amount_wasmv1( &self, left: &NativeAmount, right: &NativeAmount, ) -> Result<ComparisonResult>
fn compare_native_time_wasmv1( &self, left: &NativeTime, right: &NativeTime, ) -> Result<ComparisonResult>
fn compare_pub_key_wasmv1( &self, left: &str, right: &str, ) -> Result<ComparisonResult>
fn chain_id(&self) -> Result<u64>
Auto Trait Implementations§
impl Freeze for InterfaceImpl
impl !RefUnwindSafe for InterfaceImpl
impl Send for InterfaceImpl
impl Sync for InterfaceImpl
impl Unpin for InterfaceImpl
impl !UnwindSafe for InterfaceImpl
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)§impl<T> Conv for T
impl<T> Conv for T
§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
§fn deserialize(
&self,
deserializer: &mut D,
) -> Result<With<T, W>, <D as Fallible>::Error>
fn deserialize( &self, deserializer: &mut D, ) -> Result<With<T, W>, <D as Fallible>::Error>
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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 moresource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.