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§
Sourcefn set_storage(
flags: u32,
key_ptr: u32,
key_len: u32,
value_ptr: u32,
value_len: u32,
) -> u32
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]
Sourcefn set_storage_or_clear(flags: u32, key_ptr: u32, value_ptr: u32) -> u32
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].
Sourcefn get_storage(
flags: u32,
key_ptr: u32,
key_len: u32,
out_ptr: u32,
out_len_ptr: u32,
) -> ReturnErrorCode
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]
Sourcefn get_storage_or_zero(flags: u32, key_ptr: u32, out_ptr: u32)
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].
Sourcefn 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( 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].
Sourcefn call_evm(
flags: u32,
callee: u32,
value_ptr: u32,
gas: 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
Make a call to another contract.
See [pallet_revive_uapi::HostFn::call_evm].
Sourcefn 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( 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].
Sourcefn delegate_call_evm(
flags: u32,
callee: u32,
gas: u64,
input_data: u64,
output_data: u64,
) -> ReturnErrorCode
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].
Sourcefn 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 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].
Sourcefn call_data_size() -> u64
fn call_data_size() -> u64
Returns the total size of the contract call input data.
See [pallet_revive_uapi::HostFn::call_data_size ].
Sourcefn call_data_copy(out_ptr: u32, out_len: u32, offset: u32)
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].
Sourcefn call_data_load(out_ptr: u32, offset: u32)
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].
Sourcefn seal_return(flags: u32, data_ptr: u32, data_len: u32)
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].
Sourcefn caller(out_ptr: u32)
fn caller(out_ptr: u32)
Stores the address of the caller into the supplied buffer.
See [pallet_revive_uapi::HostFn::caller].
Sourcefn origin(out_ptr: u32)
fn origin(out_ptr: u32)
Stores the address of the call stack origin into the supplied buffer.
See [pallet_revive_uapi::HostFn::origin].
Sourcefn code_hash(addr_ptr: u32, out_ptr: u32)
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].
Sourcefn code_size(addr_ptr: u32) -> u64
fn code_size(addr_ptr: u32) -> u64
Retrieve the code size for a given contract address.
See [pallet_revive_uapi::HostFn::code_size].
Sourcefn address(out_ptr: u32)
fn address(out_ptr: u32)
Stores the address of the current contract into the supplied buffer.
See [pallet_revive_uapi::HostFn::address].
Sourcefn get_immutable_data(out_ptr: u32, out_len_ptr: u32)
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].
Sourcefn set_immutable_data(ptr: u32, len: u32)
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].
Sourcefn balance(out_ptr: u32)
fn balance(out_ptr: u32)
Stores the free balance of the current account into the supplied buffer.
See [pallet_revive_uapi::HostFn::balance].
Sourcefn balance_of(addr_ptr: u32, out_ptr: u32)
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].
Sourcefn gas_limit() -> u64
fn gas_limit() -> u64
Returns the block ref_time limit.
See [pallet_revive_uapi::HostFn::gas_limit].
Sourcefn value_transferred(out_ptr: u32)
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].
Sourcefn gas_price() -> u64
fn gas_price() -> u64
Returns the simulated ethereum GASPRICE value.
See [pallet_revive_uapi::HostFn::gas_price].
Sourcefn base_fee(out_ptr: u32)
fn base_fee(out_ptr: u32)
Returns the simulated ethereum BASEFEE value.
See [pallet_revive_uapi::HostFn::base_fee].
Sourcefn now(out_ptr: u32)
fn now(out_ptr: u32)
Load the latest block timestamp into the supplied buffer
See [pallet_revive_uapi::HostFn::now].
Sourcefn deposit_event(topics_ptr: u32, num_topic: u32, data_ptr: u32, data_len: u32)
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]
Sourcefn block_number(out_ptr: u32)
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].
Sourcefn block_hash(block_number_ptr: u32, out_ptr: u32)
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].
Stores the current block author into the supplied buffer.
See [pallet_revive_uapi::HostFn::block_author].
Sourcefn hash_keccak_256(input_ptr: u32, input_len: u32, output_ptr: u32)
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].
Sourcefn return_data_size() -> u64
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].
Sourcefn return_data_copy(out_ptr: u32, out_len_ptr: u32, offset: u32)
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].
Sourcefn ref_time_left() -> u64
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].
Sourcefn consume_all_gas()
fn consume_all_gas()
Reverts the execution without data and cedes all remaining gas.
See [pallet_revive_uapi::HostFn::consume_all_gas].
Sourcefn ecdsa_to_eth_address(key_ptr: u32, out_ptr: u32) -> ReturnErrorCode
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.
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.