referrerpolicy=no-referrer-when-downgrade

Module pallet

Source
Expand description

The pallet module in each FRAME pallet hosts the most important items needed to construct this pallet.

The main components of this pallet are:

  • Pallet, which implements all of the dispatchable extrinsics of the pallet, among other public functions.
    • The subset of the functions that are dispatchable can be identified either in the dispatchables module or in the Call enum.
  • storage_types, which contains the list of all types that are representing a storage item. Otherwise, all storage items are listed among Type Definitions.
  • Config, which contains the configuration trait of this pallet.
  • Event and Error, which are listed among the Enums.

Modules§

dispatchables
Auto-generated docs-only module listing all defined dispatchables for this pallet.
storage_types
Auto-generated docs-only module listing all (public and private) defined storage types for this pallet.

Structs§

DefaultForFoo
GenesisConfig
The genesis config type. This allows the pallet to define how it should initialized upon genesis.
Pallet
The pallet struct. There’s nothing special to FRAME about this; it can implement functions in an impl blocks, traits and so on.

Enums§

Call
The call declaration. This states the entry points that we handle. The macro takes care of the marshalling of arguments and dispatch.
Error
The error enum. Must always be generic over <T>, which is expanded to <T: Config>.
Event
The event type. This exactly like a normal Rust enum.
HoldReason
Allows you to define an enum on the pallet which will then instruct construct_runtime to amalgamate all similarly-named enums from other pallets into an aggregate enum.

Traits§

Config
Configuration trait of this pallet.

Functions§

__type_value_for_default_for_foo

Type Aliases§

AlternativeSyntax
In all of these examples, we chose a syntax where the storage item is defined using the explicit generic syntax (X = Y). Alternatively:
AlternativeSyntax2
Lastly, all storage items, as you saw, had to be generic over T. If they want to use an item from Config, <T: Config> should be used.
Bar
A storage map. This creates a mapping from keys of type u32 to values of type u32.
Foo
A storage value. We mark this as unbounded, alter its prefix, and define a custom storage getter for it.
FooWithDefault
Storage type is [StorageValue] with value type u32.
ModuleDeprecated
Type alias to Pallet, to be used by construct_runtime.
Origin
Allows you to define some origin for the pallet.
Quux
Same as StorageDoubleMap, but with arbitrary number of keys.
Qux
Conceptually same as StorageMap<> where the key is a tuple of (u32, u32). On top, it provides some functions to iterate or remove items based on only the first key.