Trait pallet_contracts::api_doc::Version1
source · pub trait Version1 {
Show 22 methods
// Required methods
fn set_storage(
key_ptr: u32,
value_ptr: u32,
value_len: u32,
) -> Result<u32, TrapReason>;
fn clear_storage(key_ptr: u32, key_len: u32) -> Result<u32, TrapReason>;
fn get_storage(
key_ptr: u32,
key_len: u32,
out_ptr: u32,
out_len_ptr: u32,
) -> Result<ReturnErrorCode, TrapReason>;
fn contains_storage(key_ptr: u32, key_len: u32) -> Result<u32, TrapReason>;
fn call(
flags: u32,
callee_ptr: u32,
gas: u64,
value_ptr: u32,
input_data_ptr: u32,
input_data_len: u32,
output_ptr: u32,
output_len_ptr: u32,
) -> Result<ReturnErrorCode, TrapReason>;
fn instantiate(
code_hash_ptr: u32,
gas: u64,
value_ptr: u32,
input_data_ptr: u32,
input_data_len: u32,
address_ptr: u32,
address_len_ptr: u32,
output_ptr: u32,
output_len_ptr: u32,
salt_ptr: u32,
salt_len: u32,
) -> Result<ReturnErrorCode, TrapReason>;
fn terminate(beneficiary_ptr: u32) -> Result<(), TrapReason>;
fn weight_to_fee(
ref_time_limit: u64,
proof_size_limit: u64,
out_ptr: u32,
out_len_ptr: u32,
) -> Result<(), TrapReason>;
fn gas_left(out_ptr: u32, out_len_ptr: u32) -> Result<(), TrapReason>;
fn random(
subject_ptr: u32,
subject_len: u32,
out_ptr: u32,
out_len_ptr: u32,
) -> Result<(), TrapReason>;
fn restore_to(
_dest_ptr: u32,
_code_hash_ptr: u32,
_rent_allowance_ptr: u32,
_delta_ptr: u32,
_delta_count: u32,
) -> Result<(), TrapReason>;
fn set_rent_allowance(_value_ptr: u32) -> Result<(), TrapReason>;
fn seal_set_storage(
key_ptr: u32,
value_ptr: u32,
value_len: u32,
) -> Result<u32, TrapReason>;
fn seal_clear_storage(key_ptr: u32, key_len: u32) -> Result<u32, TrapReason>;
fn seal_get_storage(
key_ptr: u32,
key_len: u32,
out_ptr: u32,
out_len_ptr: u32,
) -> Result<ReturnErrorCode, TrapReason>;
fn seal_contains_storage(
key_ptr: u32,
key_len: u32,
) -> Result<u32, TrapReason>;
fn seal_call(
flags: u32,
callee_ptr: u32,
gas: u64,
value_ptr: u32,
input_data_ptr: u32,
input_data_len: u32,
output_ptr: u32,
output_len_ptr: u32,
) -> Result<ReturnErrorCode, TrapReason>;
fn seal_instantiate(
code_hash_ptr: u32,
gas: u64,
value_ptr: u32,
input_data_ptr: u32,
input_data_len: u32,
address_ptr: u32,
address_len_ptr: u32,
output_ptr: u32,
output_len_ptr: u32,
salt_ptr: u32,
salt_len: u32,
) -> Result<ReturnErrorCode, TrapReason>;
fn seal_terminate(beneficiary_ptr: u32) -> Result<(), TrapReason>;
fn seal_random(
subject_ptr: u32,
subject_len: u32,
out_ptr: u32,
out_len_ptr: u32,
) -> Result<(), TrapReason>;
fn seal_restore_to(
_dest_ptr: u32,
_code_hash_ptr: u32,
_rent_allowance_ptr: u32,
_delta_ptr: u32,
_delta_count: u32,
) -> Result<(), TrapReason>;
fn seal_set_rent_allowance(_value_ptr: u32) -> Result<(), TrapReason>;
}
Expand description
All functions available in the seal1 module
Required Methods§
sourcefn set_storage(
key_ptr: u32,
value_ptr: u32,
value_len: u32,
) -> Result<u32, TrapReason>
fn set_storage( key_ptr: u32, value_ptr: u32, value_len: u32, ) -> Result<u32, TrapReason>
Set the value at the given key in the contract storage.
See [pallet_contracts_uapi::HostFn::set_storage_v1
]
§Wasm Import Statement
(import "seal1" "set_storage" (func ...))
sourcefn clear_storage(key_ptr: u32, key_len: u32) -> Result<u32, TrapReason>
fn clear_storage(key_ptr: u32, key_len: u32) -> Result<u32, TrapReason>
Clear the value at the given key in the contract storage.
See [pallet_contracts_uapi::HostFn::clear_storage_v1
]
§Wasm Import Statement
(import "seal1" "clear_storage" (func ...))
sourcefn get_storage(
key_ptr: u32,
key_len: u32,
out_ptr: u32,
out_len_ptr: u32,
) -> Result<ReturnErrorCode, TrapReason>
fn get_storage( key_ptr: u32, key_len: u32, out_ptr: u32, out_len_ptr: u32, ) -> Result<ReturnErrorCode, TrapReason>
Retrieve the value under the given key from storage.
See [pallet_contracts_uapi::HostFn::get_storage_v1
]
§Wasm Import Statement
(import "seal1" "get_storage" (func ...))
sourcefn contains_storage(key_ptr: u32, key_len: u32) -> Result<u32, TrapReason>
fn contains_storage(key_ptr: u32, key_len: u32) -> Result<u32, TrapReason>
Checks whether there is a value stored under the given key.
See [pallet_contracts_uapi::HostFn::contains_storage_v1
]
§Wasm Import Statement
(import "seal1" "contains_storage" (func ...))
sourcefn call(
flags: u32,
callee_ptr: u32,
gas: u64,
value_ptr: u32,
input_data_ptr: u32,
input_data_len: u32,
output_ptr: u32,
output_len_ptr: u32,
) -> Result<ReturnErrorCode, TrapReason>
fn call( flags: u32, callee_ptr: u32, gas: u64, value_ptr: u32, input_data_ptr: u32, input_data_len: u32, output_ptr: u32, output_len_ptr: u32, ) -> Result<ReturnErrorCode, TrapReason>
Make a call to another contract.
See [pallet_contracts_uapi::HostFn::call_v1
].
§Wasm Import Statement
(import "seal1" "call" (func ...))
sourcefn instantiate(
code_hash_ptr: u32,
gas: u64,
value_ptr: u32,
input_data_ptr: u32,
input_data_len: u32,
address_ptr: u32,
address_len_ptr: u32,
output_ptr: u32,
output_len_ptr: u32,
salt_ptr: u32,
salt_len: u32,
) -> Result<ReturnErrorCode, TrapReason>
fn instantiate( code_hash_ptr: u32, gas: u64, value_ptr: u32, input_data_ptr: u32, input_data_len: u32, address_ptr: u32, address_len_ptr: u32, output_ptr: u32, output_len_ptr: u32, salt_ptr: u32, salt_len: u32, ) -> Result<ReturnErrorCode, TrapReason>
Instantiate a contract with the specified code hash.
See [pallet_contracts_uapi::HostFn::instantiate_v1
].
§Wasm Import Statement
(import "seal1" "instantiate" (func ...))
sourcefn terminate(beneficiary_ptr: u32) -> Result<(), TrapReason>
fn terminate(beneficiary_ptr: u32) -> Result<(), TrapReason>
Remove the calling account and transfer remaining free balance.
See [pallet_contracts_uapi::HostFn::terminate_v1
].
§Wasm Import Statement
(import "seal1" "terminate" (func ...))
sourcefn weight_to_fee(
ref_time_limit: u64,
proof_size_limit: u64,
out_ptr: u32,
out_len_ptr: u32,
) -> Result<(), TrapReason>
fn weight_to_fee( ref_time_limit: u64, proof_size_limit: u64, out_ptr: u32, out_len_ptr: u32, ) -> Result<(), TrapReason>
Stores the price for the specified amount of weight into the supplied buffer.
See [pallet_contracts_uapi::HostFn::weight_to_fee_v1
].
§Wasm Import Statement
(import "seal1" "weight_to_fee" (func ...))
§Unstable
This function is unstable and it is a subject to change (or removal) in the future. Do not deploy a contract using it to a production chain.
sourcefn gas_left(out_ptr: u32, out_len_ptr: u32) -> Result<(), TrapReason>
fn gas_left(out_ptr: u32, out_len_ptr: u32) -> Result<(), TrapReason>
Stores the amount of weight left into the supplied buffer.
See [pallet_contracts_uapi::HostFn::gas_left_v1
].
§Wasm Import Statement
(import "seal1" "gas_left" (func ...))
§Unstable
This function is unstable and it is a subject to change (or removal) in the future. Do not deploy a contract using it to a production chain.
sourcefn random(
subject_ptr: u32,
subject_len: u32,
out_ptr: u32,
out_len_ptr: u32,
) -> Result<(), TrapReason>
fn random( subject_ptr: u32, subject_len: u32, out_ptr: u32, out_len_ptr: u32, ) -> Result<(), TrapReason>
§Deprecated
This function is deprecated and will be removed in future versions. No new code or contracts with this API can be deployed. Stores a random number for the current block and the given subject into the supplied buffer.
The value is stored to linear memory at the address pointed to by out_ptr
.
out_len_ptr
must point to a u32 value that describes the available space at
out_ptr
. This call overwrites it with the size of the value. If the available
space at out_ptr
is less than the size of the value a trap is triggered.
The data is encoded as (T::Hash, frame_system::pallet_prelude::BlockNumberFor::
§Changes from v0
In addition to the seed it returns the block number since which it was determinable by chain observers.
§Note
The returned seed should only be used to distinguish commitments made before the returned block number. If the block number is too early (i.e. commitments were made afterwards), then ensure no further commitments may be made and repeatedly call this on later blocks until the block number returned is later than the latest commitment.
§Wasm Import Statement
(import "seal1" "random" (func ...))
sourcefn restore_to(
_dest_ptr: u32,
_code_hash_ptr: u32,
_rent_allowance_ptr: u32,
_delta_ptr: u32,
_delta_count: u32,
) -> Result<(), TrapReason>
fn restore_to( _dest_ptr: u32, _code_hash_ptr: u32, _rent_allowance_ptr: u32, _delta_ptr: u32, _delta_count: u32, ) -> Result<(), TrapReason>
§Deprecated
This function is deprecated and will be removed in future versions. No new code or contracts with this API can be deployed. Was used to restore the given destination contract sacrificing the caller.
§Note
The state rent functionality was removed. This is stub only exists for backwards compatibility
§Wasm Import Statement
(import "seal1" "restore_to" (func ...))
sourcefn set_rent_allowance(_value_ptr: u32) -> Result<(), TrapReason>
fn set_rent_allowance(_value_ptr: u32) -> Result<(), TrapReason>
§Deprecated
This function is deprecated and will be removed in future versions. No new code or contracts with this API can be deployed. Was used to set rent allowance of the contract.
§Note
The state rent functionality was removed. This is stub only exists for backwards compatibility.
§Wasm Import Statement
(import "seal1" "set_rent_allowance" (func ...))
sourcefn seal_set_storage(
key_ptr: u32,
value_ptr: u32,
value_len: u32,
) -> Result<u32, TrapReason>
fn seal_set_storage( key_ptr: u32, value_ptr: u32, value_len: u32, ) -> Result<u32, TrapReason>
This is just an alias function to set_storage()
with backwards-compatible prefixed identifier.
§Wasm Import Statement
(import "seal1" "seal_set_storage" (func ...))
sourcefn seal_clear_storage(key_ptr: u32, key_len: u32) -> Result<u32, TrapReason>
fn seal_clear_storage(key_ptr: u32, key_len: u32) -> Result<u32, TrapReason>
This is just an alias function to clear_storage()
with backwards-compatible prefixed identifier.
§Wasm Import Statement
(import "seal1" "seal_clear_storage" (func ...))
sourcefn seal_get_storage(
key_ptr: u32,
key_len: u32,
out_ptr: u32,
out_len_ptr: u32,
) -> Result<ReturnErrorCode, TrapReason>
fn seal_get_storage( key_ptr: u32, key_len: u32, out_ptr: u32, out_len_ptr: u32, ) -> Result<ReturnErrorCode, TrapReason>
This is just an alias function to get_storage()
with backwards-compatible prefixed identifier.
§Wasm Import Statement
(import "seal1" "seal_get_storage" (func ...))
sourcefn seal_contains_storage(key_ptr: u32, key_len: u32) -> Result<u32, TrapReason>
fn seal_contains_storage(key_ptr: u32, key_len: u32) -> Result<u32, TrapReason>
This is just an alias function to contains_storage()
with backwards-compatible prefixed identifier.
§Wasm Import Statement
(import "seal1" "seal_contains_storage" (func ...))
sourcefn seal_call(
flags: u32,
callee_ptr: u32,
gas: u64,
value_ptr: u32,
input_data_ptr: u32,
input_data_len: u32,
output_ptr: u32,
output_len_ptr: u32,
) -> Result<ReturnErrorCode, TrapReason>
fn seal_call( flags: u32, callee_ptr: u32, gas: u64, value_ptr: u32, input_data_ptr: u32, input_data_len: u32, output_ptr: u32, output_len_ptr: u32, ) -> Result<ReturnErrorCode, TrapReason>
sourcefn seal_instantiate(
code_hash_ptr: u32,
gas: u64,
value_ptr: u32,
input_data_ptr: u32,
input_data_len: u32,
address_ptr: u32,
address_len_ptr: u32,
output_ptr: u32,
output_len_ptr: u32,
salt_ptr: u32,
salt_len: u32,
) -> Result<ReturnErrorCode, TrapReason>
fn seal_instantiate( code_hash_ptr: u32, gas: u64, value_ptr: u32, input_data_ptr: u32, input_data_len: u32, address_ptr: u32, address_len_ptr: u32, output_ptr: u32, output_len_ptr: u32, salt_ptr: u32, salt_len: u32, ) -> Result<ReturnErrorCode, TrapReason>
This is just an alias function to instantiate()
with backwards-compatible prefixed identifier.
§Wasm Import Statement
(import "seal1" "seal_instantiate" (func ...))
sourcefn seal_terminate(beneficiary_ptr: u32) -> Result<(), TrapReason>
fn seal_terminate(beneficiary_ptr: u32) -> Result<(), TrapReason>
This is just an alias function to terminate()
with backwards-compatible prefixed identifier.
§Wasm Import Statement
(import "seal1" "seal_terminate" (func ...))
sourcefn seal_random(
subject_ptr: u32,
subject_len: u32,
out_ptr: u32,
out_len_ptr: u32,
) -> Result<(), TrapReason>
fn seal_random( subject_ptr: u32, subject_len: u32, out_ptr: u32, out_len_ptr: u32, ) -> Result<(), TrapReason>
sourcefn seal_restore_to(
_dest_ptr: u32,
_code_hash_ptr: u32,
_rent_allowance_ptr: u32,
_delta_ptr: u32,
_delta_count: u32,
) -> Result<(), TrapReason>
fn seal_restore_to( _dest_ptr: u32, _code_hash_ptr: u32, _rent_allowance_ptr: u32, _delta_ptr: u32, _delta_count: u32, ) -> Result<(), TrapReason>
§Deprecated
This function is deprecated and will be removed in future versions.
No new code or contracts with this API can be deployed.
This is just an alias function to restore_to()
with backwards-compatible prefixed identifier.
§Wasm Import Statement
(import "seal1" "seal_restore_to" (func ...))
sourcefn seal_set_rent_allowance(_value_ptr: u32) -> Result<(), TrapReason>
fn seal_set_rent_allowance(_value_ptr: u32) -> Result<(), TrapReason>
§Deprecated
This function is deprecated and will be removed in future versions.
No new code or contracts with this API can be deployed.
This is just an alias function to set_rent_allowance()
with backwards-compatible prefixed identifier.
§Wasm Import Statement
(import "seal1" "seal_set_rent_allowance" (func ...))