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>where
R: Debug,
Balance: Debug,
EventRecord: Debug,
impl<R, Balance, EventRecord> Debug for ContractResult<R, Balance, EventRecord>where R: Debug, Balance: Debug, EventRecord: Debug,
source§impl<R, Balance, EventRecord> Decode for ContractResult<R, Balance, EventRecord>where
StorageDeposit<Balance>: Decode,
R: Decode,
Option<Vec<EventRecord>>: Decode,
impl<R, Balance, EventRecord> Decode for ContractResult<R, Balance, EventRecord>where StorageDeposit<Balance>: Decode, R: Decode, Option<Vec<EventRecord>>: Decode,
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>
§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,
§fn skip<I>(input: &mut I) -> Result<(), Error>where
I: Input,
fn skip<I>(input: &mut I) -> Result<(), Error>where I: Input,
§fn encoded_fixed_size() -> Option<usize>
fn encoded_fixed_size() -> Option<usize>
source§impl<R, Balance, EventRecord> Encode for ContractResult<R, Balance, EventRecord>where
StorageDeposit<Balance>: Encode,
R: Encode,
Option<Vec<EventRecord>>: Encode,
impl<R, Balance, EventRecord> Encode for ContractResult<R, Balance, EventRecord>where StorageDeposit<Balance>: Encode, R: Encode, Option<Vec<EventRecord>>: Encode,
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 )
§fn using_encoded<R, F>(&self, f: F) -> Rwhere
F: FnOnce(&[u8]) -> R,
fn using_encoded<R, F>(&self, f: F) -> Rwhere F: FnOnce(&[u8]) -> R,
§fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
source§impl<R: PartialEq, Balance: PartialEq, EventRecord: PartialEq> PartialEq<ContractResult<R, Balance, EventRecord>> for ContractResult<R, Balance, EventRecord>
impl<R: PartialEq, Balance: PartialEq, EventRecord: PartialEq> PartialEq<ContractResult<R, Balance, EventRecord>> 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>where
StorageDeposit<Balance>: TypeInfo + 'static,
R: TypeInfo + 'static,
Option<Vec<EventRecord>>: TypeInfo + 'static,
Balance: TypeInfo + 'static,
EventRecord: TypeInfo + 'static,
impl<R, Balance, EventRecord> TypeInfo for ContractResult<R, Balance, EventRecord>where StorageDeposit<Balance>: TypeInfo + 'static, R: TypeInfo + 'static, Option<Vec<EventRecord>>: TypeInfo + 'static, Balance: TypeInfo + 'static, EventRecord: TypeInfo + 'static,
impl<R, Balance, EventRecord> EncodeLike<ContractResult<R, Balance, EventRecord>> for ContractResult<R, Balance, EventRecord>where StorageDeposit<Balance>: Encode, R: Encode, Option<Vec<EventRecord>>: Encode,
impl<R: Eq, Balance: Eq, EventRecord: Eq> Eq for ContractResult<R, Balance, EventRecord>
impl<R, Balance, EventRecord> StructuralEq for ContractResult<R, Balance, EventRecord>
impl<R, Balance, EventRecord> StructuralPartialEq for ContractResult<R, Balance, EventRecord>
Auto Trait Implementations§
impl<R, Balance, EventRecord> RefUnwindSafe for ContractResult<R, Balance, EventRecord>where Balance: RefUnwindSafe, EventRecord: RefUnwindSafe, R: RefUnwindSafe,
impl<R, Balance, EventRecord> Send for ContractResult<R, Balance, EventRecord>where Balance: Send, EventRecord: Send, R: Send,
impl<R, Balance, EventRecord> Sync for ContractResult<R, Balance, EventRecord>where Balance: Sync, EventRecord: Sync, R: Sync,
impl<R, Balance, EventRecord> Unpin for ContractResult<R, Balance, EventRecord>where Balance: Unpin, EventRecord: Unpin, R: Unpin,
impl<R, Balance, EventRecord> UnwindSafe for ContractResult<R, Balance, EventRecord>where Balance: UnwindSafe, EventRecord: UnwindSafe, R: UnwindSafe,
Blanket Implementations§
source§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
§impl<T> DecodeAll for Twhere
T: Decode,
impl<T> DecodeAll for Twhere T: Decode,
§fn decode_all(input: &mut &[u8]) -> Result<T, Error>
fn decode_all(input: &mut &[u8]) -> Result<T, Error>
Self
and consume all of the given input data. Read more§impl<T> DecodeLimit for Twhere
T: Decode,
impl<T> DecodeLimit for Twhere T: Decode,
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
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, Outer> IsWrappedBy<Outer> for Twhere
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
impl<T, Outer> IsWrappedBy<Outer> for Twhere Outer: AsRef<T> + AsMut<T> + From<T>, T: From<Outer>,
§impl<T> KeyedVec for Twhere
T: Codec,
impl<T> KeyedVec for Twhere T: Codec,
§impl<T> Pointable for T
impl<T> Pointable 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 Swhere
T: Bounded,
S: TryInto<T>,
impl<T, S> UniqueSaturatedInto<T> for Swhere T: Bounded, S: TryInto<T>,
source§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
T
.