Module frame_support::traits
source · Expand description
Traits and associated utilities for use in the FRAME environment.
NOTE: If you’re looking for parameter_types
, it has moved in to the top-level module.
Re-exports§
pub use tokens::currency::ActiveIssuanceOf;
pub use tokens::currency::Currency;
pub use tokens::currency::InspectLockableCurrency;
pub use tokens::currency::LockIdentifier;
pub use tokens::currency::LockableCurrency;
pub use tokens::currency::NamedReservableCurrency;
pub use tokens::currency::ReservableCurrency;
pub use tokens::currency::TotalIssuanceOf;
pub use tokens::currency::VestedTransfer;
pub use tokens::currency::VestingSchedule;
pub use tokens::fungible;
pub use tokens::fungibles;
pub use tokens::imbalance::Imbalance;
pub use tokens::imbalance::OnUnbalanced;
pub use tokens::imbalance::SignedImbalance;
pub use tokens::nonfungible;
pub use tokens::nonfungible_v2;
pub use tokens::nonfungibles;
pub use tokens::nonfungibles_v2;
pub use tokens::BalanceStatus;
pub use tokens::ExistenceRequirement;
pub use tokens::Locker;
pub use tokens::WithdrawReasons;
pub use tasks::Task;
Modules§
- Types for a base-2 merkle tree used for checking and generating proofs within the runtime. The
binary-merkle-tree
crate exposes all of these same functionality (and more), but this library is designed to work more easily with runtime native types, which simply need to implementEncode
/Decode
. - Types for a compact base-16 merkle trie used for checking and generating proofs within the runtime. The
sp-trie
crate exposes all of these same functionality (and more), but this library is designed to work more easily with runtime native types, which simply need to implementEncode
/Decode
. It also exposes a runtime friendlyTrieError
type which can be use inside of a FRAME Pallet. - Prelude module for all defensive traits to be imported at once.
- Types and traits for dynamic parameters.
- Traits and associated utilities for scheduling dispatchables in FRAME.
- Contains the
Task
trait, which defines a general-purpose way for defining and executing service work, and supporting types. - Traits for working with tokens and their associated datastructures.
Structs§
- Adapter struct for turning an
OrderedMembership
impl into aContains
impl. - Some amount of backing from a group. The precise definition of what it means to “back” something is left flexible.
- Implements
VerifyExistenceProof
using a binary merkle tree. - The function and pallet name of the Call.
- Guard type for clearing all pushed constraints from a
FilterStack
and reinstating them when dropped. - Const getter for a basic type.
- Const getter for a basic type.
- Const getter for a basic type.
- Const getter for a basic type.
- Const getter for a basic type.
- Const getter for a basic type.
- Const getter for signed integers.
- Const getter for a basic type.
- Const getter for a basic type.
- Const getter for a basic type.
- Const getter for a basic type.
- Const getter for a basic type.
- Const getter for unsigned integers.
- The version of a crate.
- “OR gate” implementation of
EnsureOrigin
,Success
type for bothL
andR
must be equal. - “OR gate” implementation of
EnsureOrigin
allowing for differentSuccess
types forL
andR
, with them combined using anEither
type. - Adapter type to transform an
EnqueueMessage
with an origin into aHandleMessage
impl. EnsureOrigin
implementation that checks that an origin has equal or higher privilege compared to the expectedOrigin
.- Implementation of
PrivilegeCmp
that only checks for equal origins. - An implementation of
Contains
which contains only equal members toT
. - A
Contains
implementation that contains everything except the values inExclude
. - Guard type for pushing a constraint to a
FilterStack
and popping when dropped. - The resource footprint of a bunch of blobs. We assume only the number of blobs and their total size in bytes matter.
- A
ContainsPair
implementation that has aContains
implementation for each member of the pair. - Converter
struct
to use aContainsPair
implementation for aContains
bound. - Implement Get by returning Default for any type that implements Default.
- Trivial utility for implementing
Contains
/OrderedMembership
with aVec
. - A storage price that increases linearly with the number of elements and their size.
- A derivative
EnsureOrigin
implementation. It mutates theSuccess
result of anOriginal
implementation with a givenMutator
. EnsureOrigin
implementation that always fails.- NoOp polling is required if pallet-referenda functionality not needed.
- Special marker struct used when
storage_version
is not defined for a pallet. - Services queues by doing nothing.
- Information regarding an instance of a pallet.
- The resource footprint of a queue.
- Proof used by
SixteenPatriciaMerkleTreeProver
forVerifyExistenceProof
. - Implements
VerifyExistenceProof
using a 16-patricia merkle tree. - Metadata about storage from the runtime.
- A shim for placing around a storage item in order to use it as a
StoredValue
. Ideally this wouldn’t be needed asStorageValue
s should blanket implementStoredValue
s, however this would break the ability to have custom impls ofStoredValue
. The other workaround is to implement it directly in the macro. - The storage version of a pallet.
- Storage key with read/write tracking information.
- Transform the origin of an
EnqueueMessage
viaC::convert
. - A value could not be decoded.
- A derivative
EnsureOrigin
implementation. It mutates theSuccess
result of anOriginal
implementation with a givenMutator
, allowing the possibility of an error to be returned from the mutator. - Adapter for
Get<u32>
to accessVARIANT_COUNT
fromtrait pub trait VariantCount {
. - A wrapper for any type
T
which implement encode/decode in a way compatible withVec<u8>
. - A wrapper for any type
T
which implement encode/decode in a way compatible withVec<u8>
.
Enums§
- A
Contains
implementation that contains every value. - Errors that can happen when attempting to execute an overweight message with
ServiceQueues::execute_overweight()
. - A
Contains
implementation that contains no value. - Errors that can happen when attempting to process a message with
ProcessMessage::process_message()
. - The error type for
SafeMode
. - Return type used when we need to return one of two items, each of the opposite direction or sign, with one (
Same
) being of the same type as theself
or primary argument of the function that returned it. - The error type for
TransactionPause
. - A runtime friendly error type for tries.
- Which state tests to execute.
- Select which checks should be run when trying a runtime upgrade upgrade.
Constants§
- The storage key postfix that is used to store the
StorageVersion
per pallet.
Traits§
- Trait for touching/creating an asset account with a deposit taken from a designated depositor specified by the client.
- Implemented by pallets, allows defining logic to run prior to any
OnRuntimeUpgrade
logic. - A trait to define the build function of a genesis config for both runtime and pallets.
- The trait implemented by the overarching enumeration of the different pallets’ origins. Unlike
OriginTrait
impls, this does not include any kind of dispatch/call filter. Also, this trait is more flexible in terms of how it can be used: it is aParameter
andMember
, so it can be used as dispatchable parameters as well as in storage items. - Trait for type that can handle incremental changes to a set of account IDs.
- Some sort of cost taken from account temporarily in order to offset the cost to the chain of holding some data
Footprint
in state. - A trait for querying whether a type can be said to “contain” a value.
- A trait for querying bound for the length of an implementation of
Contains
- A trait for querying whether a type can be said to “contain” a pair-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. - Defensively calculates the maximum of two values.
- Defensively calculates the minimum of two values.
- Subset of methods similar to
Defensive
that can only work for aOption
. - Subset of methods similar to
Defensive
that can only work for aResult
. - A variant of
Defensive
with the same rationale, for the arithmetic operations where in case an infallible operation fails, it saturates. - Construct an object by defensively truncating an input if the
TryFrom
conversion fails. - Trait used to check whether a given validator is currently disabled and should not be participating in consensus (e.g. because they equivocated).
- Can enqueue messages for multiple origins.
- A trait to ensure the inherent are before non-inherent in a block.
- Some sort of check on the origin is performed by this object.
- Some sort of check on the origin is performed by this object.
- Something that can estimate the fee of a (frame-based) call.
- Something that can estimate at which block scheduling of the next session will happen (i.e when we will try to fetch new validators).
- Something that can estimate at which block the next session rotation will happen (i.e. a new session starts).
- Something that can execute a given block.
- An extrinsic on which we can get access to call.
- FilterDeprecated
- Trait to add a constraint onto the filter.
- A trait for finding the author of a block header based on the
PreRuntime
digests contained within it. - GenesisBuildDeprecatedA trait to define the build function of a genesis config, T and I are placeholder for pallet trait and pallet instance.
- A trait for querying a single value from a type.
- Retrieve the backing from an object’s ref.
- Gets the function index of the Call.
- Gets the metadata for the Call - function name and pallet name.
- Gets the function name of the Call.
- Provides information about a pallet’s storage versions.
- A simple, generic one-parameter event notifier/handler.
- Handles incoming messages for a single origin.
- The pallet hooks trait. This is merely an umbrella trait for:
- A trait representing an incrementable type.
- Interface for types capable of constructing an inherent extrinsic.
- Trait for type that can handle the initialization of account IDs at genesis.
- An instance of a pallet in the storage.
- Simple trait for providing a filter over a reference to some type, given an instance of itself.
- A trait to check if an extrinsic is an inherent.
- Something that can be checked to be a of sub type
T
. - Trait to be used when types are exactly same.
- Something which can compute and check proofs of a historical key owner and return full identification data of that key owner.
- Trait to be used by block producing consensus engine modules to determine how late the current block is (e.g. in a slot-based proposal mechanism how many slots were skipped since the previous block).
- Anything that can have a
::len()
method. - An extension of the
Consideration
trait that allows for the management of tickets that may represent no cost. While theMaybeConsideration
still requires proper handling, it introduces the ability to determine if a ticket represents no cost and can be safely forgotten without any side effects. - Off-chain computation trait.
- See
Hooks::on_finalize
. - A trait that will be called at genesis.
- See
Hooks::on_idle
. - See
Hooks::on_initialize
. - The account with the given id was reaped.
- Handler for when a new account has been created.
- Periodically executes logic. Is not guaranteed to run within a specific timeframe and should only be used on logic that has no deadline.
- A trait which is called when the timestamp is set in the runtime.
- A session handler for specific key type.
- Methods available on
frame_system::Config::RuntimeOrigin
. - Trait indicating that the implementing type is going to be included as a field in a variant of the
#[pallet::error]
enum type. - Provides information about the pallet itself and its setup in the runtime.
- Provides information about the pallet itself and its setup in the runtime.
- Provide information about a bunch of pallets.
- Similar to
StorageInfoTrait
, a trait to give partial information about storage. - Provides a callback to execute logic after the all inherents.
- Provides a callback to execute logic before the all transactions.
- Provides a callback to execute logic before the all inherents.
- A interface for looking up preimages from their hash on chain.
- A interface for managing preimages to hashes on chain.
- Something that can compare privileges of two origins.
- Can process messages from a specific origin.
- This trait is one strategy that can be used to benchmark a trie proof verification for the runtime. This strategy assumes that the majority complexity of verifying a merkle proof comes from computing hashes to recreate the merkle root. This trait converts the the proof, some bytes, to the number of hashes we expect to execute to verify that proof.
- An interface for creating, interacting with, and creating proofs in a merkle trie.
- A interface for looking up preimages from their hash on chain.
- Provides information on paused queues.
- A trait that is able to provide randomness.
- Ranked membership data structure.
- Handler that can deal with the swap of two members.
- Can put the runtime into a safe mode.
- A trait to notify when the runtime enters or exits safe mode.
- Can service queues and execute overweight messages.
- Interface for types capable of constructing a signed transaction.
- A trait for a set which can enumerate its members in order.
- A trait to give information about storage.
- An instance of a storage in a pallet.
- A interface for managing preimages to hashes on chain.
- An abstraction of a value stored within storage, but possibly as part of a larger composite item.
- Can pause specific transactions from being processed.
- Try and collect into a collection
C
. - Decode the entire data under the given storage type.
- A type for which some values make sense to be able to drop without further consideration.
- Execute some checks to ensure the internal state of a pallet is consistent.
- A trait for querying a single value from a type defined in the trait.
- This trait is intended for use within
VersionedMigration
to execute storage migrations without automatic version checks. Implementations should ensure migration logic is safe and idempotent. - Type that can be dispatched with an origin but without checking the origin filter.
- Trait to deal with unix time.
- Implementors of this trait provide information about whether or not some validator has been registered with them. The Session module is an implementor.
- A trait for online node inspection in a session.
ValidatorSet
combined with an identification.- Trait to get the number of variants in any enum.
- Something that can verify the existence of some data in a given proof.
- A trait for verifying the seal of a header and returning the author.
- Allows a pallet to specify storage keys to whitelist during benchmarking. This means those keys will be excluded from the benchmarking performance calculation.
Type Aliases§
- AllowAllDeprecated
- DenyAllDeprecated
- EnsureOneOfDeprecated“OR gate” implementation of
EnsureOrigin
allowing for differentSuccess
types forL
andR
, with them combined using anEither
type.