Expand description
The ink_env
utilities used to interoperate with the contract executor.
Mainly provides entities to work on a contract’s storage as well as high-level collections on top of those. Also provides environmental utilities, such as storage allocators, FFI to interface with FRAME contracts and a primitive blockchain emulator for simple off-chain testing.
Modules
- Utilities to call or instantiate contracts on the chain.
- Definitions and utilities for calling chain extension methods.
- Provides type definitions and traits for the built-in cryptographic hashes.
- Operations on the off-chain testing environment.
Macros
- Appends a formatted string to the
debug_message
buffer if message recording is enabled in the contracts pallet and if the call is performed via RPC (not via an extrinsic). Thedebug_message
buffer will be: - Appends a formatted string to the
debug_message
buffer, as perdebug_print
but with a newline appended. - Prepend contract message call with value transfer. Used for tests in off-chain environment.
Structs
- The flags used to change the behavior of a contract call.
- The flags to indicate further information about the end of a contract execution.
Enums
- The fundamental types of the default configuration.
- Errors that can be encountered upon environmental interaction.
- Placeholder for chains that have no defined chain extension.
Traits
- A trait to enforce that a type should be an
Environment::AccountId
. - Stores the used host environment type of the ink! smart contract.
- Refers to the generated ink! smart contract reference type.
- The environmental types usable by contracts defined with ink!.
- Allows to instantiate a type from its little-endian bytes representation.
- Implemented by event types to guide the event topic serialization using the topics builder.
Functions
- Returns the account ID of the executed contract.
- Returns the balance of the executed contract.
- Returns the current block number.
- Returns the current block timestamp.
- Tries to trigger a runtime dispatchable, i.e. an extrinsic from a pallet.
- Returns the address of the caller of the executed contract.
- Checks whether the caller of the current contract is the origin of the whole call stack.
- Clears the contract’s storage entry under the given storage key.
- Retrieves the code hash of the contract at the specified account id.
- Checks whether there is a value stored under the given storage key in the contract’s storage.
- Appends the given message to the debug message buffer.
- Returns the execution input to the executed contract and decodes it as
T
. - Recovers the compressed ECDSA public key for given
signature
andmessage_hash
, and stores the result inoutput
. - Returns an Ethereum address from the ECDSA compressed public key.
- Emits an event with the given event data.
- Returns the amount of gas left for the contract execution.
- Returns the value stored under the given storage key in the contract’s storage if any.
- Conducts the crypto hash of the given input and stores the result in
output
. - Conducts the crypto hash of the given encoded input and stores the result in
output
. - Instantiates another contract.
- Invokes a contract message and returns its result.
- Invokes a contract message via delegate call and returns its result.
- Checks whether the specified account is a contract.
- Returns the minimum balance that is required for creating an account (i.e. the chain’s existential deposit).
- Retrieves the code hash of the currently executing contract.
- Returns the value back to the caller of the executed contract.
- Replace the contract code at the specified address with new code.
- Replace the contract code at the specified address with new code.
- Writes the value to the contract storage under the given storage key and returns the size of pre-existing value if any.
- Removes the
value
atkey
, returning the previousvalue
atkey
from storage. - Terminates the existence of the currently executed smart contract.
- Transfers value from the contract to the destination account ID.
- Returns the transferred value for the contract execution.
- Returns the price for the specified amount of gas.
Type Definitions
- The default gas type.
- A result of environmental operations.