pub struct VMContext {
Show 16 fields pub current_account_id: AccountId, pub signer_account_id: AccountId, pub signer_account_pk: PublicKey, pub predecessor_account_id: AccountId, pub input: Vec<u8>, pub block_height: BlockHeight, pub block_timestamp: u64, pub epoch_height: EpochHeight, pub account_balance: Balance, pub account_locked_balance: Balance, pub storage_usage: StorageUsage, pub attached_deposit: Balance, pub prepaid_gas: Gas, pub random_seed: Vec<u8>, pub view_config: Option<ViewConfig>, pub output_data_receivers: Vec<AccountId>,
}
Expand description

Context for the contract execution.

Fields§

§current_account_id: AccountId

The account id of the current contract that we are executing.

§signer_account_id: AccountId

The account id of that signed the original transaction that led to this execution.

§signer_account_pk: PublicKey

The public key that was used to sign the original transaction that led to this execution.

§predecessor_account_id: AccountId

If this execution is the result of cross-contract call or a callback then predecessor is the account that called it. If this execution is the result of direct execution of transaction then it is equal to signer_account_id.

§input: Vec<u8>

The input to the contract call. Encoded as base64 string to be able to pass input in borsh binary format.

§block_height: BlockHeight

The current block height.

§block_timestamp: u64

The current block timestamp (number of non-leap-nanoseconds since January 1, 1970 0:00:00 UTC).

§epoch_height: EpochHeight

The current epoch height.

§account_balance: Balance

The balance attached to the given account. Excludes the attached_deposit that was attached to the transaction.

§account_locked_balance: Balance

The balance of locked tokens on the given account.

§storage_usage: StorageUsage

The account’s storage usage before the contract execution

§attached_deposit: Balance

The balance that was attached to the call that will be immediately deposited before the contract execution starts.

§prepaid_gas: Gas

The gas attached to the call that can be used to pay for the gas fees.

§random_seed: Vec<u8>

Initial seed for randomness

§view_config: Option<ViewConfig>

If Some, it means that execution is made in a view mode and defines its configuration. View mode means that only read-only operations are allowed. See https://nomicon.io/Proposals/0018-view-change-method.html for more details.

§output_data_receivers: Vec<AccountId>

How many DataReceipt’s should receive this execution result. This should be empty if this function call is a part of a batch and it is not the last action.

Implementations§

source§

impl VMContext

source

pub fn is_view(&self) -> bool

Trait Implementations§

source§

impl Clone for VMContext

source§

fn clone(&self) -> VMContext

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

Auto Trait Implementations§

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,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
source§

impl<T> Instrument for T

source§

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

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

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>,

const: unstable · 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.

source§

impl<T> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
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.
const: unstable · 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.
const: unstable · source§

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

Performs the conversion.
§

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

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

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
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

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