Crate ink

Source

Re-exports§

pub extern crate polkavm_derive;
pub use ink_env as env;
pub use ink_metadata as metadata;
pub use ink_prelude as prelude;
pub use ink_primitives as primitives;
pub use scale;
pub use scale_info;
pub use xcm;

Modules§

abi
Abstractions for ABI representation and encoding/decoding.
codegen
Definitions and facilities mainly used by the ink! codegen.
reflect
Definitions and utilities for ink! smart contract static reflection.
sol
Abstractions for implementing Solidity ABI encoding/decoding for arbitrary Rust types.
storage

Macros§

blake2x256
Computes and expands into the BLAKE2b 256-bit hash of the string input.
combine_extensions
Macro defines the combined chain extension via structure definition. Each sub-extension can be accessed by the corresponding field.
contract_ref
Generates a wrapper which can be used for interacting with the contract.
message_builder
Creates an instance of a message builder for an #[ink::trait_definition].
selector_bytes
Computes the ink! selector of the string and expands into its byte representation.
selector_id
Computes the ink! selector of the string and expands into its u32 representation.
sol_error_selector
Returns the selector of the equivalent Solidity custom error for given the name (as a const expression) and a tuple type representing the error parameters types.

Structs§

EnvAccess
The API behind the self.env() and Self::env() syntax in ink!.
H160
Fixed-size uninterpreted hash type with 20 bytes (160 bits) size.
H256
Fixed-size uninterpreted hash type with 32 bytes (256 bits) size.
U256
Little-endian large integer type 256-bit unsigned integer.
ValueReturned
Represents some abstract value that is returned by a function. Currently acts as a placeholder.

Enums§

LangError
An error emitted by the smart contracting language.

Constants§

IIP2_WILDCARD_COMPLEMENT_SELECTOR
A well know selector reserved for the message required to be defined alongside a wildcard selector. See IIP-2.

Statics§

CONTRACT_EVENTS
Any event which derives #[derive(ink::EventMetadata)] and is used in the contract binary will have its implementation added to this distributed slice at linking time.

Traits§

ChainExtensionInstance
Trait implemented by chain extensions.
Output
Only implemented for ValueReturned.
SolDecode
Maps an arbitrary Rust/ink! type to a Solidity ABI type equivalent for Solidity ABI decoding.
SolEncode
Maps an arbitrary Rust/ink! type to a Solidity ABI type equivalent for Solidity ABI encoding.
ToAddr
Implemented by contracts that are compiled as dependencies.

Functions§

collect_events
Collect the [EventSpec] metadata of all event definitions linked and used in the binary.

Type Aliases§

Address
A Solidity compatible address type.
ConstructorResult
The Result type for ink! constructors.
MessageResult
The Result type for ink! messages.

Attribute Macros§

chain_extension
Defines the interface for a chain extension.
contract
Entry point for writing ink! smart contracts.
event
Implements the necessary traits for a struct to be emitted as an event from a contract.
scale_derive
Derive the re-exported traits ink::scale::Encode, ink::scale::Decode and ink::scale_info::TypeInfo. It enables using the built in derive macros for these traits without depending directly on the parity-scale-codec and scale-info crates.
storage_item
Prepares the type to be fully compatible and usable with the storage. It implements all necessary traits and calculates the storage key for types. Packed types don’t have a storage key, but non-packed types (like Mapping, Lazy etc.) require calculating the storage key during compilation.
test
Defines a unit test that makes use of ink!’s off-chain testing capabilities.
trait_definition
Marks trait definitions to ink! as special ink! trait definitions.

Derive Macros§

Event
Derives an implementation of the [ink::Event] trait for the given struct.
EventMetadata
Derives the [ink::EventMetadata] trait for the given struct, which provides metadata about the event definition.
SolDecode
Derives an implementation of ink::SolDecode for the given struct or enum.
SolEncode
Derives an implementation of ink::SolEncode for the given struct or enum.
SolErrorDecode
Derives an implementation of ink::sol::SolErrorDecode for the given struct or enum.
SolErrorEncode
Derives an implementation of ink::sol::SolErrorEncode for the given struct or enum.