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.
contract_ref_from_path
Generates a wrapper which can be used for interacting with the contract.
keccak_256
Computes the Keccak-256 hash of the given string.
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.

Enums§

LangError
An error emitted by the smart contracting language.

Constants§

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

Statics§

CONTRACT_ERRORS_SOL
Any error which derives #[derive(ink::SolErrorMetadata)] and is used in the contract binary will have its implementation added to this distributed slice at linking time.
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§

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_errors_sol
Collect the Solidity ABI compatible metadata of all error definitions encoded as Solidity custom errors that are linked and used in the binary.
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§

contract
Entry point for writing ink! smart contracts.
contract_ref
Defines the interface of a “callee” contract and generates a wrapper type which can be used for interacting with the contract.
error
Implements the necessary traits for ABI encoding/decoding this type as revert error data.
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.
SolErrorMetadata
Derives an implementation of ink::metadata::sol::SolErrorMetadata for the given struct or enum.