referrerpolicy=no-referrer-when-downgrade
polkadot_sdk_frame

Module prelude

Source
Expand description

The main prelude of FRAME.

This prelude should almost always be the first line of code in any pallet or runtime.

use polkadot_sdk_frame::prelude::*;

// rest of your pallet..
mod pallet {}

Re-exports§

Modules§

  • frame_system’s parent crate, which is mandatory in all pallets build with this crate.

Macros§

  • Generic function to mark an execution path as ONLY defensive.
  • Trigger a defensive failure if a condition is not met.

Structs§

  • Bounded storage related types. A bounded slice.
  • Bounded storage related types. A bounded vector.
  • “OR gate” implementation of EnsureOrigin, Success type for both L and R must be equal.
  • A Contains implementation which contains all members of These which are also members of Those.
  • A derivative EnsureOrigin implementation. It mutates the Success result of an Original implementation with a given Mutator.
  • NoOp polling is required if pallet-referenda functionality not needed.
  • A pallet identifier. These are per pallet and should be stored in a registry somewhere.
  • Adapter for Get<u32> to access VARIANT_COUNT from trait pub trait VariantCount {.

Enums§

Traits§

  • A trait for querying whether a type can be said to “contain” a value.
  • A trait to handle errors and options when you are really sure that a condition must hold, but not brave enough to expect on it, or a default fallback value makes more sense.
  • A variant of Defensive with the same rationale, for the arithmetic operations where in case an infallible operation fails, it saturates.
  • Something that can estimate at which block the next session rotation will happen (i.e. a new session starts).
  • Simple trait for providing a filter over a reference to some type, given an instance of itself.
  • Something that can be checked to be a of sub type T.
  • A session handler for specific key type.
  • Provides information about the pallet itself and its setup in the runtime.
  • Ranked membership data structure.
  • Handler that can deal with the swap of two members.
  • Trait to get the number of variants in any enum.