Module frame_support::pallet_macros
source · Expand description
Contains macro stubs for all of the pallet::
macros
Attribute Macros§
- Allows a pallet to declare a set of functions as a dispatchable extrinsic.
- Enforce the index of a variant in the generated
enum Call
. - Declares the arguments of a
call
function to be encoded using [codec::Compact
]. - Allows defining an enum that gets composed as an aggregate enum by
construct_runtime
. - The mandatory attribute allowing definition of configurable types for the pallet.
- Allows adding an associated type trait bounded by
Get
frompallet::config
into metadata. - Allows bypassing the
frame_system::Config
supertrait check. - Allows whitelisting a storage item from decoding during try-runtime checks.
- Allows defining an error enum that will be returned from the dispatchable when an error occurs.
- Allows defining pallet events.
- Defines constants that are added to the constant field of
PalletMetadata
struct for this pallet. - Allows defining logic to make an extrinsic call feeless.
- Generates a helper function on
Pallet
that handles deposit events. - Allows you to define how the state of your pallet at genesis is built. This takes as input the
GenesisConfig
type (asself
) and constructs the pallet’s initial state. - Allows you to define the genesis configuration for the pallet.
- Allows defining getter functions on
Pallet
storage. - The
#[pallet::hooks]
attribute allows you to specify aframe_support::traits::Hooks
implementation forPallet
that specifies pallet-specific logic. - Splits a pallet declaration into multiple parts.
- Selectively includes associated types in the metadata.
- The
#[pallet::inherent]
attribute allows the pallet to provide inherents. - Ensures the trait item will not be used as a default with the
#[derive_impl(..)]
attribute macro. - Ensures the generated
DefaultConfig
will not have any bounds for that trait item. - Allows a pallet to declare a type as an origin.
- Declares a module as importable into a pallet via
#[import_section]
. - Declares a type alias as a storage item.
- Defines what storage prefix to use for a storage item when building the trie.
- Allows defining a storage version for the pallet.
- Allows defining conditions for a task to run.
- Allows defining an index for a task.
- Allows defining an iterator over available work items for a task.
- Allows defining the weight of a task.
- Allows you to define some service work that can be recognized by a script or an off-chain worker.
- Allows defining a struct implementing the
Get
trait to ease the use of storage types. - Declares a storage as unbounded in potential size.
- Allows the pallet to validate unsigned transactions.
- Allows specifying the weight of a call.
- Declare the storage as whitelisted from benchmarking.