Struct ink_lang::EnvAccess[][src]

pub struct EnvAccess<'a, T> { /* fields omitted */ }

A typed accessor to the environment.

This allows ink! messages to make use of the environment efficiently and user friendly while also maintaining access invariants.

Implementations

impl<'a, T> EnvAccess<'a, T> where
    T: Environment,
    <T as Environment>::ChainExtension: ChainExtensionInstance
[src]

pub fn extension(
    self
) -> <<T as Environment>::ChainExtension as ChainExtensionInstance>::Instance
[src]

Allows to call one of the available defined chain extension methods.

impl<'a, T> EnvAccess<'a, T> where
    T: Environment
[src]

pub fn caller(self) -> T::AccountId[src]

Returns the address of the caller of the executed contract.

Note

For more details visit: ink_env::caller

pub fn transferred_balance(self) -> T::Balance[src]

Returns the transferred balance for the contract execution.

Note

For more details visit: ink_env::transferred_balance

pub fn weight_to_fee(self, gas: u64) -> T::Balance[src]

Returns the price for the specified amount of gas.

Note

For more details visit: ink_env::weight_to_fee

pub fn gas_left(self) -> T::Balance[src]

Returns the amount of gas left for the contract execution.

Note

For more details visit: ink_env::gas_left

pub fn block_timestamp(self) -> T::Timestamp[src]

Returns the timestamp of the current block.

Note

For more details visit: ink_env::block_timestamp

pub fn account_id(self) -> T::AccountId[src]

Returns the account ID of the executed contract.

Note

For more details visit: ink_env::account_id

pub fn balance(self) -> T::Balance[src]

Returns the balance of the executed contract.

Note

For more details visit: ink_env::balance

pub fn rent_allowance(self) -> T::Balance[src]

Returns the current rent allowance for the executed contract.

Note

For more details visit: ink_env::rent_allowance

pub fn block_number(self) -> T::BlockNumber[src]

Returns the current block number.

Note

For more details visit: ink_env::block_number

pub fn minimum_balance(self) -> T::Balance[src]

Returns the minimum balance that is required for creating an account.

Note

For more details visit: ink_env::minimum_balance

pub fn tombstone_deposit(self) -> T::Balance[src]

Returns the tombstone deposit for the contracts chain.

Note

For more details visit: ink_env::tombstone_deposit

pub fn set_rent_allowance(self, new_value: T::Balance)[src]

Sets the rent allowance of the executed contract to the new value.

Note

For more details visit: ink_env::set_rent_allowance

pub fn invoke_contract<Args>(
    self,
    params: &CallParams<T, Args, ()>
) -> Result<()> where
    Args: Encode
[src]

Invokes a contract message.

Note

For more details visit: ink_env::invoke_contract

pub fn eval_contract<Args, R>(
    self,
    params: &CallParams<T, Args, ReturnType<R>>
) -> Result<R> where
    Args: Encode,
    R: Decode
[src]

Evaluates a contract message and returns its result.

Note

For more details visit: ink_env::eval_contract

pub fn instantiate_contract<Args, Salt, C>(
    self,
    params: &CreateParams<T, Args, Salt, C>
) -> Result<T::AccountId> where
    Args: Encode,
    Salt: AsRef<[u8]>, 
[src]

Instantiates another contract.

Note

For more details visit: ink_env::instantiate_contract

pub fn restore_contract(
    self,
    account_id: T::AccountId,
    code_hash: T::Hash,
    rent_allowance: T::Balance,
    filtered_keys: &[Key]
)
[src]

Restores a smart contract in tombstone state.

Note

For more details visit: ink_env::restore_contract

pub fn terminate_contract(self, beneficiary: T::AccountId) -> ![src]

Terminates the existence of a smart contract.

Note

For more details visit: ink_env::terminate_contract

pub fn transfer(
    self,
    destination: T::AccountId,
    value: T::Balance
) -> Result<()>
[src]

Transfers value from the contract to the destination account ID.

Note

For more details visit: ink_env::transfer

pub fn random(self, subject: &[u8]) -> T::Hash[src]

Returns a random hash seed.

Note

For more details visit: ink_env::random

pub fn hash_bytes<H>(self, input: &[u8]) -> <H as HashOutput>::Type where
    H: CryptoHash
[src]

Computes the hash of the given bytes using the cryptographic hash H.

Note

For more details visit: ink_env::hash_bytes

pub fn hash_encoded<H, V>(self, value: &V) -> <H as HashOutput>::Type where
    H: CryptoHash,
    V: Encode
[src]

Computes the hash of the given SCALE encoded value using the cryptographic hash H.

Note

For more details visit: ink_env::hash_encoded

Trait Implementations

impl<'a, T: Clone> Clone for EnvAccess<'a, T>[src]

impl<'a, T: Copy> Copy for EnvAccess<'a, T>[src]

impl<'a, E> Debug for EnvAccess<'a, E>[src]

impl<'a, T> Default for EnvAccess<'a, T>[src]

Auto Trait Implementations

impl<'a, T> RefUnwindSafe for EnvAccess<'a, T>

impl<'a, T> Send for EnvAccess<'a, T>

impl<'a, T> Sync for EnvAccess<'a, T>

impl<'a, T> Unpin for EnvAccess<'a, T>

impl<'a, T> UnwindSafe for EnvAccess<'a, T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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