referrerpolicy=no-referrer-when-downgrade

SyscallDoc

Trait SyscallDoc 

Source
pub trait SyscallDoc {
Show 41 methods // Required methods fn noop(); fn set_storage( flags: u32, key_ptr: u32, key_len: u32, value_ptr: u32, value_len: u32, ) -> u32; fn set_storage_or_clear(flags: u32, key_ptr: u32, value_ptr: u32) -> u32; fn get_storage( flags: u32, key_ptr: u32, key_len: u32, out_ptr: u32, out_len_ptr: u32, ) -> ReturnErrorCode; fn get_storage_or_zero(flags: u32, key_ptr: u32, out_ptr: u32); fn call( flags_and_callee: u64, ref_time_limit: u64, proof_size_limit: u64, deposit_and_value: u64, input_data: u64, output_data: u64, ) -> ReturnErrorCode; fn call_evm( flags: u32, callee: u32, value_ptr: u32, gas: u64, input_data: u64, output_data: u64, ) -> ReturnErrorCode; fn delegate_call( flags_and_callee: u64, ref_time_limit: u64, proof_size_limit: u64, deposit_ptr: u32, input_data: u64, output_data: u64, ) -> ReturnErrorCode; fn delegate_call_evm( flags: u32, callee: u32, gas: u64, input_data: u64, output_data: u64, ) -> ReturnErrorCode; fn instantiate( ref_time_limit: u64, proof_size_limit: u64, deposit_and_value: u64, input_data: u64, output_data: u64, address_and_salt: u64, ) -> ReturnErrorCode; fn call_data_size() -> u64; fn call_data_copy(out_ptr: u32, out_len: u32, offset: u32); fn call_data_load(out_ptr: u32, offset: u32); fn seal_return(flags: u32, data_ptr: u32, data_len: u32); fn caller(out_ptr: u32); fn origin(out_ptr: u32); fn code_hash(addr_ptr: u32, out_ptr: u32); fn code_size(addr_ptr: u32) -> u64; fn address(out_ptr: u32); fn get_immutable_data(out_ptr: u32, out_len_ptr: u32); fn set_immutable_data(ptr: u32, len: u32); fn balance(out_ptr: u32); fn balance_of(addr_ptr: u32, out_ptr: u32); fn chain_id(out_ptr: u32); fn gas_limit() -> u64; fn value_transferred(out_ptr: u32); fn gas_price() -> u64; fn base_fee(out_ptr: u32); fn now(out_ptr: u32); fn deposit_event( topics_ptr: u32, num_topic: u32, data_ptr: u32, data_len: u32, ); fn block_number(out_ptr: u32); fn block_hash(block_number_ptr: u32, out_ptr: u32); fn block_author(out_ptr: u32); fn hash_keccak_256(input_ptr: u32, input_len: u32, output_ptr: u32); fn return_data_size() -> u64; fn return_data_copy(out_ptr: u32, out_len_ptr: u32, offset: u32); fn ref_time_left() -> u64; fn consume_all_gas(); fn ecdsa_to_eth_address(key_ptr: u32, out_ptr: u32) -> ReturnErrorCode; fn sr25519_verify( signature_ptr: u32, pub_key_ptr: u32, message_len: u32, message_ptr: u32, ) -> ReturnErrorCode; fn terminate(beneficiary_ptr: u32);
}
Expand description

Documentation of the syscalls (host functions) available to contracts.

Each of the functions in this trait represent a function that is callable by the contract. Guests use the function name as the import symbol.

§Note

This module is not meant to be used by any code. Rather, it is meant to be consumed by humans through rustdoc.

Required Methods§

Source

fn noop()

Noop function used to benchmark the time it takes to execute an empty function.

Source

fn set_storage( flags: u32, key_ptr: u32, key_len: u32, value_ptr: u32, value_len: u32, ) -> u32

Set the value at the given key in the contract storage. See [pallet_revive_uapi::HostFn::set_storage]

Source

fn set_storage_or_clear(flags: u32, key_ptr: u32, value_ptr: u32) -> u32

Sets the storage at a fixed 256-bit key with a fixed 256-bit value. See [pallet_revive_uapi::HostFn::set_storage_or_clear].

Source

fn get_storage( flags: u32, key_ptr: u32, key_len: u32, out_ptr: u32, out_len_ptr: u32, ) -> ReturnErrorCode

Retrieve the value under the given key from storage. See [pallet_revive_uapi::HostFn::get_storage]

Source

fn get_storage_or_zero(flags: u32, key_ptr: u32, out_ptr: u32)

Reads the storage at a fixed 256-bit key and writes back a fixed 256-bit value. See [pallet_revive_uapi::HostFn::get_storage_or_zero].

Source

fn call( flags_and_callee: u64, ref_time_limit: u64, proof_size_limit: u64, deposit_and_value: u64, input_data: u64, output_data: u64, ) -> ReturnErrorCode

Make a call to another contract. See [pallet_revive_uapi::HostFn::call].

Source

fn call_evm( flags: u32, callee: u32, value_ptr: u32, gas: u64, input_data: u64, output_data: u64, ) -> ReturnErrorCode

Make a call to another contract. See [pallet_revive_uapi::HostFn::call_evm].

Source

fn delegate_call( flags_and_callee: u64, ref_time_limit: u64, proof_size_limit: u64, deposit_ptr: u32, input_data: u64, output_data: u64, ) -> ReturnErrorCode

Execute code in the context (storage, caller, value) of the current contract. See [pallet_revive_uapi::HostFn::delegate_call].

Source

fn delegate_call_evm( flags: u32, callee: u32, gas: u64, input_data: u64, output_data: u64, ) -> ReturnErrorCode

Same as delegate_call but with EVM gas. See [pallet_revive_uapi::HostFn::delegate_call_evm].

Source

fn instantiate( ref_time_limit: u64, proof_size_limit: u64, deposit_and_value: u64, input_data: u64, output_data: u64, address_and_salt: u64, ) -> ReturnErrorCode

Instantiate a contract with the specified code hash. See [pallet_revive_uapi::HostFn::instantiate].

Source

fn call_data_size() -> u64

Returns the total size of the contract call input data. See [pallet_revive_uapi::HostFn::call_data_size ].

Source

fn call_data_copy(out_ptr: u32, out_len: u32, offset: u32)

Stores the input passed by the caller into the supplied buffer. See [pallet_revive_uapi::HostFn::call_data_copy].

Source

fn call_data_load(out_ptr: u32, offset: u32)

Stores the U256 value at given call input offset into the supplied buffer. See [pallet_revive_uapi::HostFn::call_data_load].

Source

fn seal_return(flags: u32, data_ptr: u32, data_len: u32)

Cease contract execution and save a data buffer as a result of the execution. See [pallet_revive_uapi::HostFn::return_value].

Source

fn caller(out_ptr: u32)

Stores the address of the caller into the supplied buffer. See [pallet_revive_uapi::HostFn::caller].

Source

fn origin(out_ptr: u32)

Stores the address of the call stack origin into the supplied buffer. See [pallet_revive_uapi::HostFn::origin].

Source

fn code_hash(addr_ptr: u32, out_ptr: u32)

Retrieve the code hash for a specified contract address. See [pallet_revive_uapi::HostFn::code_hash].

Source

fn code_size(addr_ptr: u32) -> u64

Retrieve the code size for a given contract address. See [pallet_revive_uapi::HostFn::code_size].

Source

fn address(out_ptr: u32)

Stores the address of the current contract into the supplied buffer. See [pallet_revive_uapi::HostFn::address].

Source

fn get_immutable_data(out_ptr: u32, out_len_ptr: u32)

Stores the immutable data into the supplied buffer. See [pallet_revive_uapi::HostFn::get_immutable_data].

Source

fn set_immutable_data(ptr: u32, len: u32)

Attaches the supplied immutable data to the currently executing contract. See [pallet_revive_uapi::HostFn::set_immutable_data].

Source

fn balance(out_ptr: u32)

Stores the free balance of the current account into the supplied buffer. See [pallet_revive_uapi::HostFn::balance].

Source

fn balance_of(addr_ptr: u32, out_ptr: u32)

Stores the free balance of the supplied address into the supplied buffer. See [pallet_revive_uapi::HostFn::balance].

Source

fn chain_id(out_ptr: u32)

Returns the chain ID. See [pallet_revive_uapi::HostFn::chain_id].

Source

fn gas_limit() -> u64

Returns the block ref_time limit. See [pallet_revive_uapi::HostFn::gas_limit].

Source

fn value_transferred(out_ptr: u32)

Stores the value transferred along with this call/instantiate into the supplied buffer. See [pallet_revive_uapi::HostFn::value_transferred].

Source

fn gas_price() -> u64

Returns the simulated ethereum GASPRICE value. See [pallet_revive_uapi::HostFn::gas_price].

Source

fn base_fee(out_ptr: u32)

Returns the simulated ethereum BASEFEE value. See [pallet_revive_uapi::HostFn::base_fee].

Source

fn now(out_ptr: u32)

Load the latest block timestamp into the supplied buffer See [pallet_revive_uapi::HostFn::now].

Source

fn deposit_event(topics_ptr: u32, num_topic: u32, data_ptr: u32, data_len: u32)

Deposit a contract event with the data buffer and optional list of topics. See [pallet_revive_uapi::HostFn::deposit_event]

Source

fn block_number(out_ptr: u32)

Stores the current block number of the current contract into the supplied buffer. See [pallet_revive_uapi::HostFn::block_number].

Source

fn block_hash(block_number_ptr: u32, out_ptr: u32)

Stores the block hash at given block height into the supplied buffer. See [pallet_revive_uapi::HostFn::block_hash].

Source

fn block_author(out_ptr: u32)

Stores the current block author into the supplied buffer. See [pallet_revive_uapi::HostFn::block_author].

Source

fn hash_keccak_256(input_ptr: u32, input_len: u32, output_ptr: u32)

Computes the KECCAK 256-bit hash on the given input buffer. See [pallet_revive_uapi::HostFn::hash_keccak_256].

Source

fn return_data_size() -> u64

Stores the length of the data returned by the last call into the supplied buffer. See [pallet_revive_uapi::HostFn::return_data_size].

Source

fn return_data_copy(out_ptr: u32, out_len_ptr: u32, offset: u32)

Stores data returned by the last call, starting from offset, into the supplied buffer. See [pallet_revive_uapi::HostFn::return_data_copy].

Source

fn ref_time_left() -> u64

Returns the amount of evm gas left.

The name is only for historical reasons as renaming functions would be a breaking change.

See [pallet_revive_uapi::HostFn::gas_left].

Source

fn consume_all_gas()

Reverts the execution without data and cedes all remaining gas.

See [pallet_revive_uapi::HostFn::consume_all_gas].

Source

fn ecdsa_to_eth_address(key_ptr: u32, out_ptr: u32) -> ReturnErrorCode

Calculates Ethereum address from the ECDSA compressed public key and stores See uapi/sol/ISystem.sol.

Source

fn sr25519_verify( signature_ptr: u32, pub_key_ptr: u32, message_len: u32, message_ptr: u32, ) -> ReturnErrorCode

Verify a sr25519 signature See uapi/sol/ISystem.sol.

Source

fn terminate(beneficiary_ptr: u32)

Remove the calling account and transfer remaining balance: total balance if code is deleted from storage, else free balance only. See [pallet_revive_uapi::HostFn::terminate].

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§