pub struct ContractResult<R, Balance, EventRecord> {
pub gas_consumed: Weight,
pub gas_required: Weight,
pub storage_deposit: StorageDeposit<Balance>,
pub debug_message: Vec<u8>,
pub result: R,
pub events: Option<Vec<EventRecord>>,
}
Expand description
Result type of a bare_call
or bare_instantiate
call as well as ContractsApi::call
and
ContractsApi::instantiate
.
It contains the execution result together with some auxiliary information.
#Note
It has been extended to include events
at the end of the struct while not bumping the
ContractsApi
version. Therefore when SCALE decoding a ContractResult
its trailing data
should be ignored to avoid any potential compatibility issues.
Fields§
§gas_consumed: Weight
How much weight was consumed during execution.
gas_required: Weight
How much weight is required as gas limit in order to execute this call.
This value should be used to determine the weight limit for on-chain execution.
§Note
This can only different from Self::gas_consumed
when weight pre charging
is used. Currently, only seal_call_runtime
makes use of pre charging.
Additionally, any seal_call
or seal_instantiate
makes use of pre-charging
when a non-zero gas_limit
argument is supplied.
storage_deposit: StorageDeposit<Balance>
How much balance was paid by the origin into the contract’s deposit account in order to pay for storage.
The storage deposit is never actually charged from the origin in case of Self::result
is Err
. This is because on error all storage changes are rolled back including the
payment of the deposit.
debug_message: Vec<u8>
An optional debug message. This message is only filled when explicitly requested by the code that calls into the contract. Otherwise it is empty.
The contained bytes are valid UTF-8. This is not declared as String
because
this type is not allowed within the runtime.
Clients should not make any assumptions about the format of the buffer. They should just display it as-is. It is not only a collection of log lines provided by a contract but a formatted buffer with different sections.
§Note
The debug message is never generated during on-chain execution. It is reserved for RPC calls.
result: R
The execution result of the wasm code.
events: Option<Vec<EventRecord>>
The events that were emitted during execution. It is an option as event collection is optional.
Trait Implementations§
Source§impl<R: Clone, Balance: Clone, EventRecord: Clone> Clone for ContractResult<R, Balance, EventRecord>
impl<R: Clone, Balance: Clone, EventRecord: Clone> Clone for ContractResult<R, Balance, EventRecord>
Source§fn clone(&self) -> ContractResult<R, Balance, EventRecord>
fn clone(&self) -> ContractResult<R, Balance, EventRecord>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<R, Balance, EventRecord> Debug for ContractResult<R, Balance, EventRecord>
impl<R, Balance, EventRecord> Debug for ContractResult<R, Balance, EventRecord>
Source§impl<R, Balance, EventRecord> Decode for ContractResult<R, Balance, EventRecord>
impl<R, Balance, EventRecord> Decode for ContractResult<R, Balance, EventRecord>
Source§fn decode<__CodecInputEdqy: Input>(
__codec_input_edqy: &mut __CodecInputEdqy,
) -> Result<Self, Error>
fn decode<__CodecInputEdqy: Input>( __codec_input_edqy: &mut __CodecInputEdqy, ) -> Result<Self, Error>
Source§fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
Source§impl<R, Balance, EventRecord> Encode for ContractResult<R, Balance, EventRecord>
impl<R, Balance, EventRecord> Encode for ContractResult<R, Balance, EventRecord>
Source§fn size_hint(&self) -> usize
fn size_hint(&self) -> usize
Source§fn encode_to<__CodecOutputEdqy: Output + ?Sized>(
&self,
__codec_dest_edqy: &mut __CodecOutputEdqy,
)
fn encode_to<__CodecOutputEdqy: Output + ?Sized>( &self, __codec_dest_edqy: &mut __CodecOutputEdqy, )
Source§fn using_encoded<R, F>(&self, f: F) -> R
fn using_encoded<R, F>(&self, f: F) -> R
Source§fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
Source§impl<R: PartialEq, Balance: PartialEq, EventRecord: PartialEq> PartialEq for ContractResult<R, Balance, EventRecord>
impl<R: PartialEq, Balance: PartialEq, EventRecord: PartialEq> PartialEq for ContractResult<R, Balance, EventRecord>
Source§fn eq(&self, other: &ContractResult<R, Balance, EventRecord>) -> bool
fn eq(&self, other: &ContractResult<R, Balance, EventRecord>) -> bool
self
and other
values to be equal, and is used by ==
.Source§impl<R, Balance, EventRecord> TypeInfo for ContractResult<R, Balance, EventRecord>
impl<R, Balance, EventRecord> TypeInfo for ContractResult<R, Balance, EventRecord>
impl<R, Balance, EventRecord> EncodeLike for ContractResult<R, Balance, EventRecord>
impl<R: Eq, Balance: Eq, EventRecord: Eq> Eq for ContractResult<R, Balance, EventRecord>
impl<R, Balance, EventRecord> StructuralPartialEq for ContractResult<R, Balance, EventRecord>
Auto Trait Implementations§
impl<R, Balance, EventRecord> Freeze for ContractResult<R, Balance, EventRecord>
impl<R, Balance, EventRecord> RefUnwindSafe for ContractResult<R, Balance, EventRecord>
impl<R, Balance, EventRecord> Send for ContractResult<R, Balance, EventRecord>
impl<R, Balance, EventRecord> Sync for ContractResult<R, Balance, EventRecord>
impl<R, Balance, EventRecord> Unpin for ContractResult<R, Balance, EventRecord>
impl<R, Balance, EventRecord> UnwindSafe for ContractResult<R, Balance, EventRecord>
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> CheckedConversion for T
impl<T> CheckedConversion for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DecodeLimit for Twhere
T: Decode,
impl<T> DecodeLimit for Twhere
T: Decode,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T, Outer> IsWrappedBy<Outer> for T
impl<T, Outer> IsWrappedBy<Outer> for T
Source§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
Source§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
Source§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
T
. Read moreSource§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
Source§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
unchecked_from
.Source§impl<T, S> UniqueSaturatedInto<T> for S
impl<T, S> UniqueSaturatedInto<T> for S
Source§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
T
.