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>

source§

fn clone(&self) -> ContractResult<R, Balance, EventRecord>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<R, Balance, EventRecord> Debug for ContractResult<R, Balance, EventRecord>where R: Debug, Balance: Debug, EventRecord: Debug,

source§

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

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>

Attempt to deserialise the value from input.
source§

fn decode_into<I>( input: &mut I, dst: &mut MaybeUninit<Self> ) -> Result<DecodeFinished, Error>where I: Input,

Attempt to deserialize the value from input into a pre-allocated piece of memory. Read more
source§

fn skip<I>(input: &mut I) -> Result<(), Error>where I: Input,

Attempt to skip the encoded value from input. Read more
source§

fn encoded_fixed_size() -> Option<usize>

Returns the fixed encoded size of the type. Read more
source§

impl<R, Balance, EventRecord> Encode for ContractResult<R, Balance, EventRecord>where StorageDeposit<Balance>: Encode, R: Encode, Option<Vec<EventRecord>>: Encode,

source§

fn size_hint(&self) -> usize

If possible give a hint of expected size of the encoding. Read more
source§

fn encode_to<__CodecOutputEdqy: Output + ?Sized>( &self, __codec_dest_edqy: &mut __CodecOutputEdqy )

Convert self to a slice and append it to the destination.
source§

fn encode(&self) -> Vec<u8>

Convert self to an owned vector.
source§

fn using_encoded<R, F>(&self, f: F) -> Rwhere F: FnOnce(&[u8]) -> R,

Convert self to a slice and then invoke the given closure with it.
source§

fn encoded_size(&self) -> usize

Calculates the encoded size. Read more
source§

impl<R: PartialEq, Balance: PartialEq, EventRecord: PartialEq> PartialEq for ContractResult<R, Balance, EventRecord>

source§

fn eq(&self, other: &ContractResult<R, Balance, EventRecord>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
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,

§

type Identity = ContractResult<R, Balance, EventRecord>

The type identifying for which type info is provided. Read more
source§

fn type_info() -> Type

Returns the static type identifier for Self.
source§

impl<R, Balance, EventRecord> EncodeLike for ContractResult<R, Balance, EventRecord>where StorageDeposit<Balance>: Encode, R: Encode, Option<Vec<EventRecord>>: Encode,

source§

impl<R: Eq, Balance: Eq, EventRecord: Eq> Eq for ContractResult<R, Balance, EventRecord>

source§

impl<R, Balance, EventRecord> StructuralEq for ContractResult<R, Balance, EventRecord>

source§

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CheckedConversion for T

source§

fn checked_from<T>(t: T) -> Option<Self>where Self: TryFrom<T>,

Convert from a value of T into an equivalent instance of Option<Self>. Read more
source§

fn checked_into<T>(self) -> Option<T>where Self: TryInto<T>,

Consume self to return Some equivalent value of Option<T>. Read more
source§

impl<T> DecodeAll for Twhere T: Decode,

source§

fn decode_all(input: &mut &[u8]) -> Result<T, Error>

Decode Self and consume all of the given input data. Read more
source§

impl<T> DecodeLimit for Twhere T: Decode,

source§

fn decode_all_with_depth_limit( limit: u32, input: &mut &[u8] ) -> Result<T, Error>

Decode Self and consume all of the given input data. Read more
source§

fn decode_with_depth_limit<I>(limit: u32, input: &mut I) -> Result<T, Error>where I: Input,

Decode Self with the given maximum recursion depth and advance input by the number of bytes consumed. Read more
source§

impl<T> DynClone for Twhere T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T, Outer> IsWrappedBy<Outer> for Twhere Outer: AsRef<T> + AsMut<T> + From<T>, T: From<Outer>,

§

fn from_ref(outer: &Outer) -> &T

Get a reference to the inner from the outer.

§

fn from_mut(outer: &mut Outer) -> &mut T

Get a mutable reference to the inner from the outer.

source§

impl<T> KeyedVec for Twhere T: Codec,

source§

fn to_keyed_vec(&self, prepend_key: &[u8]) -> Vec<u8>

Return an encoding of Self prepended by given slice.
source§

impl<T> Same for T

§

type Output = T

Should always be Self
§

impl<T> SaturatedConversion for T

§

fn saturated_from<T>(t: T) -> Selfwhere Self: UniqueSaturatedFrom<T>,

Convert from a value of T into an equivalent instance of Self. Read more
§

fn saturated_into<T>(self) -> Twhere Self: UniqueSaturatedInto<T>,

Consume self to return an equivalent value of T. Read more
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<S, T> UncheckedInto<T> for Swhere T: UncheckedFrom<S>,

§

fn unchecked_into(self) -> T

The counterpart to unchecked_from.
§

impl<T, S> UniqueSaturatedInto<T> for Swhere T: Bounded, S: TryInto<T>,

§

fn unique_saturated_into(self) -> T

Consume self to return an equivalent value of T.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
source§

impl<S> Codec for Swhere S: Decode + Encode,

source§

impl<T> EncodeLike<&&T> for Twhere T: Encode,

source§

impl<T> EncodeLike<&T> for Twhere T: Encode,

source§

impl<T> EncodeLike<&mut T> for Twhere T: Encode,

source§

impl<T> EncodeLike<Arc<T>> for Twhere T: Encode,

source§

impl<T> EncodeLike<Box<T>> for Twhere T: Encode,

source§

impl<'a, T> EncodeLike<Cow<'a, T>> for Twhere T: ToOwned + Encode,

source§

impl<T> EncodeLike<Rc<T>> for Twhere T: Encode,

source§

impl<S> FullCodec for Swhere S: Decode + FullEncode,

source§

impl<S> FullEncode for Swhere S: Encode + EncodeLike,

source§

impl<T> JsonSchemaMaybe for T

§

impl<T> MaybeDebug for Twhere T: Debug,

§

impl<T> MaybeRefUnwindSafe for Twhere T: RefUnwindSafe,

source§

impl<T> Member for Twhere T: Send + Sync + Debug + Eq + PartialEq + Clone + 'static,

source§

impl<T> StaticTypeInfo for Twhere T: TypeInfo + 'static,