Attribute Macros

  • Entry point for use openbrush’s macros in ink! smart contracts.
  • This macro only checks that some free-standing function satisfies a set of rules.
  • Macro calls every modifier function by passing self and the code of function’s body. It means that modifiers must be available in the scope of the marked method.
  • Defines extensible trait in the scope of openbrush::contract. It is a common rust trait, so you can use any features of rust inside of this trait. If this trait contains some methods marked with #[ink(message)] or #[ink(constructor)] attributes, this macro will extract these attributes and will put them into a separate trait (the separate trait only is used to call methods from the original trait), but the macro will not touch methods.
  • That macro implemented OccupyStorage
  • This macro allows you to define a wrapper type for traits defined via #[openbrush::trait_definition]. It is a wrapper for AccountId that knows how to do cross-contract calls to another contract.

Derive Macros

  • The macro implements openbrush::traits::Storage and openbrush::traits::OccupiedStorage traits for each field marked by #[storage_field] attribute. Each field’s type should implement the openbrush::traits::OccupyStorage trait with a unique storage key. Each occupied storage key should be unique for each type otherwise compilation will fail.