VMContext

Struct VMContext 

Source
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_index: 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 is_view: bool, 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_index: 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

§is_view: bool

Whether the execution should not charge any costs.

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

Trait Implementations§

Source§

impl Clone for VMContext

Source§

fn clone(&self) -> VMContext

Returns a duplicate 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<'de> Deserialize<'de> for VMContext

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for VMContext

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where 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.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,