Crate ink_macro

source ·

Macros§

  • Computes and expands into the BLAKE2b 256-bit hash of the string input.
  • Computes the ink! selector of the string and expands into its byte representation.
  • Computes the ink! selector of the string and expands into its u32 representation.

Attribute Macros§

  • Defines the interface for a chain extension.
  • Entry point for writing ink! smart contracts.
  • Implements the necessary traits for a struct to be emitted as an event from a contract.
  • 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.
  • 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.
  • Defines a unit test that makes use of ink!’s off-chain testing capabilities.
  • Marks trait definitions to ink! as special ink! trait definitions.

Derive Macros§

  • Derives an implementation of the [ink::Event] trait for the given struct.
  • Derives the [ink::EventMetadata] trait for the given struct, which provides metadata about the event definition.
  • Derives ink::storage’s Storable trait for the given struct, enum or union.
  • Derives ink::storage’s StorableHint trait for the given struct or enum.
  • Derives ink::storage’s StorageKey trait for the given struct or enum.
  • Derives ink::storage’s StorageLayout trait for the given struct or enum.