Struct soroban_env_host::Host
source · pub struct Host(/* private fields */);
Implementations§
source§impl Host
impl Host
pub fn scaddress_from_address( &self, address: AddressObject ) -> Result<ScAddress, HostError>
source§impl Host
impl Host
pub fn add_ledger_entry( &self, key: &Rc<LedgerKey>, val: &Rc<LedgerEntry>, live_until_ledger: Option<u32> ) -> Result<(), HostError>
pub fn setup_storage_entry( &self, key: Rc<LedgerKey>, val: Option<(Rc<LedgerEntry>, Option<u32>)>, access_type: AccessType ) -> Result<(), HostError>
pub fn setup_storage_footprint( &self, footprint: Footprint ) -> Result<(), HostError>
source§impl Host
impl Host
sourcepub fn has_frame(&self) -> Result<bool, HostError>
pub fn has_frame(&self) -> Result<bool, HostError>
Returns if the host currently has a frame on the stack.
A frame being on the stack usually indicates that a contract is currently executing, or is in a state just-before or just-after executing.
sourcepub fn with_test_contract_frame<F>(
&self,
id: Hash,
func: Symbol,
f: F
) -> Result<Val, HostError>
pub fn with_test_contract_frame<F>( &self, id: Hash, func: Symbol, f: F ) -> Result<Val, HostError>
Pushes a test contract [Frame
], runs a closure, and then pops the
frame, rolling back if the closure returned an error. Returns the result
that the closure returned (or any error caused during the frame
push/pop). Used for testing.
pub fn invoke_function(&self, hf: HostFunction) -> Result<ScVal, HostError>
source§impl Host
impl Host
pub fn register_test_contract( &self, contract_address: AddressObject, contract_fns: Rc<dyn ContractFunctionSet> ) -> Result<(), HostError>
source§impl Host
impl Host
sourcepub fn with_storage_and_budget(storage: Storage, budget: Budget) -> Self
pub fn with_storage_and_budget(storage: Storage, budget: Budget) -> Self
pub fn set_source_account( &self, source_account: AccountId ) -> Result<(), HostError>
pub fn remove_source_account(&self) -> Result<(), HostError>
pub fn source_account_address(&self) -> Result<Option<AddressObject>, HostError>
pub fn switch_to_recording_auth( &self, disable_non_root_auth: bool ) -> Result<(), HostError>
pub fn set_base_prng_seed(&self, seed: Seed) -> Result<(), HostError>
pub fn set_ledger_info(&self, info: LedgerInfo) -> Result<(), HostError>
pub fn with_ledger_info<F, T>(&self, f: F) -> Result<T, HostError>
pub fn with_mut_ledger_info<F>(&self, f: F) -> Result<(), HostError>where
F: FnMut(&mut LedgerInfo),
pub fn get_ledger_protocol_version(&self) -> Result<u32, HostError>
pub fn budget_cloned(&self) -> Budget
pub fn charge_budget( &self, ty: ContractCostType, input: Option<u64> ) -> Result<(), HostError>
pub fn set_shadow_budget_limits( &self, cpu: u64, mem: u64 ) -> Result<(), HostError>
pub fn set_diagnostic_level( &self, diagnostic_level: DiagnosticLevel ) -> Result<(), HostError>
pub fn enable_debug(&self) -> Result<(), HostError>
sourcepub fn can_finish(&self) -> bool
pub fn can_finish(&self) -> bool
Returns whether the Host can be finished by calling
Host::try_finish
.
Returns true if the host reference is unique, refcount = 1.
sourcepub fn try_finish(self) -> Result<(Storage, Events), HostError>
pub fn try_finish(self) -> Result<(Storage, Events), HostError>
Accept a unique (refcount = 1) host reference and destroy the
underlying [HostImpl
], returning its finalized components containing
processing side effects to the caller as a tuple wrapped in Ok(...)
.
Use Host::can_finish
to determine before calling the function if it
will succeed.
source§impl Host
impl Host
sourcepub fn set_top_contract_invocation_hook(
&self,
hook: Option<Rc<dyn for<'a> Fn(&'a Host, ContractInvocationEvent)>>
) -> Result<(), HostError>
pub fn set_top_contract_invocation_hook( &self, hook: Option<Rc<dyn for<'a> Fn(&'a Host, ContractInvocationEvent)>> ) -> Result<(), HostError>
Sets a hook to track top-level contract invocations.
The hook triggers right before the top-level contract invocation
starts and right after it ends.
‘Top-level contract invocation’ happens when the host creates
the first context frame that belongs to a contract, which includes
both direct host function calls (call
/try_call
), and test
utilities such as with_test_contract_frame
or
call_account_contract_check_auth
.
source§impl Host
impl Host
pub fn get_recorded_auth_payloads( &self ) -> Result<Vec<RecordedAuthPayload>, HostError>
source§impl Host
impl Host
sourcepub fn call_account_contract_check_auth(
&self,
contract: AddressObject,
args: VecObject
) -> Result<Val, HostError>
pub fn call_account_contract_check_auth( &self, contract: AddressObject, args: VecObject ) -> Result<Val, HostError>
Invokes the reserved __check_auth
function on a provided contract.
This is useful for testing the custom account contracts. Otherwise, the
host prohibits calling __check_auth
outside of internal implementation
of require_auth[_for_args]
calls.
sourcepub fn snapshot_auth_manager(&self) -> Result<AuthorizationManager, HostError>
pub fn snapshot_auth_manager(&self) -> Result<AuthorizationManager, HostError>
Returns the current state of the authorization manager.
Use this in conjunction with set_auth_manager
to do authorized
operations without breaking the current authorization state (useful for
preserving the auth state while doing the generic test setup).
sourcepub fn set_auth_manager(
&self,
auth_manager: AuthorizationManager
) -> Result<(), HostError>
pub fn set_auth_manager( &self, auth_manager: AuthorizationManager ) -> Result<(), HostError>
Replaces authorization manager with the provided new instance.
Use this in conjunction with snapshot_auth_manager
to do authorized
operations without breaking the current authorization state (useful for
preserving the auth state while doing the generic test setup).
source§impl Host
impl Host
pub const TEST_PRNG_SEED: &'static [u8; 32] = b"12345678901234567890123456789012"
pub fn test_host() -> Self
pub fn test_host_with_recording_footprint() -> Self
pub fn test_budget(self, cpu: u64, mem: u64) -> Self
pub fn enable_model( self, ty: ContractCostType, const_cpu: u64, lin_cpu: u64, const_mem: u64, lin_mem: u64 ) -> Self
pub fn test_scvec<T: AsScVal>(&self, vals: &[T]) -> Result<ScVec, HostError>
pub fn test_vec_obj<T: AsScVal>( &self, vals: &[T] ) -> Result<VecObject, HostError>
pub fn test_vec_val<T: AsScVal>(&self, vals: &[T]) -> Result<Val, HostError>
pub fn test_bin_scobj(&self, vals: &[u8]) -> Result<ScVal, HostError>
pub fn test_bin_obj(&self, vals: &[u8]) -> Result<BytesObject, HostError>
pub fn register_test_contract_wasm_from_source_account( &self, contract_wasm: &[u8], account: AccountId, salt: [u8; 32] ) -> Result<AddressObject, HostError>
pub fn register_test_contract_wasm(&self, contract_wasm: &[u8]) -> AddressObject
pub fn new_recording_fuzz_host( contract_wasms: &[&[u8]], data_keys: &BTreeMap<ScVal, (StorageType, bool)>, n_signers: usize ) -> (Host, Vec<AddressObject>, Vec<SigningKey>)
pub fn switch_fuzz_host_to_enforcing( &self, data_keys: &BTreeMap<ScVal, (StorageType, bool)>, signing_keys: &[SigningKey] )
Trait Implementations§
source§impl Compare<ContractDataDurability> for Host
impl Compare<ContractDataDurability> for Host
source§impl Compare<ContractExecutable> for Host
impl Compare<ContractExecutable> for Host
source§impl Compare<CreateContractArgs> for Host
impl Compare<CreateContractArgs> for Host
source§impl Compare<Int128Parts> for Host
impl Compare<Int128Parts> for Host
source§impl Compare<Int256Parts> for Host
impl Compare<Int256Parts> for Host
source§impl Compare<LedgerKeyAccount> for Host
impl Compare<LedgerKeyAccount> for Host
source§impl Compare<LedgerKeyContractCode> for Host
impl Compare<LedgerKeyContractCode> for Host
source§impl Compare<LedgerKeyTrustLine> for Host
impl Compare<LedgerKeyTrustLine> for Host
source§impl<Elt: MeteredClone> Compare<MeteredVector<Elt>> for Host
impl<Elt: MeteredClone> Compare<MeteredVector<Elt>> for Host
source§impl Compare<ScNonceKey> for Host
impl Compare<ScNonceKey> for Host
source§impl Compare<TrustLineAsset> for Host
impl Compare<TrustLineAsset> for Host
source§impl Compare<UInt128Parts> for Host
impl Compare<UInt128Parts> for Host
source§impl Compare<UInt256Parts> for Host
impl Compare<UInt256Parts> for Host
source§impl EnvBase for Host
impl EnvBase for Host
§type Error = HostError
type Error = HostError
Infallible
(in the
Guest
) or HostError
(in the Host
). Read moresource§fn error_from_error_val(&self, e: Error) -> Self::Error
fn error_from_error_val(&self, e: Error) -> Self::Error
crate::Error
into EnvBase::Error
. This is similar to adding
+ From<crate::Error>
to the associated type bound for EnvBase::Error
but it allows us to restrict that conversion in downstream crates, which
is desirable to keep “conversions that panic” (as the guest definition
of EnvBase::Error
does) out of the common crate and avoid accidentally
triggering them in the host. It also gives the Env
an opportunity to
log or enrich the error with context (both of which happen in Host
).source§fn check_obj_integrity(&self, obj: Object) -> Result<(), HostError>
fn check_obj_integrity(&self, obj: Object) -> Result<(), HostError>
source§fn escalate_error_to_panic(&self, e: Self::Error) -> !
fn escalate_error_to_panic(&self, e: Self::Error) -> !
Host
.source§fn augment_err_result<T>(
&self,
x: Result<T, Self::Error>
) -> Result<T, Self::Error>
fn augment_err_result<T>( &self, x: Result<T, Self::Error> ) -> Result<T, Self::Error>
x
is Err(...)
, ensure as much debug information as possible is
attached to that error; in any case return “essentially the same” x
–
either Ok(...)
or Err(...)
– just with extra error context. Read moresource§fn tracing_enabled(&self) -> bool
fn tracing_enabled(&self) -> bool
Self::trace_env_call
and Self::trace_env_ret
.source§fn trace_env_call(
&self,
fname: &'static str,
args: &[&dyn Debug]
) -> Result<(), HostError>
fn trace_env_call( &self, fname: &'static str, args: &[&dyn Debug] ) -> Result<(), HostError>
source§fn trace_env_ret(
&self,
fname: &'static str,
res: &Result<&dyn Debug, &HostError>
) -> Result<(), HostError>
fn trace_env_ret( &self, fname: &'static str, res: &Result<&dyn Debug, &HostError> ) -> Result<(), HostError>
source§fn check_same_env(&self, other: &Self) -> Result<(), Self::Error>
fn check_same_env(&self, other: &Self) -> Result<(), Self::Error>
source§fn bytes_copy_from_slice(
&self,
b: BytesObject,
b_pos: U32Val,
slice: &[u8]
) -> Result<BytesObject, HostError>
fn bytes_copy_from_slice( &self, b: BytesObject, b_pos: U32Val, slice: &[u8] ) -> Result<BytesObject, HostError>
Bytes
object in the host, replacing the portion of
its memory with bytes supplied by slice
, returning the new object. The
replaced portion of the original object’s memory begins at b_pos
and
extends for the same length as the new slice
.source§fn bytes_copy_to_slice(
&self,
b: BytesObject,
b_pos: U32Val,
slice: &mut [u8]
) -> Result<(), HostError>
fn bytes_copy_to_slice( &self, b: BytesObject, b_pos: U32Val, slice: &mut [u8] ) -> Result<(), HostError>
Bytes
object in the host into a slice in
the caller’s memory.source§fn string_copy_to_slice(
&self,
b: StringObject,
b_pos: U32Val,
slice: &mut [u8]
) -> Result<(), HostError>
fn string_copy_to_slice( &self, b: StringObject, b_pos: U32Val, slice: &mut [u8] ) -> Result<(), HostError>
String
object in the host into a slice in
the caller’s memory.source§fn symbol_copy_to_slice(
&self,
s: SymbolObject,
b_pos: U32Val,
slice: &mut [u8]
) -> Result<(), HostError>
fn symbol_copy_to_slice( &self, s: SymbolObject, b_pos: U32Val, slice: &mut [u8] ) -> Result<(), HostError>
Symbol
object in the host into the
caller’s memory.source§fn bytes_new_from_slice(&self, mem: &[u8]) -> Result<BytesObject, HostError>
fn bytes_new_from_slice(&self, mem: &[u8]) -> Result<BytesObject, HostError>
Bytes
host object from a slice of client memory.source§fn string_new_from_slice(&self, s: &[u8]) -> Result<StringObject, HostError>
fn string_new_from_slice(&self, s: &[u8]) -> Result<StringObject, HostError>
String
host object from a slice of client memory.source§fn symbol_new_from_slice(&self, s: &[u8]) -> Result<SymbolObject, HostError>
fn symbol_new_from_slice(&self, s: &[u8]) -> Result<SymbolObject, HostError>
Symbol
host object from a slice of client memory.source§fn map_new_from_slices(
&self,
keys: &[&str],
vals: &[Val]
) -> Result<MapObject, HostError>
fn map_new_from_slices( &self, keys: &[&str], vals: &[Val] ) -> Result<MapObject, HostError>
Map
host object from a slice of symbol-names and a slice of values.
Keys must be in sorted order.source§fn map_unpack_to_slice(
&self,
map: MapObject,
keys: &[&str],
vals: &mut [Val]
) -> Result<Void, HostError>
fn map_unpack_to_slice( &self, map: MapObject, keys: &[&str], vals: &mut [Val] ) -> Result<Void, HostError>
Map
host object with a specified set of keys to a slice of
Val
s. Keys must be in sorted order and must match the key set of
the unpacked object exactly.source§fn vec_new_from_slice(&self, vals: &[Val]) -> Result<VecObject, Self::Error>
fn vec_new_from_slice(&self, vals: &[Val]) -> Result<VecObject, Self::Error>
Vec
host object from a slice of values.source§fn vec_unpack_to_slice(
&self,
vec: VecObject,
vals: &mut [Val]
) -> Result<Void, Self::Error>
fn vec_unpack_to_slice( &self, vec: VecObject, vals: &mut [Val] ) -> Result<Void, Self::Error>
Vec
host object from a slice of values. The values slice must
be the same length as the host object.source§fn symbol_index_in_strs(
&self,
sym: Symbol,
slices: &[&str]
) -> Result<U32Val, Self::Error>
fn symbol_index_in_strs( &self, sym: Symbol, slices: &[&str] ) -> Result<U32Val, Self::Error>
Symbol
in an array of &strs, or error if not found.source§fn log_from_slice(&self, msg: &str, vals: &[Val]) -> Result<Void, HostError>
fn log_from_slice(&self, msg: &str, vals: &[Val]) -> Result<Void, HostError>
source§fn check_val_integrity(&self, val: Val) -> Result<(), Self::Error>
fn check_val_integrity(&self, val: Val) -> Result<(), Self::Error>
Val
is good according to the current Env. This is a
superset of calling Val::good
as it also checks that if the Val
is
an Object
, that the Object
is good according to
Self::check_obj_integrity
.source§impl ResourceLimiter for Host
impl ResourceLimiter for Host
source§fn memory_growing(
&mut self,
current: usize,
desired: usize,
maximum: Option<usize>
) -> Result<bool, MemoryError>
fn memory_growing( &mut self, current: usize, desired: usize, maximum: Option<usize> ) -> Result<bool, MemoryError>
source§fn table_growing(
&mut self,
current: u32,
desired: u32,
maximum: Option<u32>
) -> Result<bool, TableError>
fn table_growing( &mut self, current: u32, desired: u32, maximum: Option<u32> ) -> Result<bool, TableError>
source§fn instances(&self) -> usize
fn instances(&self) -> usize
Store
. Read moresource§fn tables(&self) -> usize
fn tables(&self) -> usize
Store
. Read moresource§fn memories(&self) -> usize
fn memories(&self) -> usize
Store
Read moresource§fn memory_grow_failed(&mut self, _error: &MemoryError)
fn memory_grow_failed(&mut self, _error: &MemoryError)
memory_growing
method, has failed.source§fn table_grow_failed(&mut self, _error: &TableError)
fn table_grow_failed(&mut self, _error: &TableError)
table_growing
method, has failed.source§impl VmCallerEnv for Host
impl VmCallerEnv for Host
type VmUserState = Host
source§fn log_from_linear_memory(
&self,
vmcaller: &mut VmCaller<'_, Host>,
msg_pos: U32Val,
msg_len: U32Val,
vals_pos: U32Val,
vals_len: U32Val
) -> Result<Void, HostError>
fn log_from_linear_memory( &self, vmcaller: &mut VmCaller<'_, Host>, msg_pos: U32Val, msg_len: U32Val, vals_pos: U32Val, vals_len: U32Val ) -> Result<Void, HostError>
Val
s.source§fn obj_cmp(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
a: Val,
b: Val
) -> Result<i64, HostError>
fn obj_cmp( &self, _vmcaller: &mut VmCaller<'_, Host>, a: Val, b: Val ) -> Result<i64, HostError>
source§fn contract_event(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
topics: VecObject,
data: Val
) -> Result<Void, HostError>
fn contract_event( &self, _vmcaller: &mut VmCaller<'_, Host>, topics: VecObject, data: Val ) -> Result<Void, HostError>
topics
is expected to be a SCVec
with length <= 4 that cannot contain Vec
, Map
, or Bytes
with length > 32.source§fn get_ledger_version(
&self,
_vmcaller: &mut VmCaller<'_, Host>
) -> Result<U32Val, Self::Error>
fn get_ledger_version( &self, _vmcaller: &mut VmCaller<'_, Host> ) -> Result<U32Val, Self::Error>
source§fn get_ledger_sequence(
&self,
_vmcaller: &mut VmCaller<'_, Host>
) -> Result<U32Val, Self::Error>
fn get_ledger_sequence( &self, _vmcaller: &mut VmCaller<'_, Host> ) -> Result<U32Val, Self::Error>
source§fn get_ledger_timestamp(
&self,
_vmcaller: &mut VmCaller<'_, Host>
) -> Result<U64Val, Self::Error>
fn get_ledger_timestamp( &self, _vmcaller: &mut VmCaller<'_, Host> ) -> Result<U64Val, Self::Error>
source§fn fail_with_error(
&self,
_vmcaller: &mut VmCaller<'_, Self::VmUserState>,
error: Error
) -> Result<Void, Self::Error>
fn fail_with_error( &self, _vmcaller: &mut VmCaller<'_, Self::VmUserState>, error: Error ) -> Result<Void, Self::Error>
ScErrorType::Contract
. Does not actually return.source§fn get_ledger_network_id(
&self,
_vmcaller: &mut VmCaller<'_, Host>
) -> Result<BytesObject, Self::Error>
fn get_ledger_network_id( &self, _vmcaller: &mut VmCaller<'_, Host> ) -> Result<BytesObject, Self::Error>
Bytes
. The value is always 32 bytes in length.source§fn get_current_contract_address(
&self,
_vmcaller: &mut VmCaller<'_, Host>
) -> Result<AddressObject, HostError>
fn get_current_contract_address( &self, _vmcaller: &mut VmCaller<'_, Host> ) -> Result<AddressObject, HostError>
source§fn get_max_live_until_ledger(
&self,
_vmcaller: &mut VmCaller<'_, Host>
) -> Result<U32Val, Self::Error>
fn get_max_live_until_ledger( &self, _vmcaller: &mut VmCaller<'_, Host> ) -> Result<U32Val, Self::Error>
source§fn obj_from_u64(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
u: u64
) -> Result<U64Object, HostError>
fn obj_from_u64( &self, _vmcaller: &mut VmCaller<'_, Host>, u: u64 ) -> Result<U64Object, HostError>
u64
to an object containing a u64
.source§fn obj_to_u64(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
obj: U64Object
) -> Result<u64, HostError>
fn obj_to_u64( &self, _vmcaller: &mut VmCaller<'_, Host>, obj: U64Object ) -> Result<u64, HostError>
u64
to a u64
.source§fn obj_from_i64(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
u: i64
) -> Result<I64Object, HostError>
fn obj_from_i64( &self, _vmcaller: &mut VmCaller<'_, Host>, u: i64 ) -> Result<I64Object, HostError>
i64
to an object containing an i64
.source§fn obj_to_i64(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
obj: I64Object
) -> Result<i64, HostError>
fn obj_to_i64( &self, _vmcaller: &mut VmCaller<'_, Host>, obj: I64Object ) -> Result<i64, HostError>
i64
to an i64
.source§fn timepoint_obj_from_u64(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
u: u64
) -> Result<TimepointObject, HostError>
fn timepoint_obj_from_u64( &self, _vmcaller: &mut VmCaller<'_, Host>, u: u64 ) -> Result<TimepointObject, HostError>
u64
to a Timepoint
object.source§fn timepoint_obj_to_u64(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
obj: TimepointObject
) -> Result<u64, HostError>
fn timepoint_obj_to_u64( &self, _vmcaller: &mut VmCaller<'_, Host>, obj: TimepointObject ) -> Result<u64, HostError>
Timepoint
object to a u64
.source§fn duration_obj_from_u64(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
u: u64
) -> Result<DurationObject, HostError>
fn duration_obj_from_u64( &self, _vmcaller: &mut VmCaller<'_, Host>, u: u64 ) -> Result<DurationObject, HostError>
u64
to a Duration
object.source§fn duration_obj_to_u64(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
obj: DurationObject
) -> Result<u64, HostError>
fn duration_obj_to_u64( &self, _vmcaller: &mut VmCaller<'_, Host>, obj: DurationObject ) -> Result<u64, HostError>
Duration
object a u64
.source§fn obj_from_u128_pieces(
&self,
_vmcaller: &mut VmCaller<'_, Self::VmUserState>,
hi: u64,
lo: u64
) -> Result<U128Object, Self::Error>
fn obj_from_u128_pieces( &self, _vmcaller: &mut VmCaller<'_, Self::VmUserState>, hi: u64, lo: u64 ) -> Result<U128Object, Self::Error>
source§fn obj_to_u128_lo64(
&self,
_vmcaller: &mut VmCaller<'_, Self::VmUserState>,
obj: U128Object
) -> Result<u64, Self::Error>
fn obj_to_u128_lo64( &self, _vmcaller: &mut VmCaller<'_, Self::VmUserState>, obj: U128Object ) -> Result<u64, Self::Error>
source§fn obj_to_u128_hi64(
&self,
_vmcaller: &mut VmCaller<'_, Self::VmUserState>,
obj: U128Object
) -> Result<u64, Self::Error>
fn obj_to_u128_hi64( &self, _vmcaller: &mut VmCaller<'_, Self::VmUserState>, obj: U128Object ) -> Result<u64, Self::Error>
source§fn obj_from_i128_pieces(
&self,
_vmcaller: &mut VmCaller<'_, Self::VmUserState>,
hi: i64,
lo: u64
) -> Result<I128Object, Self::Error>
fn obj_from_i128_pieces( &self, _vmcaller: &mut VmCaller<'_, Self::VmUserState>, hi: i64, lo: u64 ) -> Result<I128Object, Self::Error>
source§fn obj_to_i128_lo64(
&self,
_vmcaller: &mut VmCaller<'_, Self::VmUserState>,
obj: I128Object
) -> Result<u64, Self::Error>
fn obj_to_i128_lo64( &self, _vmcaller: &mut VmCaller<'_, Self::VmUserState>, obj: I128Object ) -> Result<u64, Self::Error>
source§fn obj_to_i128_hi64(
&self,
_vmcaller: &mut VmCaller<'_, Self::VmUserState>,
obj: I128Object
) -> Result<i64, Self::Error>
fn obj_to_i128_hi64( &self, _vmcaller: &mut VmCaller<'_, Self::VmUserState>, obj: I128Object ) -> Result<i64, Self::Error>
source§fn obj_from_u256_pieces(
&self,
_vmcaller: &mut VmCaller<'_, Self::VmUserState>,
hi_hi: u64,
hi_lo: u64,
lo_hi: u64,
lo_lo: u64
) -> Result<U256Object, Self::Error>
fn obj_from_u256_pieces( &self, _vmcaller: &mut VmCaller<'_, Self::VmUserState>, hi_hi: u64, hi_lo: u64, lo_hi: u64, lo_lo: u64 ) -> Result<U256Object, Self::Error>
source§fn u256_val_from_be_bytes(
&self,
_vmcaller: &mut VmCaller<'_, Self::VmUserState>,
bytes: BytesObject
) -> Result<U256Val, HostError>
fn u256_val_from_be_bytes( &self, _vmcaller: &mut VmCaller<'_, Self::VmUserState>, bytes: BytesObject ) -> Result<U256Val, HostError>
Val
from its representation as a byte array in big endian.source§fn u256_val_to_be_bytes(
&self,
_vmcaller: &mut VmCaller<'_, Self::VmUserState>,
val: U256Val
) -> Result<BytesObject, HostError>
fn u256_val_to_be_bytes( &self, _vmcaller: &mut VmCaller<'_, Self::VmUserState>, val: U256Val ) -> Result<BytesObject, HostError>
Val
as a byte array in big endian byte order.source§fn obj_to_u256_hi_hi(
&self,
_vmcaller: &mut VmCaller<'_, Self::VmUserState>,
obj: U256Object
) -> Result<u64, HostError>
fn obj_to_u256_hi_hi( &self, _vmcaller: &mut VmCaller<'_, Self::VmUserState>, obj: U256Object ) -> Result<u64, HostError>
source§fn obj_to_u256_hi_lo(
&self,
_vmcaller: &mut VmCaller<'_, Self::VmUserState>,
obj: U256Object
) -> Result<u64, HostError>
fn obj_to_u256_hi_lo( &self, _vmcaller: &mut VmCaller<'_, Self::VmUserState>, obj: U256Object ) -> Result<u64, HostError>
source§fn obj_to_u256_lo_hi(
&self,
_vmcaller: &mut VmCaller<'_, Self::VmUserState>,
obj: U256Object
) -> Result<u64, HostError>
fn obj_to_u256_lo_hi( &self, _vmcaller: &mut VmCaller<'_, Self::VmUserState>, obj: U256Object ) -> Result<u64, HostError>
source§fn obj_to_u256_lo_lo(
&self,
_vmcaller: &mut VmCaller<'_, Self::VmUserState>,
obj: U256Object
) -> Result<u64, HostError>
fn obj_to_u256_lo_lo( &self, _vmcaller: &mut VmCaller<'_, Self::VmUserState>, obj: U256Object ) -> Result<u64, HostError>
source§fn obj_from_i256_pieces(
&self,
_vmcaller: &mut VmCaller<'_, Self::VmUserState>,
hi_hi: i64,
hi_lo: u64,
lo_hi: u64,
lo_lo: u64
) -> Result<I256Object, Self::Error>
fn obj_from_i256_pieces( &self, _vmcaller: &mut VmCaller<'_, Self::VmUserState>, hi_hi: i64, hi_lo: u64, lo_hi: u64, lo_lo: u64 ) -> Result<I256Object, Self::Error>
source§fn i256_val_from_be_bytes(
&self,
_vmcaller: &mut VmCaller<'_, Self::VmUserState>,
bytes: BytesObject
) -> Result<I256Val, HostError>
fn i256_val_from_be_bytes( &self, _vmcaller: &mut VmCaller<'_, Self::VmUserState>, bytes: BytesObject ) -> Result<I256Val, HostError>
Val
from its representation as a byte array in big endian.source§fn i256_val_to_be_bytes(
&self,
_vmcaller: &mut VmCaller<'_, Self::VmUserState>,
val: I256Val
) -> Result<BytesObject, HostError>
fn i256_val_to_be_bytes( &self, _vmcaller: &mut VmCaller<'_, Self::VmUserState>, val: I256Val ) -> Result<BytesObject, HostError>
Val
as a byte array in big endian byte order.source§fn obj_to_i256_hi_hi(
&self,
_vmcaller: &mut VmCaller<'_, Self::VmUserState>,
obj: I256Object
) -> Result<i64, HostError>
fn obj_to_i256_hi_hi( &self, _vmcaller: &mut VmCaller<'_, Self::VmUserState>, obj: I256Object ) -> Result<i64, HostError>
source§fn obj_to_i256_hi_lo(
&self,
_vmcaller: &mut VmCaller<'_, Self::VmUserState>,
obj: I256Object
) -> Result<u64, HostError>
fn obj_to_i256_hi_lo( &self, _vmcaller: &mut VmCaller<'_, Self::VmUserState>, obj: I256Object ) -> Result<u64, HostError>
source§fn obj_to_i256_lo_hi(
&self,
_vmcaller: &mut VmCaller<'_, Self::VmUserState>,
obj: I256Object
) -> Result<u64, HostError>
fn obj_to_i256_lo_hi( &self, _vmcaller: &mut VmCaller<'_, Self::VmUserState>, obj: I256Object ) -> Result<u64, HostError>
source§fn obj_to_i256_lo_lo(
&self,
_vmcaller: &mut VmCaller<'_, Self::VmUserState>,
obj: I256Object
) -> Result<u64, HostError>
fn obj_to_i256_lo_lo( &self, _vmcaller: &mut VmCaller<'_, Self::VmUserState>, obj: I256Object ) -> Result<u64, HostError>
source§fn u256_add(
&self,
_vmcaller: &mut VmCaller<'_, Self::VmUserState>,
lhs_val: U256Val,
rhs_val: U256Val
) -> Result<U256Val, Self::Error>
fn u256_add( &self, _vmcaller: &mut VmCaller<'_, Self::VmUserState>, lhs_val: U256Val, rhs_val: U256Val ) -> Result<U256Val, Self::Error>
lhs + rhs
, returning ScError
if overflow occurred. source§fn u256_sub(
&self,
_vmcaller: &mut VmCaller<'_, Self::VmUserState>,
lhs_val: U256Val,
rhs_val: U256Val
) -> Result<U256Val, Self::Error>
fn u256_sub( &self, _vmcaller: &mut VmCaller<'_, Self::VmUserState>, lhs_val: U256Val, rhs_val: U256Val ) -> Result<U256Val, Self::Error>
lhs - rhs
, returning ScError
if overflow occurred. source§fn u256_mul(
&self,
_vmcaller: &mut VmCaller<'_, Self::VmUserState>,
lhs_val: U256Val,
rhs_val: U256Val
) -> Result<U256Val, Self::Error>
fn u256_mul( &self, _vmcaller: &mut VmCaller<'_, Self::VmUserState>, lhs_val: U256Val, rhs_val: U256Val ) -> Result<U256Val, Self::Error>
lhs * rhs
, returning ScError
if overflow occurred. source§fn u256_div(
&self,
_vmcaller: &mut VmCaller<'_, Self::VmUserState>,
lhs_val: U256Val,
rhs_val: U256Val
) -> Result<U256Val, Self::Error>
fn u256_div( &self, _vmcaller: &mut VmCaller<'_, Self::VmUserState>, lhs_val: U256Val, rhs_val: U256Val ) -> Result<U256Val, Self::Error>
lhs / rhs
, returning ScError
if rhs == 0
or overflow occurred. source§fn u256_rem_euclid(
&self,
_vmcaller: &mut VmCaller<'_, Self::VmUserState>,
lhs_val: U256Val,
rhs_val: U256Val
) -> Result<U256Val, Self::Error>
fn u256_rem_euclid( &self, _vmcaller: &mut VmCaller<'_, Self::VmUserState>, lhs_val: U256Val, rhs_val: U256Val ) -> Result<U256Val, Self::Error>
lhs % rhs
, returning ScError
if rhs == 0
or overflow occurred. source§fn u256_pow(
&self,
_vmcaller: &mut VmCaller<'_, Self::VmUserState>,
lhs_val: U256Val,
rhs_val: U32Val
) -> Result<U256Val, Self::Error>
fn u256_pow( &self, _vmcaller: &mut VmCaller<'_, Self::VmUserState>, lhs_val: U256Val, rhs_val: U32Val ) -> Result<U256Val, Self::Error>
lhs.exp(rhs)
, returning ScError
if overflow occurred. source§fn u256_shl(
&self,
_vmcaller: &mut VmCaller<'_, Self::VmUserState>,
lhs_val: U256Val,
rhs_val: U32Val
) -> Result<U256Val, Self::Error>
fn u256_shl( &self, _vmcaller: &mut VmCaller<'_, Self::VmUserState>, lhs_val: U256Val, rhs_val: U32Val ) -> Result<U256Val, Self::Error>
lhs << rhs
, returning ScError
if rhs
is larger than or equal to the number of bits in lhs
.source§fn u256_shr(
&self,
_vmcaller: &mut VmCaller<'_, Self::VmUserState>,
lhs_val: U256Val,
rhs_val: U32Val
) -> Result<U256Val, Self::Error>
fn u256_shr( &self, _vmcaller: &mut VmCaller<'_, Self::VmUserState>, lhs_val: U256Val, rhs_val: U32Val ) -> Result<U256Val, Self::Error>
lhs >> rhs
, returning ScError
if rhs
is larger than or equal to the number of bits in lhs
.source§fn i256_add(
&self,
_vmcaller: &mut VmCaller<'_, Self::VmUserState>,
lhs_val: I256Val,
rhs_val: I256Val
) -> Result<I256Val, Self::Error>
fn i256_add( &self, _vmcaller: &mut VmCaller<'_, Self::VmUserState>, lhs_val: I256Val, rhs_val: I256Val ) -> Result<I256Val, Self::Error>
lhs + rhs
, returning ScError
if overflow occurred. source§fn i256_sub(
&self,
_vmcaller: &mut VmCaller<'_, Self::VmUserState>,
lhs_val: I256Val,
rhs_val: I256Val
) -> Result<I256Val, Self::Error>
fn i256_sub( &self, _vmcaller: &mut VmCaller<'_, Self::VmUserState>, lhs_val: I256Val, rhs_val: I256Val ) -> Result<I256Val, Self::Error>
lhs - rhs
, returning ScError
if overflow occurred. source§fn i256_mul(
&self,
_vmcaller: &mut VmCaller<'_, Self::VmUserState>,
lhs_val: I256Val,
rhs_val: I256Val
) -> Result<I256Val, Self::Error>
fn i256_mul( &self, _vmcaller: &mut VmCaller<'_, Self::VmUserState>, lhs_val: I256Val, rhs_val: I256Val ) -> Result<I256Val, Self::Error>
lhs * rhs
, returning ScError
if overflow occurred. source§fn i256_div(
&self,
_vmcaller: &mut VmCaller<'_, Self::VmUserState>,
lhs_val: I256Val,
rhs_val: I256Val
) -> Result<I256Val, Self::Error>
fn i256_div( &self, _vmcaller: &mut VmCaller<'_, Self::VmUserState>, lhs_val: I256Val, rhs_val: I256Val ) -> Result<I256Val, Self::Error>
lhs / rhs
, returning ScError
if rhs == 0
or overflow occurred. source§fn i256_rem_euclid(
&self,
_vmcaller: &mut VmCaller<'_, Self::VmUserState>,
lhs_val: I256Val,
rhs_val: I256Val
) -> Result<I256Val, Self::Error>
fn i256_rem_euclid( &self, _vmcaller: &mut VmCaller<'_, Self::VmUserState>, lhs_val: I256Val, rhs_val: I256Val ) -> Result<I256Val, Self::Error>
lhs % rhs
, returning ScError
if rhs == 0
or overflow occurred. source§fn i256_pow(
&self,
_vmcaller: &mut VmCaller<'_, Self::VmUserState>,
lhs_val: I256Val,
rhs_val: U32Val
) -> Result<I256Val, Self::Error>
fn i256_pow( &self, _vmcaller: &mut VmCaller<'_, Self::VmUserState>, lhs_val: I256Val, rhs_val: U32Val ) -> Result<I256Val, Self::Error>
lhs.exp(rhs)
, returning ScError
if overflow occurred. source§fn i256_shl(
&self,
_vmcaller: &mut VmCaller<'_, Self::VmUserState>,
lhs_val: I256Val,
rhs_val: U32Val
) -> Result<I256Val, Self::Error>
fn i256_shl( &self, _vmcaller: &mut VmCaller<'_, Self::VmUserState>, lhs_val: I256Val, rhs_val: U32Val ) -> Result<I256Val, Self::Error>
lhs << rhs
, returning ScError
if rhs
is larger than or equal to the number of bits in lhs
.source§fn i256_shr(
&self,
_vmcaller: &mut VmCaller<'_, Self::VmUserState>,
lhs_val: I256Val,
rhs_val: U32Val
) -> Result<I256Val, Self::Error>
fn i256_shr( &self, _vmcaller: &mut VmCaller<'_, Self::VmUserState>, lhs_val: I256Val, rhs_val: U32Val ) -> Result<I256Val, Self::Error>
lhs >> rhs
, returning ScError
if rhs
is larger than or equal to the number of bits in lhs
.source§fn map_new(
&self,
_vmcaller: &mut VmCaller<'_, Host>
) -> Result<MapObject, HostError>
fn map_new( &self, _vmcaller: &mut VmCaller<'_, Host> ) -> Result<MapObject, HostError>
source§fn map_put(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
m: MapObject,
k: Val,
v: Val
) -> Result<MapObject, HostError>
fn map_put( &self, _vmcaller: &mut VmCaller<'_, Host>, m: MapObject, k: Val, v: Val ) -> Result<MapObject, HostError>
source§fn map_get(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
m: MapObject,
k: Val
) -> Result<Val, HostError>
fn map_get( &self, _vmcaller: &mut VmCaller<'_, Host>, m: MapObject, k: Val ) -> Result<Val, HostError>
source§fn map_del(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
m: MapObject,
k: Val
) -> Result<MapObject, HostError>
fn map_del( &self, _vmcaller: &mut VmCaller<'_, Host>, m: MapObject, k: Val ) -> Result<MapObject, HostError>
source§fn map_len(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
m: MapObject
) -> Result<U32Val, HostError>
fn map_len( &self, _vmcaller: &mut VmCaller<'_, Host>, m: MapObject ) -> Result<U32Val, HostError>
source§fn map_has(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
m: MapObject,
k: Val
) -> Result<Bool, HostError>
fn map_has( &self, _vmcaller: &mut VmCaller<'_, Host>, m: MapObject, k: Val ) -> Result<Bool, HostError>
source§fn map_key_by_pos(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
m: MapObject,
i: U32Val
) -> Result<Val, HostError>
fn map_key_by_pos( &self, _vmcaller: &mut VmCaller<'_, Host>, m: MapObject, i: U32Val ) -> Result<Val, HostError>
i
. If i
is an invalid position, return ScError.source§fn map_val_by_pos(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
m: MapObject,
i: U32Val
) -> Result<Val, HostError>
fn map_val_by_pos( &self, _vmcaller: &mut VmCaller<'_, Host>, m: MapObject, i: U32Val ) -> Result<Val, HostError>
i
. If i
is an invalid position, return ScError.source§fn map_keys(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
m: MapObject
) -> Result<VecObject, HostError>
fn map_keys( &self, _vmcaller: &mut VmCaller<'_, Host>, m: MapObject ) -> Result<VecObject, HostError>
source§fn map_values(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
m: MapObject
) -> Result<VecObject, HostError>
fn map_values( &self, _vmcaller: &mut VmCaller<'_, Host>, m: MapObject ) -> Result<VecObject, HostError>
source§fn map_new_from_linear_memory(
&self,
vmcaller: &mut VmCaller<'_, Host>,
keys_pos: U32Val,
vals_pos: U32Val,
len: U32Val
) -> Result<MapObject, HostError>
fn map_new_from_linear_memory( &self, vmcaller: &mut VmCaller<'_, Host>, keys_pos: U32Val, vals_pos: U32Val, len: U32Val ) -> Result<MapObject, HostError>
source§fn map_unpack_to_linear_memory(
&self,
vmcaller: &mut VmCaller<'_, Host>,
map: MapObject,
keys_pos: U32Val,
vals_pos: U32Val,
len: U32Val
) -> Result<Void, HostError>
fn map_unpack_to_linear_memory( &self, vmcaller: &mut VmCaller<'_, Host>, map: MapObject, keys_pos: U32Val, vals_pos: U32Val, len: U32Val ) -> Result<Void, HostError>
map
to the array vals_pos
, selecting only the keys identified by the array keys_pos
. Both arrays have len
elements and are identified by linear-memory addresses.source§fn vec_new(
&self,
_vmcaller: &mut VmCaller<'_, Host>
) -> Result<VecObject, HostError>
fn vec_new( &self, _vmcaller: &mut VmCaller<'_, Host> ) -> Result<VecObject, HostError>
source§fn vec_put(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
v: VecObject,
i: U32Val,
x: Val
) -> Result<VecObject, HostError>
fn vec_put( &self, _vmcaller: &mut VmCaller<'_, Host>, v: VecObject, i: U32Val, x: Val ) -> Result<VecObject, HostError>
i
in the vector. Return the new vector. Trap if the index is out of bounds.source§fn vec_get(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
v: VecObject,
i: U32Val
) -> Result<Val, HostError>
fn vec_get( &self, _vmcaller: &mut VmCaller<'_, Host>, v: VecObject, i: U32Val ) -> Result<Val, HostError>
i
of the vector. Traps if the index is out of bound.source§fn vec_del(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
v: VecObject,
i: U32Val
) -> Result<VecObject, HostError>
fn vec_del( &self, _vmcaller: &mut VmCaller<'_, Host>, v: VecObject, i: U32Val ) -> Result<VecObject, HostError>
i
, shifting all elements after it to the left. Return the new vector. Traps if the index is out of bound.source§fn vec_len(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
v: VecObject
) -> Result<U32Val, HostError>
fn vec_len( &self, _vmcaller: &mut VmCaller<'_, Host>, v: VecObject ) -> Result<U32Val, HostError>
source§fn vec_push_front(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
v: VecObject,
x: Val
) -> Result<VecObject, HostError>
fn vec_push_front( &self, _vmcaller: &mut VmCaller<'_, Host>, v: VecObject, x: Val ) -> Result<VecObject, HostError>
source§fn vec_pop_front(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
v: VecObject
) -> Result<VecObject, HostError>
fn vec_pop_front( &self, _vmcaller: &mut VmCaller<'_, Host>, v: VecObject ) -> Result<VecObject, HostError>
source§fn vec_push_back(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
v: VecObject,
x: Val
) -> Result<VecObject, HostError>
fn vec_push_back( &self, _vmcaller: &mut VmCaller<'_, Host>, v: VecObject, x: Val ) -> Result<VecObject, HostError>
source§fn vec_pop_back(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
v: VecObject
) -> Result<VecObject, HostError>
fn vec_pop_back( &self, _vmcaller: &mut VmCaller<'_, Host>, v: VecObject ) -> Result<VecObject, HostError>
source§fn vec_front(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
v: VecObject
) -> Result<Val, HostError>
fn vec_front( &self, _vmcaller: &mut VmCaller<'_, Host>, v: VecObject ) -> Result<Val, HostError>
source§fn vec_back(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
v: VecObject
) -> Result<Val, HostError>
fn vec_back( &self, _vmcaller: &mut VmCaller<'_, Host>, v: VecObject ) -> Result<Val, HostError>
source§fn vec_insert(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
v: VecObject,
i: U32Val,
x: Val
) -> Result<VecObject, HostError>
fn vec_insert( &self, _vmcaller: &mut VmCaller<'_, Host>, v: VecObject, i: U32Val, x: Val ) -> Result<VecObject, HostError>
i
within the vector, shifting all elements after it to the right. Traps if the index is out of boundsource§fn vec_append(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
v1: VecObject,
v2: VecObject
) -> Result<VecObject, HostError>
fn vec_append( &self, _vmcaller: &mut VmCaller<'_, Host>, v1: VecObject, v2: VecObject ) -> Result<VecObject, HostError>
v1
, then moves all the elements of vector v2
into it. Return the new vector. Traps if number of elements in the vector overflows a u32.source§fn vec_slice(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
v: VecObject,
start: U32Val,
end: U32Val
) -> Result<VecObject, HostError>
fn vec_slice( &self, _vmcaller: &mut VmCaller<'_, Host>, v: VecObject, start: U32Val, end: U32Val ) -> Result<VecObject, HostError>
start
index until end
index, exclusive, in the vector and create a new vector from it. Return the new vector. Traps if the index is out of bound.source§fn vec_first_index_of(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
v: VecObject,
x: Val
) -> Result<Val, Self::Error>
fn vec_first_index_of( &self, _vmcaller: &mut VmCaller<'_, Host>, v: VecObject, x: Val ) -> Result<Val, Self::Error>
Void
.source§fn vec_last_index_of(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
v: VecObject,
x: Val
) -> Result<Val, Self::Error>
fn vec_last_index_of( &self, _vmcaller: &mut VmCaller<'_, Host>, v: VecObject, x: Val ) -> Result<Val, Self::Error>
Void
.source§fn vec_binary_search(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
v: VecObject,
x: Val
) -> Result<u64, Self::Error>
fn vec_binary_search( &self, _vmcaller: &mut VmCaller<'_, Host>, v: VecObject, x: Val ) -> Result<u64, Self::Error>
source§fn vec_new_from_linear_memory(
&self,
vmcaller: &mut VmCaller<'_, Host>,
vals_pos: U32Val,
len: U32Val
) -> Result<VecObject, HostError>
fn vec_new_from_linear_memory( &self, vmcaller: &mut VmCaller<'_, Host>, vals_pos: U32Val, len: U32Val ) -> Result<VecObject, HostError>
source§fn vec_unpack_to_linear_memory(
&self,
vmcaller: &mut VmCaller<'_, Host>,
vec: VecObject,
vals_pos: U32Val,
len: U32Val
) -> Result<Void, HostError>
fn vec_unpack_to_linear_memory( &self, vmcaller: &mut VmCaller<'_, Host>, vec: VecObject, vals_pos: U32Val, len: U32Val ) -> Result<Void, HostError>
fn put_contract_data( &self, _vmcaller: &mut VmCaller<'_, Host>, k: Val, v: Val, t: StorageType ) -> Result<Void, HostError>
fn has_contract_data( &self, _vmcaller: &mut VmCaller<'_, Host>, k: Val, t: StorageType ) -> Result<Bool, HostError>
fn get_contract_data( &self, _vmcaller: &mut VmCaller<'_, Host>, k: Val, t: StorageType ) -> Result<Val, HostError>
fn del_contract_data( &self, _vmcaller: &mut VmCaller<'_, Host>, k: Val, t: StorageType ) -> Result<Void, HostError>
source§fn extend_contract_data_ttl(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
k: Val,
t: StorageType,
threshold: U32Val,
extend_to: U32Val
) -> Result<Void, HostError>
fn extend_contract_data_ttl( &self, _vmcaller: &mut VmCaller<'_, Host>, k: Val, t: StorageType, threshold: U32Val, extend_to: U32Val ) -> Result<Void, HostError>
threshold
ledgers, extend live_until_ledger_seq
such that TTL == extend_to
, where TTL is defined as live_until_ledger_seq - current ledgersource§fn extend_current_contract_instance_and_code_ttl(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
threshold: U32Val,
extend_to: U32Val
) -> Result<Void, HostError>
fn extend_current_contract_instance_and_code_ttl( &self, _vmcaller: &mut VmCaller<'_, Host>, threshold: U32Val, extend_to: U32Val ) -> Result<Void, HostError>
threshold
ledgers, extend live_until_ledger_seq
such that TTL == extend_to
, where TTL is defined as live_until_ledger_seq - current ledgersource§fn extend_contract_instance_and_code_ttl(
&self,
_vmcaller: &mut VmCaller<'_, Self::VmUserState>,
contract: AddressObject,
threshold: U32Val,
extend_to: U32Val
) -> Result<Void, Self::Error>
fn extend_contract_instance_and_code_ttl( &self, _vmcaller: &mut VmCaller<'_, Self::VmUserState>, contract: AddressObject, threshold: U32Val, extend_to: U32Val ) -> Result<Void, Self::Error>
threshold
ledgers, extend live_until_ledger_seq
such that TTL == extend_to
, where TTL is defined as live_until_ledger_seq - current ledgersource§fn create_contract(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
deployer: AddressObject,
wasm_hash: BytesObject,
salt: BytesObject
) -> Result<AddressObject, HostError>
fn create_contract( &self, _vmcaller: &mut VmCaller<'_, Host>, deployer: AddressObject, wasm_hash: BytesObject, salt: BytesObject ) -> Result<AddressObject, HostError>
deployer
. deployer
must authorize this call via Soroban auth framework, i.e. this calls deployer.require_auth
with respective arguments. wasm_hash
must be a hash of the contract code that has already been uploaded on this network. salt
is used to create a unique contract id. Returns the address of the created contract.source§fn create_asset_contract(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
serialized_asset: BytesObject
) -> Result<AddressObject, HostError>
fn create_asset_contract( &self, _vmcaller: &mut VmCaller<'_, Host>, serialized_asset: BytesObject ) -> Result<AddressObject, HostError>
serialized_asset
is stellar::Asset
XDR serialized to bytes format. Returns the address of the created contract.source§fn get_contract_id(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
deployer: AddressObject,
salt: BytesObject
) -> Result<AddressObject, HostError>
fn get_contract_id( &self, _vmcaller: &mut VmCaller<'_, Host>, deployer: AddressObject, salt: BytesObject ) -> Result<AddressObject, HostError>
deployer
is address of the contract deployer. salt
is used to create a unique contract id. Returns the address of the would-be contract.source§fn get_asset_contract_id(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
serialized_asset: BytesObject
) -> Result<AddressObject, HostError>
fn get_asset_contract_id( &self, _vmcaller: &mut VmCaller<'_, Host>, serialized_asset: BytesObject ) -> Result<AddressObject, HostError>
serialized_asset
is stellar::Asset
XDR serialized to bytes format. Returns the address of the would-be asset contract.source§fn upload_wasm(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
wasm: BytesObject
) -> Result<BytesObject, HostError>
fn upload_wasm( &self, _vmcaller: &mut VmCaller<'_, Host>, wasm: BytesObject ) -> Result<BytesObject, HostError>
wasm
bytecode to the network and returns its identifier (SHA-256 hash). No-op in case if the same Wasm object already exists.source§fn update_current_contract_wasm(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
hash: BytesObject
) -> Result<Void, HostError>
fn update_current_contract_wasm( &self, _vmcaller: &mut VmCaller<'_, Host>, hash: BytesObject ) -> Result<Void, HostError>
source§fn call(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
contract_address: AddressObject,
func: Symbol,
args: VecObject
) -> Result<Val, HostError>
fn call( &self, _vmcaller: &mut VmCaller<'_, Host>, contract_address: AddressObject, func: Symbol, args: VecObject ) -> Result<Val, HostError>
args
. If the call is successful, returns the result of the called function. Traps otherwise.source§fn try_call(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
contract_address: AddressObject,
func: Symbol,
args: VecObject
) -> Result<Val, HostError>
fn try_call( &self, _vmcaller: &mut VmCaller<'_, Host>, contract_address: AddressObject, func: Symbol, args: VecObject ) -> Result<Val, HostError>
args
, returning either the result of the called function or an Error
if the called function failed. The returned error is either a custom ContractError
that the called contract returns explicitly, or an error with type Context
and code InvalidAction
in case of any other error in the called contract (such as a host function failure that caused a trap). try_call
might trap in a few scenarios where the error can’t be meaningfully recovered from, such as running out of budget.source§fn serialize_to_bytes(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
v: Val
) -> Result<BytesObject, HostError>
fn serialize_to_bytes( &self, _vmcaller: &mut VmCaller<'_, Host>, v: Val ) -> Result<BytesObject, HostError>
Bytes
object.source§fn deserialize_from_bytes(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
b: BytesObject
) -> Result<Val, HostError>
fn deserialize_from_bytes( &self, _vmcaller: &mut VmCaller<'_, Host>, b: BytesObject ) -> Result<Val, HostError>
Bytes
object to get back the (SC)Val.source§fn string_copy_to_linear_memory(
&self,
vmcaller: &mut VmCaller<'_, Host>,
s: StringObject,
s_pos: U32Val,
lm_pos: U32Val,
len: U32Val
) -> Result<Void, HostError>
fn string_copy_to_linear_memory( &self, vmcaller: &mut VmCaller<'_, Host>, s: StringObject, s_pos: U32Val, lm_pos: U32Val, len: U32Val ) -> Result<Void, HostError>
String
object specified at offset s_pos
with length len
into the linear memory at position lm_pos
. Traps if either the String
object or the linear memory doesn’t have enough bytes.source§fn symbol_copy_to_linear_memory(
&self,
vmcaller: &mut VmCaller<'_, Host>,
s: SymbolObject,
s_pos: U32Val,
lm_pos: U32Val,
len: U32Val
) -> Result<Void, HostError>
fn symbol_copy_to_linear_memory( &self, vmcaller: &mut VmCaller<'_, Host>, s: SymbolObject, s_pos: U32Val, lm_pos: U32Val, len: U32Val ) -> Result<Void, HostError>
Symbol
object specified at offset s_pos
with length len
into the linear memory at position lm_pos
. Traps if either the String
object or the linear memory doesn’t have enough bytes.source§fn bytes_copy_to_linear_memory(
&self,
vmcaller: &mut VmCaller<'_, Host>,
b: BytesObject,
b_pos: U32Val,
lm_pos: U32Val,
len: U32Val
) -> Result<Void, HostError>
fn bytes_copy_to_linear_memory( &self, vmcaller: &mut VmCaller<'_, Host>, b: BytesObject, b_pos: U32Val, lm_pos: U32Val, len: U32Val ) -> Result<Void, HostError>
Bytes
object specified at offset b_pos
with length len
into the linear memory at position lm_pos
. Traps if either the Bytes
object or the linear memory doesn’t have enough bytes.source§fn bytes_copy_from_linear_memory(
&self,
vmcaller: &mut VmCaller<'_, Host>,
b: BytesObject,
b_pos: U32Val,
lm_pos: U32Val,
len: U32Val
) -> Result<BytesObject, HostError>
fn bytes_copy_from_linear_memory( &self, vmcaller: &mut VmCaller<'_, Host>, b: BytesObject, b_pos: U32Val, lm_pos: U32Val, len: U32Val ) -> Result<BytesObject, HostError>
lm_pos
with length len
, into a Bytes
object at offset b_pos
. The Bytes
object may grow in size to accommodate the new bytes. Traps if the linear memory doesn’t have enough bytes.source§fn bytes_new_from_linear_memory(
&self,
vmcaller: &mut VmCaller<'_, Host>,
lm_pos: U32Val,
len: U32Val
) -> Result<BytesObject, HostError>
fn bytes_new_from_linear_memory( &self, vmcaller: &mut VmCaller<'_, Host>, lm_pos: U32Val, len: U32Val ) -> Result<BytesObject, HostError>
Bytes
object initialized with bytes copied from a linear memory slice specified at position lm_pos
with length len
.source§fn string_new_from_linear_memory(
&self,
vmcaller: &mut VmCaller<'_, Host>,
lm_pos: U32Val,
len: U32Val
) -> Result<StringObject, HostError>
fn string_new_from_linear_memory( &self, vmcaller: &mut VmCaller<'_, Host>, lm_pos: U32Val, len: U32Val ) -> Result<StringObject, HostError>
String
object initialized with bytes copied from a linear memory slice specified at position lm_pos
with length len
.source§fn symbol_new_from_linear_memory(
&self,
vmcaller: &mut VmCaller<'_, Host>,
lm_pos: U32Val,
len: U32Val
) -> Result<SymbolObject, HostError>
fn symbol_new_from_linear_memory( &self, vmcaller: &mut VmCaller<'_, Host>, lm_pos: U32Val, len: U32Val ) -> Result<SymbolObject, HostError>
Symbol
object initialized with bytes copied from a linear memory slice specified at position lm_pos
with length len
.source§fn symbol_index_in_linear_memory(
&self,
vmcaller: &mut VmCaller<'_, Host>,
sym: Symbol,
lm_pos: U32Val,
len: U32Val
) -> Result<U32Val, HostError>
fn symbol_index_in_linear_memory( &self, vmcaller: &mut VmCaller<'_, Host>, sym: Symbol, lm_pos: U32Val, len: U32Val ) -> Result<U32Val, HostError>
source§fn bytes_new(
&self,
_vmcaller: &mut VmCaller<'_, Host>
) -> Result<BytesObject, HostError>
fn bytes_new( &self, _vmcaller: &mut VmCaller<'_, Host> ) -> Result<BytesObject, HostError>
Bytes
object.source§fn bytes_put(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
b: BytesObject,
iv: U32Val,
u: U32Val
) -> Result<BytesObject, HostError>
fn bytes_put( &self, _vmcaller: &mut VmCaller<'_, Host>, b: BytesObject, iv: U32Val, u: U32Val ) -> Result<BytesObject, HostError>
i
in the Bytes
object. Return the new Bytes
. Trap if the index is out of bounds.source§fn bytes_get(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
b: BytesObject,
iv: U32Val
) -> Result<U32Val, HostError>
fn bytes_get( &self, _vmcaller: &mut VmCaller<'_, Host>, b: BytesObject, iv: U32Val ) -> Result<U32Val, HostError>
i
of the Bytes
object. Traps if the index is out of bound.source§fn bytes_del(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
b: BytesObject,
i: U32Val
) -> Result<BytesObject, HostError>
fn bytes_del( &self, _vmcaller: &mut VmCaller<'_, Host>, b: BytesObject, i: U32Val ) -> Result<BytesObject, HostError>
Bytes
object at index i
, shifting all elements after it to the left. Return the new Bytes
. Traps if the index is out of bound.source§fn bytes_len(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
b: BytesObject
) -> Result<U32Val, HostError>
fn bytes_len( &self, _vmcaller: &mut VmCaller<'_, Host>, b: BytesObject ) -> Result<U32Val, HostError>
Bytes
object.source§fn string_len(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
b: StringObject
) -> Result<U32Val, HostError>
fn string_len( &self, _vmcaller: &mut VmCaller<'_, Host>, b: StringObject ) -> Result<U32Val, HostError>
String
object.source§fn symbol_len(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
b: SymbolObject
) -> Result<U32Val, HostError>
fn symbol_len( &self, _vmcaller: &mut VmCaller<'_, Host>, b: SymbolObject ) -> Result<U32Val, HostError>
Symbol
object.source§fn bytes_push(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
b: BytesObject,
u: U32Val
) -> Result<BytesObject, HostError>
fn bytes_push( &self, _vmcaller: &mut VmCaller<'_, Host>, b: BytesObject, u: U32Val ) -> Result<BytesObject, HostError>
Bytes
object.source§fn bytes_pop(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
b: BytesObject
) -> Result<BytesObject, HostError>
fn bytes_pop( &self, _vmcaller: &mut VmCaller<'_, Host>, b: BytesObject ) -> Result<BytesObject, HostError>
Bytes
object and returns the new Bytes
. Traps if original Bytes
is empty.source§fn bytes_front(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
b: BytesObject
) -> Result<U32Val, HostError>
fn bytes_front( &self, _vmcaller: &mut VmCaller<'_, Host>, b: BytesObject ) -> Result<U32Val, HostError>
Bytes
object. Traps if the Bytes
is emptysource§fn bytes_back(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
b: BytesObject
) -> Result<U32Val, HostError>
fn bytes_back( &self, _vmcaller: &mut VmCaller<'_, Host>, b: BytesObject ) -> Result<U32Val, HostError>
Bytes
object. Traps if the Bytes
is emptysource§fn bytes_insert(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
b: BytesObject,
i: U32Val,
u: U32Val
) -> Result<BytesObject, HostError>
fn bytes_insert( &self, _vmcaller: &mut VmCaller<'_, Host>, b: BytesObject, i: U32Val, u: U32Val ) -> Result<BytesObject, HostError>
i
within the Bytes
object, shifting all elements after it to the right. Traps if the index is out of boundsource§fn bytes_append(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
b1: BytesObject,
b2: BytesObject
) -> Result<BytesObject, HostError>
fn bytes_append( &self, _vmcaller: &mut VmCaller<'_, Host>, b1: BytesObject, b2: BytesObject ) -> Result<BytesObject, HostError>
Bytes
object b1
, then moves all the elements of Bytes
object b2
into it. Return the new Bytes
. Traps if its length overflows a u32.source§fn bytes_slice(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
b: BytesObject,
start: U32Val,
end: U32Val
) -> Result<BytesObject, HostError>
fn bytes_slice( &self, _vmcaller: &mut VmCaller<'_, Host>, b: BytesObject, start: U32Val, end: U32Val ) -> Result<BytesObject, HostError>
start
index until end
index, exclusive, in the Bytes
object and creates a new Bytes
from it. Returns the new Bytes
. Traps if the index is out of bound.fn compute_hash_sha256( &self, _vmcaller: &mut VmCaller<'_, Host>, x: BytesObject ) -> Result<BytesObject, HostError>
source§fn compute_hash_keccak256(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
x: BytesObject
) -> Result<BytesObject, HostError>
fn compute_hash_keccak256( &self, _vmcaller: &mut VmCaller<'_, Host>, x: BytesObject ) -> Result<BytesObject, HostError>
fn verify_sig_ed25519( &self, _vmcaller: &mut VmCaller<'_, Host>, k: BytesObject, x: BytesObject, s: BytesObject ) -> Result<Void, HostError>
source§fn recover_key_ecdsa_secp256k1(
&self,
_vmcaller: &mut VmCaller<'_, Host>,
msg_digest: BytesObject,
signature: BytesObject,
recovery_id: U32Val
) -> Result<BytesObject, HostError>
fn recover_key_ecdsa_secp256k1( &self, _vmcaller: &mut VmCaller<'_, Host>, msg_digest: BytesObject, signature: BytesObject, recovery_id: U32Val ) -> Result<BytesObject, HostError>
source§fn dummy0(
&self,
_vmcaller: &mut VmCaller<'_, Self::VmUserState>
) -> Result<Val, Self::Error>
fn dummy0( &self, _vmcaller: &mut VmCaller<'_, Self::VmUserState> ) -> Result<Val, Self::Error>
source§fn require_auth_for_args(
&self,
_vmcaller: &mut VmCaller<'_, Self::VmUserState>,
address: AddressObject,
args: VecObject
) -> Result<Void, Self::Error>
fn require_auth_for_args( &self, _vmcaller: &mut VmCaller<'_, Self::VmUserState>, address: AddressObject, args: VecObject ) -> Result<Void, Self::Error>
source§fn require_auth(
&self,
_vmcaller: &mut VmCaller<'_, Self::VmUserState>,
address: AddressObject
) -> Result<Void, Self::Error>
fn require_auth( &self, _vmcaller: &mut VmCaller<'_, Self::VmUserState>, address: AddressObject ) -> Result<Void, Self::Error>
InvokerContractAuthEntry
contract type that authorizes a tree of require_auth
calls on behalf of the current contract. The entries must not contain any authorizations for the direct contract call, i.e. if current contract needs to call contract function F1 that calls function F2 both of which require auth, only F2 should be present in auth_entries
.source§fn address_to_strkey(
&self,
_vmcaller: &mut VmCaller<'_, Self::VmUserState>,
address: AddressObject
) -> Result<StringObject, Self::Error>
fn address_to_strkey( &self, _vmcaller: &mut VmCaller<'_, Self::VmUserState>, address: AddressObject ) -> Result<StringObject, Self::Error>
source§fn strkey_to_address(
&self,
_vmcaller: &mut VmCaller<'_, Self::VmUserState>,
strkey_obj: Val
) -> Result<AddressObject, Self::Error>
fn strkey_to_address( &self, _vmcaller: &mut VmCaller<'_, Self::VmUserState>, strkey_obj: Val ) -> Result<AddressObject, Self::Error>
strkey
can be either BytesObject
or StringObject
(the contents should represent the G.../C...
string in both cases). Any other valid or invalid strkey (e.g. ‘S…’) will trigger an error. Prefer directly using the Address objects whenever possible. This is only useful in the context of custom messaging protocols (e.g. cross-chain).source§fn prng_reseed(
&self,
_vmcaller: &mut VmCaller<'_, Self::VmUserState>,
seed: BytesObject
) -> Result<Void, Self::Error>
fn prng_reseed( &self, _vmcaller: &mut VmCaller<'_, Self::VmUserState>, seed: BytesObject ) -> Result<Void, Self::Error>
source§fn prng_bytes_new(
&self,
_vmcaller: &mut VmCaller<'_, Self::VmUserState>,
length: U32Val
) -> Result<BytesObject, Self::Error>
fn prng_bytes_new( &self, _vmcaller: &mut VmCaller<'_, Self::VmUserState>, length: U32Val ) -> Result<BytesObject, Self::Error>
source§fn prng_u64_in_inclusive_range(
&self,
_vmcaller: &mut VmCaller<'_, Self::VmUserState>,
lo: u64,
hi: u64
) -> Result<u64, Self::Error>
fn prng_u64_in_inclusive_range( &self, _vmcaller: &mut VmCaller<'_, Self::VmUserState>, lo: u64, hi: u64 ) -> Result<u64, Self::Error>
source§fn prng_vec_shuffle(
&self,
_vmcaller: &mut VmCaller<'_, Self::VmUserState>,
vec: VecObject
) -> Result<VecObject, Self::Error>
fn prng_vec_shuffle( &self, _vmcaller: &mut VmCaller<'_, Self::VmUserState>, vec: VecObject ) -> Result<VecObject, Self::Error>
Auto Trait Implementations§
impl !RefUnwindSafe for Host
impl !Send for Host
impl !Sync for Host
impl Unpin for Host
impl !UnwindSafe for Host
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
source§impl<T, U, V, W, E, C> Compare<(T, U, V, W)> for C
impl<T, U, V, W, E, C> Compare<(T, U, V, W)> for C
type Error = E
fn compare( &self, a: &(T, U, V, W), b: &(T, U, V, W) ) -> Result<Ordering, <C as Compare<(T, U, V, W)>>::Error>
source§impl<T, U, V, W, X, E, C> Compare<(T, U, V, W, X)> for C
impl<T, U, V, W, X, E, C> Compare<(T, U, V, W, X)> for C
type Error = E
fn compare( &self, a: &(T, U, V, W, X), b: &(T, U, V, W, X) ) -> Result<Ordering, <C as Compare<(T, U, V, W, X)>>::Error>
source§impl<E> Compare<AddressObject> for Ewhere
E: Env,
impl<E> Compare<AddressObject> for Ewhere
E: Env,
type Error = <E as EnvBase>::Error
fn compare( &self, a: &AddressObject, b: &AddressObject ) -> Result<Ordering, <E as Compare<AddressObject>>::Error>
source§impl<E> Compare<BytesObject> for Ewhere
E: Env,
impl<E> Compare<BytesObject> for Ewhere
E: Env,
type Error = <E as EnvBase>::Error
fn compare( &self, a: &BytesObject, b: &BytesObject ) -> Result<Ordering, <E as Compare<BytesObject>>::Error>
source§impl<E> Compare<DurationObject> for Ewhere
E: Env,
impl<E> Compare<DurationObject> for Ewhere
E: Env,
type Error = <E as EnvBase>::Error
fn compare( &self, a: &DurationObject, b: &DurationObject ) -> Result<Ordering, <E as Compare<DurationObject>>::Error>
source§impl<E> Compare<DurationSmall> for Ewhere
E: Env,
impl<E> Compare<DurationSmall> for Ewhere
E: Env,
type Error = <E as EnvBase>::Error
fn compare( &self, a: &DurationSmall, b: &DurationSmall ) -> Result<Ordering, <E as Compare<DurationSmall>>::Error>
source§impl<E> Compare<I128Object> for Ewhere
E: Env,
impl<E> Compare<I128Object> for Ewhere
E: Env,
type Error = <E as EnvBase>::Error
fn compare( &self, a: &I128Object, b: &I128Object ) -> Result<Ordering, <E as Compare<I128Object>>::Error>
source§impl<E> Compare<I256Object> for Ewhere
E: Env,
impl<E> Compare<I256Object> for Ewhere
E: Env,
type Error = <E as EnvBase>::Error
fn compare( &self, a: &I256Object, b: &I256Object ) -> Result<Ordering, <E as Compare<I256Object>>::Error>
source§impl<E> Compare<StringObject> for Ewhere
E: Env,
impl<E> Compare<StringObject> for Ewhere
E: Env,
type Error = <E as EnvBase>::Error
fn compare( &self, a: &StringObject, b: &StringObject ) -> Result<Ordering, <E as Compare<StringObject>>::Error>
source§impl<E> Compare<SymbolObject> for Ewhere
E: Env,
impl<E> Compare<SymbolObject> for Ewhere
E: Env,
type Error = <E as EnvBase>::Error
fn compare( &self, a: &SymbolObject, b: &SymbolObject ) -> Result<Ordering, <E as Compare<SymbolObject>>::Error>
source§impl<E> Compare<SymbolSmall> for Ewhere
E: Env,
impl<E> Compare<SymbolSmall> for Ewhere
E: Env,
type Error = <E as EnvBase>::Error
fn compare( &self, a: &SymbolSmall, b: &SymbolSmall ) -> Result<Ordering, <E as Compare<SymbolSmall>>::Error>
source§impl<E> Compare<TimepointObject> for Ewhere
E: Env,
impl<E> Compare<TimepointObject> for Ewhere
E: Env,
type Error = <E as EnvBase>::Error
fn compare( &self, a: &TimepointObject, b: &TimepointObject ) -> Result<Ordering, <E as Compare<TimepointObject>>::Error>
source§impl<E> Compare<TimepointSmall> for Ewhere
E: Env,
impl<E> Compare<TimepointSmall> for Ewhere
E: Env,
type Error = <E as EnvBase>::Error
fn compare( &self, a: &TimepointSmall, b: &TimepointSmall ) -> Result<Ordering, <E as Compare<TimepointSmall>>::Error>
source§impl<E> Compare<U128Object> for Ewhere
E: Env,
impl<E> Compare<U128Object> for Ewhere
E: Env,
type Error = <E as EnvBase>::Error
fn compare( &self, a: &U128Object, b: &U128Object ) -> Result<Ordering, <E as Compare<U128Object>>::Error>
source§impl<E> Compare<U256Object> for Ewhere
E: Env,
impl<E> Compare<U256Object> for Ewhere
E: Env,
type Error = <E as EnvBase>::Error
fn compare( &self, a: &U256Object, b: &U256Object ) -> Result<Ordering, <E as Compare<U256Object>>::Error>
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.source§impl<T> Env for Twhere
T: VmCallerEnv,
impl<T> Env for Twhere
T: VmCallerEnv,
source§fn log_from_linear_memory(
&self,
msg_pos: U32Val,
msg_len: U32Val,
vals_pos: U32Val,
vals_len: U32Val
) -> Result<Void, <T as EnvBase>::Error>
fn log_from_linear_memory( &self, msg_pos: U32Val, msg_len: U32Val, vals_pos: U32Val, vals_len: U32Val ) -> Result<Void, <T as EnvBase>::Error>
Val
s.source§fn obj_cmp(&self, a: Val, b: Val) -> Result<i64, <T as EnvBase>::Error>
fn obj_cmp(&self, a: Val, b: Val) -> Result<i64, <T as EnvBase>::Error>
source§fn contract_event(
&self,
topics: VecObject,
data: Val
) -> Result<Void, <T as EnvBase>::Error>
fn contract_event( &self, topics: VecObject, data: Val ) -> Result<Void, <T as EnvBase>::Error>
topics
is expected to be a SCVec
with length <= 4 that cannot contain Vec
, Map
, or Bytes
with length > 32.source§fn get_ledger_version(&self) -> Result<U32Val, <T as EnvBase>::Error>
fn get_ledger_version(&self) -> Result<U32Val, <T as EnvBase>::Error>
source§fn get_ledger_sequence(&self) -> Result<U32Val, <T as EnvBase>::Error>
fn get_ledger_sequence(&self) -> Result<U32Val, <T as EnvBase>::Error>
source§fn get_ledger_timestamp(&self) -> Result<U64Val, <T as EnvBase>::Error>
fn get_ledger_timestamp(&self) -> Result<U64Val, <T as EnvBase>::Error>
source§fn fail_with_error(&self, error: Error) -> Result<Void, <T as EnvBase>::Error>
fn fail_with_error(&self, error: Error) -> Result<Void, <T as EnvBase>::Error>
ScErrorType::Contract
. Does not actually return.source§fn get_ledger_network_id(&self) -> Result<BytesObject, <T as EnvBase>::Error>
fn get_ledger_network_id(&self) -> Result<BytesObject, <T as EnvBase>::Error>
Bytes
. The value is always 32 bytes in length.source§fn get_current_contract_address(
&self
) -> Result<AddressObject, <T as EnvBase>::Error>
fn get_current_contract_address( &self ) -> Result<AddressObject, <T as EnvBase>::Error>
source§fn get_max_live_until_ledger(&self) -> Result<U32Val, <T as EnvBase>::Error>
fn get_max_live_until_ledger(&self) -> Result<U32Val, <T as EnvBase>::Error>
source§fn obj_from_u64(&self, v: u64) -> Result<U64Object, <T as EnvBase>::Error>
fn obj_from_u64(&self, v: u64) -> Result<U64Object, <T as EnvBase>::Error>
u64
to an object containing a u64
.source§fn obj_to_u64(&self, obj: U64Object) -> Result<u64, <T as EnvBase>::Error>
fn obj_to_u64(&self, obj: U64Object) -> Result<u64, <T as EnvBase>::Error>
u64
to a u64
.source§fn obj_from_i64(&self, v: i64) -> Result<I64Object, <T as EnvBase>::Error>
fn obj_from_i64(&self, v: i64) -> Result<I64Object, <T as EnvBase>::Error>
i64
to an object containing an i64
.source§fn obj_to_i64(&self, obj: I64Object) -> Result<i64, <T as EnvBase>::Error>
fn obj_to_i64(&self, obj: I64Object) -> Result<i64, <T as EnvBase>::Error>
i64
to an i64
.source§fn obj_from_u128_pieces(
&self,
hi: u64,
lo: u64
) -> Result<U128Object, <T as EnvBase>::Error>
fn obj_from_u128_pieces( &self, hi: u64, lo: u64 ) -> Result<U128Object, <T as EnvBase>::Error>
source§fn obj_to_u128_lo64(
&self,
obj: U128Object
) -> Result<u64, <T as EnvBase>::Error>
fn obj_to_u128_lo64( &self, obj: U128Object ) -> Result<u64, <T as EnvBase>::Error>
source§fn obj_to_u128_hi64(
&self,
obj: U128Object
) -> Result<u64, <T as EnvBase>::Error>
fn obj_to_u128_hi64( &self, obj: U128Object ) -> Result<u64, <T as EnvBase>::Error>
source§fn obj_from_i128_pieces(
&self,
hi: i64,
lo: u64
) -> Result<I128Object, <T as EnvBase>::Error>
fn obj_from_i128_pieces( &self, hi: i64, lo: u64 ) -> Result<I128Object, <T as EnvBase>::Error>
source§fn obj_to_i128_lo64(
&self,
obj: I128Object
) -> Result<u64, <T as EnvBase>::Error>
fn obj_to_i128_lo64( &self, obj: I128Object ) -> Result<u64, <T as EnvBase>::Error>
source§fn obj_to_i128_hi64(
&self,
obj: I128Object
) -> Result<i64, <T as EnvBase>::Error>
fn obj_to_i128_hi64( &self, obj: I128Object ) -> Result<i64, <T as EnvBase>::Error>
source§fn obj_from_u256_pieces(
&self,
hi_hi: u64,
hi_lo: u64,
lo_hi: u64,
lo_lo: u64
) -> Result<U256Object, <T as EnvBase>::Error>
fn obj_from_u256_pieces( &self, hi_hi: u64, hi_lo: u64, lo_hi: u64, lo_lo: u64 ) -> Result<U256Object, <T as EnvBase>::Error>
source§fn u256_val_from_be_bytes(
&self,
bytes: BytesObject
) -> Result<U256Val, <T as EnvBase>::Error>
fn u256_val_from_be_bytes( &self, bytes: BytesObject ) -> Result<U256Val, <T as EnvBase>::Error>
Val
from its representation as a byte array in big endian.source§fn u256_val_to_be_bytes(
&self,
val: U256Val
) -> Result<BytesObject, <T as EnvBase>::Error>
fn u256_val_to_be_bytes( &self, val: U256Val ) -> Result<BytesObject, <T as EnvBase>::Error>
Val
as a byte array in big endian byte order.source§fn obj_to_u256_hi_hi(
&self,
obj: U256Object
) -> Result<u64, <T as EnvBase>::Error>
fn obj_to_u256_hi_hi( &self, obj: U256Object ) -> Result<u64, <T as EnvBase>::Error>
source§fn obj_to_u256_hi_lo(
&self,
obj: U256Object
) -> Result<u64, <T as EnvBase>::Error>
fn obj_to_u256_hi_lo( &self, obj: U256Object ) -> Result<u64, <T as EnvBase>::Error>
source§fn obj_to_u256_lo_hi(
&self,
obj: U256Object
) -> Result<u64, <T as EnvBase>::Error>
fn obj_to_u256_lo_hi( &self, obj: U256Object ) -> Result<u64, <T as EnvBase>::Error>
source§fn obj_to_u256_lo_lo(
&self,
obj: U256Object
) -> Result<u64, <T as EnvBase>::Error>
fn obj_to_u256_lo_lo( &self, obj: U256Object ) -> Result<u64, <T as EnvBase>::Error>
source§fn obj_from_i256_pieces(
&self,
hi_hi: i64,
hi_lo: u64,
lo_hi: u64,
lo_lo: u64
) -> Result<I256Object, <T as EnvBase>::Error>
fn obj_from_i256_pieces( &self, hi_hi: i64, hi_lo: u64, lo_hi: u64, lo_lo: u64 ) -> Result<I256Object, <T as EnvBase>::Error>
source§fn i256_val_from_be_bytes(
&self,
bytes: BytesObject
) -> Result<I256Val, <T as EnvBase>::Error>
fn i256_val_from_be_bytes( &self, bytes: BytesObject ) -> Result<I256Val, <T as EnvBase>::Error>
Val
from its representation as a byte array in big endian.source§fn i256_val_to_be_bytes(
&self,
val: I256Val
) -> Result<BytesObject, <T as EnvBase>::Error>
fn i256_val_to_be_bytes( &self, val: I256Val ) -> Result<BytesObject, <T as EnvBase>::Error>
Val
as a byte array in big endian byte order.source§fn obj_to_i256_hi_hi(
&self,
obj: I256Object
) -> Result<i64, <T as EnvBase>::Error>
fn obj_to_i256_hi_hi( &self, obj: I256Object ) -> Result<i64, <T as EnvBase>::Error>
source§fn obj_to_i256_hi_lo(
&self,
obj: I256Object
) -> Result<u64, <T as EnvBase>::Error>
fn obj_to_i256_hi_lo( &self, obj: I256Object ) -> Result<u64, <T as EnvBase>::Error>
source§fn obj_to_i256_lo_hi(
&self,
obj: I256Object
) -> Result<u64, <T as EnvBase>::Error>
fn obj_to_i256_lo_hi( &self, obj: I256Object ) -> Result<u64, <T as EnvBase>::Error>
source§fn obj_to_i256_lo_lo(
&self,
obj: I256Object
) -> Result<u64, <T as EnvBase>::Error>
fn obj_to_i256_lo_lo( &self, obj: I256Object ) -> Result<u64, <T as EnvBase>::Error>
source§fn u256_add(
&self,
lhs: U256Val,
rhs: U256Val
) -> Result<U256Val, <T as EnvBase>::Error>
fn u256_add( &self, lhs: U256Val, rhs: U256Val ) -> Result<U256Val, <T as EnvBase>::Error>
lhs + rhs
, returning ScError
if overflow occurred. source§fn u256_sub(
&self,
lhs: U256Val,
rhs: U256Val
) -> Result<U256Val, <T as EnvBase>::Error>
fn u256_sub( &self, lhs: U256Val, rhs: U256Val ) -> Result<U256Val, <T as EnvBase>::Error>
lhs - rhs
, returning ScError
if overflow occurred. source§fn u256_mul(
&self,
lhs: U256Val,
rhs: U256Val
) -> Result<U256Val, <T as EnvBase>::Error>
fn u256_mul( &self, lhs: U256Val, rhs: U256Val ) -> Result<U256Val, <T as EnvBase>::Error>
lhs * rhs
, returning ScError
if overflow occurred. source§fn u256_div(
&self,
lhs: U256Val,
rhs: U256Val
) -> Result<U256Val, <T as EnvBase>::Error>
fn u256_div( &self, lhs: U256Val, rhs: U256Val ) -> Result<U256Val, <T as EnvBase>::Error>
lhs / rhs
, returning ScError
if rhs == 0
or overflow occurred. source§fn u256_rem_euclid(
&self,
lhs: U256Val,
rhs: U256Val
) -> Result<U256Val, <T as EnvBase>::Error>
fn u256_rem_euclid( &self, lhs: U256Val, rhs: U256Val ) -> Result<U256Val, <T as EnvBase>::Error>
lhs % rhs
, returning ScError
if rhs == 0
or overflow occurred. source§fn u256_pow(
&self,
lhs: U256Val,
rhs: U32Val
) -> Result<U256Val, <T as EnvBase>::Error>
fn u256_pow( &self, lhs: U256Val, rhs: U32Val ) -> Result<U256Val, <T as EnvBase>::Error>
lhs.exp(rhs)
, returning ScError
if overflow occurred. source§fn u256_shl(
&self,
lhs: U256Val,
rhs: U32Val
) -> Result<U256Val, <T as EnvBase>::Error>
fn u256_shl( &self, lhs: U256Val, rhs: U32Val ) -> Result<U256Val, <T as EnvBase>::Error>
lhs << rhs
, returning ScError
if rhs
is larger than or equal to the number of bits in lhs
.source§fn u256_shr(
&self,
lhs: U256Val,
rhs: U32Val
) -> Result<U256Val, <T as EnvBase>::Error>
fn u256_shr( &self, lhs: U256Val, rhs: U32Val ) -> Result<U256Val, <T as EnvBase>::Error>
lhs >> rhs
, returning ScError
if rhs
is larger than or equal to the number of bits in lhs
.source§fn i256_add(
&self,
lhs: I256Val,
rhs: I256Val
) -> Result<I256Val, <T as EnvBase>::Error>
fn i256_add( &self, lhs: I256Val, rhs: I256Val ) -> Result<I256Val, <T as EnvBase>::Error>
lhs + rhs
, returning ScError
if overflow occurred. source§fn i256_sub(
&self,
lhs: I256Val,
rhs: I256Val
) -> Result<I256Val, <T as EnvBase>::Error>
fn i256_sub( &self, lhs: I256Val, rhs: I256Val ) -> Result<I256Val, <T as EnvBase>::Error>
lhs - rhs
, returning ScError
if overflow occurred. source§fn i256_mul(
&self,
lhs: I256Val,
rhs: I256Val
) -> Result<I256Val, <T as EnvBase>::Error>
fn i256_mul( &self, lhs: I256Val, rhs: I256Val ) -> Result<I256Val, <T as EnvBase>::Error>
lhs * rhs
, returning ScError
if overflow occurred. source§fn i256_div(
&self,
lhs: I256Val,
rhs: I256Val
) -> Result<I256Val, <T as EnvBase>::Error>
fn i256_div( &self, lhs: I256Val, rhs: I256Val ) -> Result<I256Val, <T as EnvBase>::Error>
lhs / rhs
, returning ScError
if rhs == 0
or overflow occurred. source§fn i256_rem_euclid(
&self,
lhs: I256Val,
rhs: I256Val
) -> Result<I256Val, <T as EnvBase>::Error>
fn i256_rem_euclid( &self, lhs: I256Val, rhs: I256Val ) -> Result<I256Val, <T as EnvBase>::Error>
lhs % rhs
, returning ScError
if rhs == 0
or overflow occurred. source§fn i256_pow(
&self,
lhs: I256Val,
rhs: U32Val
) -> Result<I256Val, <T as EnvBase>::Error>
fn i256_pow( &self, lhs: I256Val, rhs: U32Val ) -> Result<I256Val, <T as EnvBase>::Error>
lhs.exp(rhs)
, returning ScError
if overflow occurred. source§fn i256_shl(
&self,
lhs: I256Val,
rhs: U32Val
) -> Result<I256Val, <T as EnvBase>::Error>
fn i256_shl( &self, lhs: I256Val, rhs: U32Val ) -> Result<I256Val, <T as EnvBase>::Error>
lhs << rhs
, returning ScError
if rhs
is larger than or equal to the number of bits in lhs
.source§fn i256_shr(
&self,
lhs: I256Val,
rhs: U32Val
) -> Result<I256Val, <T as EnvBase>::Error>
fn i256_shr( &self, lhs: I256Val, rhs: U32Val ) -> Result<I256Val, <T as EnvBase>::Error>
lhs >> rhs
, returning ScError
if rhs
is larger than or equal to the number of bits in lhs
.source§fn timepoint_obj_from_u64(
&self,
v: u64
) -> Result<TimepointObject, <T as EnvBase>::Error>
fn timepoint_obj_from_u64( &self, v: u64 ) -> Result<TimepointObject, <T as EnvBase>::Error>
u64
to a Timepoint
object.source§fn timepoint_obj_to_u64(
&self,
obj: TimepointObject
) -> Result<u64, <T as EnvBase>::Error>
fn timepoint_obj_to_u64( &self, obj: TimepointObject ) -> Result<u64, <T as EnvBase>::Error>
Timepoint
object to a u64
.source§fn duration_obj_from_u64(
&self,
v: u64
) -> Result<DurationObject, <T as EnvBase>::Error>
fn duration_obj_from_u64( &self, v: u64 ) -> Result<DurationObject, <T as EnvBase>::Error>
u64
to a Duration
object.source§fn duration_obj_to_u64(
&self,
obj: DurationObject
) -> Result<u64, <T as EnvBase>::Error>
fn duration_obj_to_u64( &self, obj: DurationObject ) -> Result<u64, <T as EnvBase>::Error>
Duration
object a u64
.source§fn map_put(
&self,
m: MapObject,
k: Val,
v: Val
) -> Result<MapObject, <T as EnvBase>::Error>
fn map_put( &self, m: MapObject, k: Val, v: Val ) -> Result<MapObject, <T as EnvBase>::Error>
source§fn map_get(&self, m: MapObject, k: Val) -> Result<Val, <T as EnvBase>::Error>
fn map_get(&self, m: MapObject, k: Val) -> Result<Val, <T as EnvBase>::Error>
source§fn map_del(
&self,
m: MapObject,
k: Val
) -> Result<MapObject, <T as EnvBase>::Error>
fn map_del( &self, m: MapObject, k: Val ) -> Result<MapObject, <T as EnvBase>::Error>
source§fn map_len(&self, m: MapObject) -> Result<U32Val, <T as EnvBase>::Error>
fn map_len(&self, m: MapObject) -> Result<U32Val, <T as EnvBase>::Error>
source§fn map_has(&self, m: MapObject, k: Val) -> Result<Bool, <T as EnvBase>::Error>
fn map_has(&self, m: MapObject, k: Val) -> Result<Bool, <T as EnvBase>::Error>
source§fn map_key_by_pos(
&self,
m: MapObject,
i: U32Val
) -> Result<Val, <T as EnvBase>::Error>
fn map_key_by_pos( &self, m: MapObject, i: U32Val ) -> Result<Val, <T as EnvBase>::Error>
i
. If i
is an invalid position, return ScError.source§fn map_val_by_pos(
&self,
m: MapObject,
i: U32Val
) -> Result<Val, <T as EnvBase>::Error>
fn map_val_by_pos( &self, m: MapObject, i: U32Val ) -> Result<Val, <T as EnvBase>::Error>
i
. If i
is an invalid position, return ScError.source§fn map_keys(&self, m: MapObject) -> Result<VecObject, <T as EnvBase>::Error>
fn map_keys(&self, m: MapObject) -> Result<VecObject, <T as EnvBase>::Error>
source§fn map_values(&self, m: MapObject) -> Result<VecObject, <T as EnvBase>::Error>
fn map_values(&self, m: MapObject) -> Result<VecObject, <T as EnvBase>::Error>
source§fn map_new_from_linear_memory(
&self,
keys_pos: U32Val,
vals_pos: U32Val,
len: U32Val
) -> Result<MapObject, <T as EnvBase>::Error>
fn map_new_from_linear_memory( &self, keys_pos: U32Val, vals_pos: U32Val, len: U32Val ) -> Result<MapObject, <T as EnvBase>::Error>
source§fn map_unpack_to_linear_memory(
&self,
map: MapObject,
keys_pos: U32Val,
vals_pos: U32Val,
len: U32Val
) -> Result<Void, <T as EnvBase>::Error>
fn map_unpack_to_linear_memory( &self, map: MapObject, keys_pos: U32Val, vals_pos: U32Val, len: U32Val ) -> Result<Void, <T as EnvBase>::Error>
map
to the array vals_pos
, selecting only the keys identified by the array keys_pos
. Both arrays have len
elements and are identified by linear-memory addresses.source§fn vec_put(
&self,
v: VecObject,
i: U32Val,
x: Val
) -> Result<VecObject, <T as EnvBase>::Error>
fn vec_put( &self, v: VecObject, i: U32Val, x: Val ) -> Result<VecObject, <T as EnvBase>::Error>
i
in the vector. Return the new vector. Trap if the index is out of bounds.source§fn vec_get(&self, v: VecObject, i: U32Val) -> Result<Val, <T as EnvBase>::Error>
fn vec_get(&self, v: VecObject, i: U32Val) -> Result<Val, <T as EnvBase>::Error>
i
of the vector. Traps if the index is out of bound.source§fn vec_del(
&self,
v: VecObject,
i: U32Val
) -> Result<VecObject, <T as EnvBase>::Error>
fn vec_del( &self, v: VecObject, i: U32Val ) -> Result<VecObject, <T as EnvBase>::Error>
i
, shifting all elements after it to the left. Return the new vector. Traps if the index is out of bound.source§fn vec_len(&self, v: VecObject) -> Result<U32Val, <T as EnvBase>::Error>
fn vec_len(&self, v: VecObject) -> Result<U32Val, <T as EnvBase>::Error>
source§fn vec_push_front(
&self,
v: VecObject,
x: Val
) -> Result<VecObject, <T as EnvBase>::Error>
fn vec_push_front( &self, v: VecObject, x: Val ) -> Result<VecObject, <T as EnvBase>::Error>
source§fn vec_pop_front(
&self,
v: VecObject
) -> Result<VecObject, <T as EnvBase>::Error>
fn vec_pop_front( &self, v: VecObject ) -> Result<VecObject, <T as EnvBase>::Error>
source§fn vec_push_back(
&self,
v: VecObject,
x: Val
) -> Result<VecObject, <T as EnvBase>::Error>
fn vec_push_back( &self, v: VecObject, x: Val ) -> Result<VecObject, <T as EnvBase>::Error>
source§fn vec_pop_back(&self, v: VecObject) -> Result<VecObject, <T as EnvBase>::Error>
fn vec_pop_back(&self, v: VecObject) -> Result<VecObject, <T as EnvBase>::Error>
source§fn vec_front(&self, v: VecObject) -> Result<Val, <T as EnvBase>::Error>
fn vec_front(&self, v: VecObject) -> Result<Val, <T as EnvBase>::Error>
source§fn vec_back(&self, v: VecObject) -> Result<Val, <T as EnvBase>::Error>
fn vec_back(&self, v: VecObject) -> Result<Val, <T as EnvBase>::Error>
source§fn vec_insert(
&self,
v: VecObject,
i: U32Val,
x: Val
) -> Result<VecObject, <T as EnvBase>::Error>
fn vec_insert( &self, v: VecObject, i: U32Val, x: Val ) -> Result<VecObject, <T as EnvBase>::Error>
i
within the vector, shifting all elements after it to the right. Traps if the index is out of boundsource§fn vec_append(
&self,
v1: VecObject,
v2: VecObject
) -> Result<VecObject, <T as EnvBase>::Error>
fn vec_append( &self, v1: VecObject, v2: VecObject ) -> Result<VecObject, <T as EnvBase>::Error>
v1
, then moves all the elements of vector v2
into it. Return the new vector. Traps if number of elements in the vector overflows a u32.source§fn vec_slice(
&self,
v: VecObject,
start: U32Val,
end: U32Val
) -> Result<VecObject, <T as EnvBase>::Error>
fn vec_slice( &self, v: VecObject, start: U32Val, end: U32Val ) -> Result<VecObject, <T as EnvBase>::Error>
start
index until end
index, exclusive, in the vector and create a new vector from it. Return the new vector. Traps if the index is out of bound.source§fn vec_first_index_of(
&self,
v: VecObject,
x: Val
) -> Result<Val, <T as EnvBase>::Error>
fn vec_first_index_of( &self, v: VecObject, x: Val ) -> Result<Val, <T as EnvBase>::Error>
Void
.source§fn vec_last_index_of(
&self,
v: VecObject,
x: Val
) -> Result<Val, <T as EnvBase>::Error>
fn vec_last_index_of( &self, v: VecObject, x: Val ) -> Result<Val, <T as EnvBase>::Error>
Void
.source§fn vec_binary_search(
&self,
v: VecObject,
x: Val
) -> Result<u64, <T as EnvBase>::Error>
fn vec_binary_search( &self, v: VecObject, x: Val ) -> Result<u64, <T as EnvBase>::Error>
source§fn vec_new_from_linear_memory(
&self,
vals_pos: U32Val,
len: U32Val
) -> Result<VecObject, <T as EnvBase>::Error>
fn vec_new_from_linear_memory( &self, vals_pos: U32Val, len: U32Val ) -> Result<VecObject, <T as EnvBase>::Error>
source§fn vec_unpack_to_linear_memory(
&self,
vec: VecObject,
vals_pos: U32Val,
len: U32Val
) -> Result<Void, <T as EnvBase>::Error>
fn vec_unpack_to_linear_memory( &self, vec: VecObject, vals_pos: U32Val, len: U32Val ) -> Result<Void, <T as EnvBase>::Error>
fn put_contract_data( &self, k: Val, v: Val, t: StorageType ) -> Result<Void, <T as EnvBase>::Error>
fn has_contract_data( &self, k: Val, t: StorageType ) -> Result<Bool, <T as EnvBase>::Error>
fn get_contract_data( &self, k: Val, t: StorageType ) -> Result<Val, <T as EnvBase>::Error>
fn del_contract_data( &self, k: Val, t: StorageType ) -> Result<Void, <T as EnvBase>::Error>
source§fn create_contract(
&self,
deployer: AddressObject,
wasm_hash: BytesObject,
salt: BytesObject
) -> Result<AddressObject, <T as EnvBase>::Error>
fn create_contract( &self, deployer: AddressObject, wasm_hash: BytesObject, salt: BytesObject ) -> Result<AddressObject, <T as EnvBase>::Error>
deployer
. deployer
must authorize this call via Soroban auth framework, i.e. this calls deployer.require_auth
with respective arguments. wasm_hash
must be a hash of the contract code that has already been uploaded on this network. salt
is used to create a unique contract id. Returns the address of the created contract.source§fn create_asset_contract(
&self,
serialized_asset: BytesObject
) -> Result<AddressObject, <T as EnvBase>::Error>
fn create_asset_contract( &self, serialized_asset: BytesObject ) -> Result<AddressObject, <T as EnvBase>::Error>
serialized_asset
is stellar::Asset
XDR serialized to bytes format. Returns the address of the created contract.source§fn upload_wasm(
&self,
wasm: BytesObject
) -> Result<BytesObject, <T as EnvBase>::Error>
fn upload_wasm( &self, wasm: BytesObject ) -> Result<BytesObject, <T as EnvBase>::Error>
wasm
bytecode to the network and returns its identifier (SHA-256 hash). No-op in case if the same Wasm object already exists.source§fn update_current_contract_wasm(
&self,
hash: BytesObject
) -> Result<Void, <T as EnvBase>::Error>
fn update_current_contract_wasm( &self, hash: BytesObject ) -> Result<Void, <T as EnvBase>::Error>
source§fn extend_contract_data_ttl(
&self,
k: Val,
t: StorageType,
threshold: U32Val,
extend_to: U32Val
) -> Result<Void, <T as EnvBase>::Error>
fn extend_contract_data_ttl( &self, k: Val, t: StorageType, threshold: U32Val, extend_to: U32Val ) -> Result<Void, <T as EnvBase>::Error>
threshold
ledgers, extend live_until_ledger_seq
such that TTL == extend_to
, where TTL is defined as live_until_ledger_seq - current ledgersource§fn extend_current_contract_instance_and_code_ttl(
&self,
threshold: U32Val,
extend_to: U32Val
) -> Result<Void, <T as EnvBase>::Error>
fn extend_current_contract_instance_and_code_ttl( &self, threshold: U32Val, extend_to: U32Val ) -> Result<Void, <T as EnvBase>::Error>
threshold
ledgers, extend live_until_ledger_seq
such that TTL == extend_to
, where TTL is defined as live_until_ledger_seq - current ledgersource§fn extend_contract_instance_and_code_ttl(
&self,
contract: AddressObject,
threshold: U32Val,
extend_to: U32Val
) -> Result<Void, <T as EnvBase>::Error>
fn extend_contract_instance_and_code_ttl( &self, contract: AddressObject, threshold: U32Val, extend_to: U32Val ) -> Result<Void, <T as EnvBase>::Error>
threshold
ledgers, extend live_until_ledger_seq
such that TTL == extend_to
, where TTL is defined as live_until_ledger_seq - current ledgersource§fn get_contract_id(
&self,
deployer: AddressObject,
salt: BytesObject
) -> Result<AddressObject, <T as EnvBase>::Error>
fn get_contract_id( &self, deployer: AddressObject, salt: BytesObject ) -> Result<AddressObject, <T as EnvBase>::Error>
deployer
is address of the contract deployer. salt
is used to create a unique contract id. Returns the address of the would-be contract.source§fn get_asset_contract_id(
&self,
serialized_asset: BytesObject
) -> Result<AddressObject, <T as EnvBase>::Error>
fn get_asset_contract_id( &self, serialized_asset: BytesObject ) -> Result<AddressObject, <T as EnvBase>::Error>
serialized_asset
is stellar::Asset
XDR serialized to bytes format. Returns the address of the would-be asset contract.source§fn call(
&self,
contract: AddressObject,
func: Symbol,
args: VecObject
) -> Result<Val, <T as EnvBase>::Error>
fn call( &self, contract: AddressObject, func: Symbol, args: VecObject ) -> Result<Val, <T as EnvBase>::Error>
args
. If the call is successful, returns the result of the called function. Traps otherwise.source§fn try_call(
&self,
contract: AddressObject,
func: Symbol,
args: VecObject
) -> Result<Val, <T as EnvBase>::Error>
fn try_call( &self, contract: AddressObject, func: Symbol, args: VecObject ) -> Result<Val, <T as EnvBase>::Error>
args
, returning either the result of the called function or an Error
if the called function failed. The returned error is either a custom ContractError
that the called contract returns explicitly, or an error with type Context
and code InvalidAction
in case of any other error in the called contract (such as a host function failure that caused a trap). try_call
might trap in a few scenarios where the error can’t be meaningfully recovered from, such as running out of budget.source§fn serialize_to_bytes(
&self,
v: Val
) -> Result<BytesObject, <T as EnvBase>::Error>
fn serialize_to_bytes( &self, v: Val ) -> Result<BytesObject, <T as EnvBase>::Error>
Bytes
object.source§fn deserialize_from_bytes(
&self,
b: BytesObject
) -> Result<Val, <T as EnvBase>::Error>
fn deserialize_from_bytes( &self, b: BytesObject ) -> Result<Val, <T as EnvBase>::Error>
Bytes
object to get back the (SC)Val.source§fn bytes_copy_to_linear_memory(
&self,
b: BytesObject,
b_pos: U32Val,
lm_pos: U32Val,
len: U32Val
) -> Result<Void, <T as EnvBase>::Error>
fn bytes_copy_to_linear_memory( &self, b: BytesObject, b_pos: U32Val, lm_pos: U32Val, len: U32Val ) -> Result<Void, <T as EnvBase>::Error>
Bytes
object specified at offset b_pos
with length len
into the linear memory at position lm_pos
. Traps if either the Bytes
object or the linear memory doesn’t have enough bytes.source§fn bytes_copy_from_linear_memory(
&self,
b: BytesObject,
b_pos: U32Val,
lm_pos: U32Val,
len: U32Val
) -> Result<BytesObject, <T as EnvBase>::Error>
fn bytes_copy_from_linear_memory( &self, b: BytesObject, b_pos: U32Val, lm_pos: U32Val, len: U32Val ) -> Result<BytesObject, <T as EnvBase>::Error>
lm_pos
with length len
, into a Bytes
object at offset b_pos
. The Bytes
object may grow in size to accommodate the new bytes. Traps if the linear memory doesn’t have enough bytes.source§fn bytes_new_from_linear_memory(
&self,
lm_pos: U32Val,
len: U32Val
) -> Result<BytesObject, <T as EnvBase>::Error>
fn bytes_new_from_linear_memory( &self, lm_pos: U32Val, len: U32Val ) -> Result<BytesObject, <T as EnvBase>::Error>
Bytes
object initialized with bytes copied from a linear memory slice specified at position lm_pos
with length len
.source§fn bytes_new(&self) -> Result<BytesObject, <T as EnvBase>::Error>
fn bytes_new(&self) -> Result<BytesObject, <T as EnvBase>::Error>
Bytes
object.source§fn bytes_put(
&self,
b: BytesObject,
i: U32Val,
u: U32Val
) -> Result<BytesObject, <T as EnvBase>::Error>
fn bytes_put( &self, b: BytesObject, i: U32Val, u: U32Val ) -> Result<BytesObject, <T as EnvBase>::Error>
i
in the Bytes
object. Return the new Bytes
. Trap if the index is out of bounds.source§fn bytes_get(
&self,
b: BytesObject,
i: U32Val
) -> Result<U32Val, <T as EnvBase>::Error>
fn bytes_get( &self, b: BytesObject, i: U32Val ) -> Result<U32Val, <T as EnvBase>::Error>
i
of the Bytes
object. Traps if the index is out of bound.source§fn bytes_del(
&self,
b: BytesObject,
i: U32Val
) -> Result<BytesObject, <T as EnvBase>::Error>
fn bytes_del( &self, b: BytesObject, i: U32Val ) -> Result<BytesObject, <T as EnvBase>::Error>
Bytes
object at index i
, shifting all elements after it to the left. Return the new Bytes
. Traps if the index is out of bound.source§fn bytes_len(&self, b: BytesObject) -> Result<U32Val, <T as EnvBase>::Error>
fn bytes_len(&self, b: BytesObject) -> Result<U32Val, <T as EnvBase>::Error>
Bytes
object.source§fn bytes_push(
&self,
b: BytesObject,
u: U32Val
) -> Result<BytesObject, <T as EnvBase>::Error>
fn bytes_push( &self, b: BytesObject, u: U32Val ) -> Result<BytesObject, <T as EnvBase>::Error>
Bytes
object.source§fn bytes_pop(
&self,
b: BytesObject
) -> Result<BytesObject, <T as EnvBase>::Error>
fn bytes_pop( &self, b: BytesObject ) -> Result<BytesObject, <T as EnvBase>::Error>
Bytes
object and returns the new Bytes
. Traps if original Bytes
is empty.source§fn bytes_front(&self, b: BytesObject) -> Result<U32Val, <T as EnvBase>::Error>
fn bytes_front(&self, b: BytesObject) -> Result<U32Val, <T as EnvBase>::Error>
Bytes
object. Traps if the Bytes
is emptysource§fn bytes_back(&self, b: BytesObject) -> Result<U32Val, <T as EnvBase>::Error>
fn bytes_back(&self, b: BytesObject) -> Result<U32Val, <T as EnvBase>::Error>
Bytes
object. Traps if the Bytes
is emptysource§fn bytes_insert(
&self,
b: BytesObject,
i: U32Val,
u: U32Val
) -> Result<BytesObject, <T as EnvBase>::Error>
fn bytes_insert( &self, b: BytesObject, i: U32Val, u: U32Val ) -> Result<BytesObject, <T as EnvBase>::Error>
i
within the Bytes
object, shifting all elements after it to the right. Traps if the index is out of boundsource§fn bytes_append(
&self,
b1: BytesObject,
b2: BytesObject
) -> Result<BytesObject, <T as EnvBase>::Error>
fn bytes_append( &self, b1: BytesObject, b2: BytesObject ) -> Result<BytesObject, <T as EnvBase>::Error>
Bytes
object b1
, then moves all the elements of Bytes
object b2
into it. Return the new Bytes
. Traps if its length overflows a u32.source§fn bytes_slice(
&self,
b: BytesObject,
start: U32Val,
end: U32Val
) -> Result<BytesObject, <T as EnvBase>::Error>
fn bytes_slice( &self, b: BytesObject, start: U32Val, end: U32Val ) -> Result<BytesObject, <T as EnvBase>::Error>
start
index until end
index, exclusive, in the Bytes
object and creates a new Bytes
from it. Returns the new Bytes
. Traps if the index is out of bound.source§fn string_copy_to_linear_memory(
&self,
s: StringObject,
s_pos: U32Val,
lm_pos: U32Val,
len: U32Val
) -> Result<Void, <T as EnvBase>::Error>
fn string_copy_to_linear_memory( &self, s: StringObject, s_pos: U32Val, lm_pos: U32Val, len: U32Val ) -> Result<Void, <T as EnvBase>::Error>
String
object specified at offset s_pos
with length len
into the linear memory at position lm_pos
. Traps if either the String
object or the linear memory doesn’t have enough bytes.source§fn symbol_copy_to_linear_memory(
&self,
s: SymbolObject,
s_pos: U32Val,
lm_pos: U32Val,
len: U32Val
) -> Result<Void, <T as EnvBase>::Error>
fn symbol_copy_to_linear_memory( &self, s: SymbolObject, s_pos: U32Val, lm_pos: U32Val, len: U32Val ) -> Result<Void, <T as EnvBase>::Error>
Symbol
object specified at offset s_pos
with length len
into the linear memory at position lm_pos
. Traps if either the String
object or the linear memory doesn’t have enough bytes.source§fn string_new_from_linear_memory(
&self,
lm_pos: U32Val,
len: U32Val
) -> Result<StringObject, <T as EnvBase>::Error>
fn string_new_from_linear_memory( &self, lm_pos: U32Val, len: U32Val ) -> Result<StringObject, <T as EnvBase>::Error>
String
object initialized with bytes copied from a linear memory slice specified at position lm_pos
with length len
.source§fn symbol_new_from_linear_memory(
&self,
lm_pos: U32Val,
len: U32Val
) -> Result<SymbolObject, <T as EnvBase>::Error>
fn symbol_new_from_linear_memory( &self, lm_pos: U32Val, len: U32Val ) -> Result<SymbolObject, <T as EnvBase>::Error>
Symbol
object initialized with bytes copied from a linear memory slice specified at position lm_pos
with length len
.source§fn string_len(&self, s: StringObject) -> Result<U32Val, <T as EnvBase>::Error>
fn string_len(&self, s: StringObject) -> Result<U32Val, <T as EnvBase>::Error>
String
object.source§fn symbol_len(&self, s: SymbolObject) -> Result<U32Val, <T as EnvBase>::Error>
fn symbol_len(&self, s: SymbolObject) -> Result<U32Val, <T as EnvBase>::Error>
Symbol
object.source§fn symbol_index_in_linear_memory(
&self,
sym: Symbol,
slices_pos: U32Val,
len: U32Val
) -> Result<U32Val, <T as EnvBase>::Error>
fn symbol_index_in_linear_memory( &self, sym: Symbol, slices_pos: U32Val, len: U32Val ) -> Result<U32Val, <T as EnvBase>::Error>
fn compute_hash_sha256( &self, x: BytesObject ) -> Result<BytesObject, <T as EnvBase>::Error>
fn verify_sig_ed25519( &self, k: BytesObject, x: BytesObject, s: BytesObject ) -> Result<Void, <T as EnvBase>::Error>
source§fn compute_hash_keccak256(
&self,
x: BytesObject
) -> Result<BytesObject, <T as EnvBase>::Error>
fn compute_hash_keccak256( &self, x: BytesObject ) -> Result<BytesObject, <T as EnvBase>::Error>
source§fn recover_key_ecdsa_secp256k1(
&self,
msg_digest: BytesObject,
signature: BytesObject,
recovery_id: U32Val
) -> Result<BytesObject, <T as EnvBase>::Error>
fn recover_key_ecdsa_secp256k1( &self, msg_digest: BytesObject, signature: BytesObject, recovery_id: U32Val ) -> Result<BytesObject, <T as EnvBase>::Error>
source§fn require_auth_for_args(
&self,
address: AddressObject,
args: VecObject
) -> Result<Void, <T as EnvBase>::Error>
fn require_auth_for_args( &self, address: AddressObject, args: VecObject ) -> Result<Void, <T as EnvBase>::Error>
source§fn require_auth(
&self,
address: AddressObject
) -> Result<Void, <T as EnvBase>::Error>
fn require_auth( &self, address: AddressObject ) -> Result<Void, <T as EnvBase>::Error>
source§fn strkey_to_address(
&self,
strkey: Val
) -> Result<AddressObject, <T as EnvBase>::Error>
fn strkey_to_address( &self, strkey: Val ) -> Result<AddressObject, <T as EnvBase>::Error>
strkey
can be either BytesObject
or StringObject
(the contents should represent the G.../C...
string in both cases). Any other valid or invalid strkey (e.g. ‘S…’) will trigger an error. Prefer directly using the Address objects whenever possible. This is only useful in the context of custom messaging protocols (e.g. cross-chain).source§fn address_to_strkey(
&self,
address: AddressObject
) -> Result<StringObject, <T as EnvBase>::Error>
fn address_to_strkey( &self, address: AddressObject ) -> Result<StringObject, <T as EnvBase>::Error>
InvokerContractAuthEntry
contract type that authorizes a tree of require_auth
calls on behalf of the current contract. The entries must not contain any authorizations for the direct contract call, i.e. if current contract needs to call contract function F1 that calls function F2 both of which require auth, only F2 should be present in auth_entries
.