pub enum HostFnImpl {}Expand description
Implements HostFn when compiled on supported architectures (RISC-V).
Trait Implementations§
Source§impl HostFn for HostFnImpl
impl HostFn for HostFnImpl
Source§fn instantiate(
ref_time_limit: u64,
proof_size_limit: u64,
deposit_limit: &[u8; 32],
value: &[u8; 32],
input: &[u8],
address: Option<&mut [u8; 20]>,
output: Option<&mut &mut [u8]>,
salt: Option<&[u8; 32]>,
) -> Result<(), ReturnErrorCode>
fn instantiate( ref_time_limit: u64, proof_size_limit: u64, deposit_limit: &[u8; 32], value: &[u8; 32], input: &[u8], address: Option<&mut [u8; 20]>, output: Option<&mut &mut [u8]>, salt: Option<&[u8; 32]>, ) -> Result<(), ReturnErrorCode>
Instantiate a contract with the specified code hash. Read more
Source§fn call(
flags: CallFlags,
callee: &[u8; 20],
ref_time_limit: u64,
proof_size_limit: u64,
deposit_limit: &[u8; 32],
value: &[u8; 32],
input: &[u8],
output: Option<&mut &mut [u8]>,
) -> Result<(), ReturnErrorCode>
fn call( flags: CallFlags, callee: &[u8; 20], ref_time_limit: u64, proof_size_limit: u64, deposit_limit: &[u8; 32], value: &[u8; 32], input: &[u8], output: Option<&mut &mut [u8]>, ) -> Result<(), ReturnErrorCode>
Call (possibly transferring some amount of funds) into the specified account. Read more
Source§fn delegate_call(
flags: CallFlags,
address: &[u8; 20],
ref_time_limit: u64,
proof_size_limit: u64,
deposit_limit: &[u8; 32],
input: &[u8],
output: Option<&mut &mut [u8]>,
) -> Result<(), ReturnErrorCode>
fn delegate_call( flags: CallFlags, address: &[u8; 20], ref_time_limit: u64, proof_size_limit: u64, deposit_limit: &[u8; 32], input: &[u8], output: Option<&mut &mut [u8]>, ) -> Result<(), ReturnErrorCode>
Execute code in the context (storage, caller, value) of the current contract. Read more
Source§fn deposit_event(topics: &[[u8; 32]], data: &[u8])
fn deposit_event(topics: &[[u8; 32]], data: &[u8])
Deposit a contract event with the data buffer and optional list of topics. There is a limit
on the maximum number of topics specified by
event_topics. Read moreSource§fn set_storage(
flags: StorageFlags,
key: &[u8],
encoded_value: &[u8],
) -> Option<u32>
fn set_storage( flags: StorageFlags, key: &[u8], encoded_value: &[u8], ) -> Option<u32>
Set the value at the given key in the contract storage. Read more
Source§fn get_storage(
flags: StorageFlags,
key: &[u8],
output: &mut &mut [u8],
) -> Result<(), ReturnErrorCode>
fn get_storage( flags: StorageFlags, key: &[u8], output: &mut &mut [u8], ) -> Result<(), ReturnErrorCode>
Retrieve the value under the given key from storage. Read more
Source§fn call_data_load(out_ptr: &mut [u8; 32], offset: u32)
fn call_data_load(out_ptr: &mut [u8; 32], offset: u32)
Stores the U256 value at given
offset from the input passed by the caller
into the supplied buffer. Read moreSource§fn call_data_size() -> u64
fn call_data_size() -> u64
Returns the call data size.
Source§fn return_value(flags: ReturnFlags, return_value: &[u8]) -> !
fn return_value(flags: ReturnFlags, return_value: &[u8]) -> !
Cease contract execution and save a data buffer as a result of the execution. Read more
Source§fn balance(output: &mut [u8; 32])
fn balance(output: &mut [u8; 32])
Stores the reducible balance of the current account into the supplied buffer. Read more
Source§fn value_transferred(output: &mut [u8; 32])
fn value_transferred(output: &mut [u8; 32])
Stores the value transferred along with this call/instantiate into the supplied buffer. Read more
Source§fn now(output: &mut [u8; 32])
fn now(output: &mut [u8; 32])
Load the latest block timestamp in seconds into the supplied buffer Read more
Source§fn address(output: &mut [u8; 20])
fn address(output: &mut [u8; 20])
Stores the address of the current contract into the supplied buffer. Read more
Source§fn caller(output: &mut [u8; 20])
fn caller(output: &mut [u8; 20])
Stores the address of the caller into the supplied buffer. Read more
Source§fn origin(output: &mut [u8; 20])
fn origin(output: &mut [u8; 20])
Stores the origin address (initator of the call stack) into the supplied buffer. Read more
Source§fn block_number(output: &mut [u8; 32])
fn block_number(output: &mut [u8; 32])
Stores the current block number of the current contract into the supplied buffer. Read more
Stores the current block author of into the supplied buffer. Read more
Source§fn weight_to_fee(
ref_time_limit: u64,
proof_size_limit: u64,
output: &mut [u8; 32],
)
fn weight_to_fee( ref_time_limit: u64, proof_size_limit: u64, output: &mut [u8; 32], )
Stores the price for the specified amount of gas into the supplied buffer. Read more
Source§fn hash_keccak_256(input: &[u8], output: &mut [u8; 32])
fn hash_keccak_256(input: &[u8], output: &mut [u8; 32])
Computes the keccak_256 32-bit hash on the given input buffer. Read more
Source§fn get_immutable_data(output: &mut &mut [u8])
fn get_immutable_data(output: &mut &mut [u8])
Get the contract immutable data. Read more
Source§fn set_immutable_data(data: &[u8])
fn set_immutable_data(data: &[u8])
Set the contract immutable data. Read more
Source§fn balance_of(address: &[u8; 20], output: &mut [u8; 32])
fn balance_of(address: &[u8; 20], output: &mut [u8; 32])
Stores the reducible balance of the supplied address into the supplied buffer. Read more
Source§fn code_hash(address: &[u8; 20], output: &mut [u8; 32])
fn code_hash(address: &[u8; 20], output: &mut [u8; 32])
Retrieve the code hash for a specified contract address. Read more
Source§fn code_size(address: &[u8; 20]) -> u64
fn code_size(address: &[u8; 20]) -> u64
Returns the code size for a specified contract address. Read more
Source§fn return_data_size() -> u64
fn return_data_size() -> u64
Returns the size of the returned data of the last contract call or instantiation.
Source§fn return_data_copy(output: &mut &mut [u8], offset: u32)
fn return_data_copy(output: &mut &mut [u8], offset: u32)
Stores the returned data of the last contract call or contract instantiation. Read more
Source§fn ref_time_left() -> u64
fn ref_time_left() -> u64
Returns the amount of ref_time left.
Source§fn to_account_id(address: &[u8; 20], output: &mut [u8])
fn to_account_id(address: &[u8; 20], output: &mut [u8])
Available on crate feature
unstable-hostfn only.Retrieve the account id for a specified address. Read more
Source§fn block_hash(block_number_ptr: &[u8; 32], output: &mut [u8; 32])
fn block_hash(block_number_ptr: &[u8; 32], output: &mut [u8; 32])
Available on crate feature
unstable-hostfn only.Stores the block hash of the given block number into the supplied buffer. Read more
Source§fn call_chain_extension(
func_id: u32,
input: &[u8],
output: Option<&mut &mut [u8]>,
) -> u32
fn call_chain_extension( func_id: u32, input: &[u8], output: Option<&mut &mut [u8]>, ) -> u32
Available on crate feature
unstable-hostfn only.Call into the chain extension provided by the chain if any. Read more
Source§fn call_data_copy(output: &mut [u8], offset: u32)
fn call_data_copy(output: &mut [u8], offset: u32)
Stores the input data passed by the caller into the supplied
output buffer,
starting from the given input data offset. Read moreSource§fn call_runtime(call: &[u8]) -> Result<(), ReturnErrorCode>
fn call_runtime(call: &[u8]) -> Result<(), ReturnErrorCode>
Available on crate feature
unstable-hostfn only.Call some dispatchable of the runtime. Read more
Source§fn caller_is_origin() -> bool
fn caller_is_origin() -> bool
Available on crate feature
unstable-hostfn only.Checks whether the caller of the current contract is the origin of the whole call stack. Read more
Source§fn caller_is_root() -> bool
fn caller_is_root() -> bool
Available on crate feature
unstable-hostfn only.Checks whether the caller of the current contract is root. Read more
Source§fn clear_storage(flags: StorageFlags, key: &[u8]) -> Option<u32>
fn clear_storage(flags: StorageFlags, key: &[u8]) -> Option<u32>
Available on crate feature
unstable-hostfn only.Clear the value at the given key in the contract storage. Read more
Source§fn contains_storage(flags: StorageFlags, key: &[u8]) -> Option<u32>
fn contains_storage(flags: StorageFlags, key: &[u8]) -> Option<u32>
Available on crate feature
unstable-hostfn only.Checks whether there is a value stored under the given key. Read more
Source§fn ecdsa_to_eth_address(
pubkey: &[u8; 33],
output: &mut [u8; 20],
) -> Result<(), ReturnErrorCode>
fn ecdsa_to_eth_address( pubkey: &[u8; 33], output: &mut [u8; 20], ) -> Result<(), ReturnErrorCode>
Available on crate feature
unstable-hostfn only.Calculates Ethereum address from the ECDSA compressed public key and stores
it into the supplied buffer. Read more
Source§fn hash_blake2_256(input: &[u8], output: &mut [u8; 32])
fn hash_blake2_256(input: &[u8], output: &mut [u8; 32])
Available on crate feature
unstable-hostfn only.Computes the blake2_256 32-bit hash on the given input buffer. Read more
Source§fn hash_blake2_128(input: &[u8], output: &mut [u8; 16])
fn hash_blake2_128(input: &[u8], output: &mut [u8; 16])
Available on crate feature
unstable-hostfn only.Computes the blake2_128 16-bit hash on the given input buffer. Read more
Source§fn is_contract(address: &[u8; 20]) -> bool
fn is_contract(address: &[u8; 20]) -> bool
Available on crate feature
unstable-hostfn only.Checks whether a specified address belongs to a contract. Read more
Source§fn minimum_balance(output: &mut [u8; 32])
fn minimum_balance(output: &mut [u8; 32])
Available on crate feature
unstable-hostfn only.Stores the minimum balance (a.k.a. existential deposit) into the supplied buffer. Read more
Source§fn own_code_hash(output: &mut [u8; 32])
fn own_code_hash(output: &mut [u8; 32])
Available on crate feature
unstable-hostfn only.Retrieve the code hash of the currently executing contract. Read more
Source§fn set_code_hash(code_hash: &[u8; 32])
fn set_code_hash(code_hash: &[u8; 32])
Available on crate feature
unstable-hostfn only.Replace the contract code at the specified address with new code. Read more
Source§fn sr25519_verify(
signature: &[u8; 64],
message: &[u8],
pub_key: &[u8; 32],
) -> Result<(), ReturnErrorCode>
fn sr25519_verify( signature: &[u8; 64], message: &[u8], pub_key: &[u8; 32], ) -> Result<(), ReturnErrorCode>
Available on crate feature
unstable-hostfn only.Verify a sr25519 signature Read more
Source§fn take_storage(
flags: StorageFlags,
key: &[u8],
output: &mut &mut [u8],
) -> Result<(), ReturnErrorCode>
fn take_storage( flags: StorageFlags, key: &[u8], output: &mut &mut [u8], ) -> Result<(), ReturnErrorCode>
Available on crate feature
unstable-hostfn only.Retrieve and remove the value under the given key from storage. Read more
Source§fn terminate(beneficiary: &[u8; 20]) -> !
fn terminate(beneficiary: &[u8; 20]) -> !
Available on crate feature
unstable-hostfn only.Remove the calling account and transfer remaining free balance. Read more
Source§fn weight_left(output: &mut &mut [u8])
fn weight_left(output: &mut &mut [u8])
Available on crate feature
unstable-hostfn only.Stores the amount of weight left into the supplied buffer.
The data is encoded as Weight. Read more
Source§fn xcm_execute(msg: &[u8]) -> Result<(), ReturnErrorCode>
fn xcm_execute(msg: &[u8]) -> Result<(), ReturnErrorCode>
Available on crate feature
unstable-hostfn only.Execute an XCM program locally, using the contract’s address as the origin.
This is equivalent to dispatching
pallet_xcm::execute through call_runtime, except that
the function is called directly instead of being dispatched. Read moreSource§fn xcm_send(
dest: &[u8],
msg: &[u8],
output: &mut [u8; 32],
) -> Result<(), ReturnErrorCode>
fn xcm_send( dest: &[u8], msg: &[u8], output: &mut [u8; 32], ) -> Result<(), ReturnErrorCode>
Available on crate feature
unstable-hostfn only.Send an XCM program from the contract to the specified destination.
This is equivalent to dispatching
pallet_xcm::send through call_runtime, except that
the function is called directly instead of being dispatched. Read moreAuto Trait Implementations§
impl Freeze for HostFnImpl
impl RefUnwindSafe for HostFnImpl
impl Send for HostFnImpl
impl Sync for HostFnImpl
impl Unpin for HostFnImpl
impl UnwindSafe for HostFnImpl
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
Mutably borrows from an owned value. Read more