Expand description
All traits often used in FRAME pallets.
Note that types implementing these traits can also be found in this module.
Modules
- Prelude module for all defensive traits to be imported at once.
- Traits and associated utilities for scheduling dispatchables in FRAME.
- Traits for working with tokens and their associated datastructures.
Macros
- Create new implementations of the
Gettrait.
Structs
- A lookup implementation returning the
AccountIdfrom aMultiAddress. - A non-const
Getimplementation parameterised by aCurrencyimpl which provides the result ofactive_issuance. - Input that adds infinite number of zero after wrapped input.
- Adapter struct for turning an
OrderedMembershipimpl into aContainsimpl. - Some amount of backing from a group. The precise definition of what it means to “back” something is left flexible.
- An error type that indicates that the origin is invalid.
- Blake2-256 Hash implementation.
- The function and pallet name of the Call.
- A
TryMorphimplementation to reduce a scalar by a particular amount, checking for underflow. - Guard type for clearing all pushed constraints from a
FilterStackand 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 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.
- A structure that performs standard conversion using the standard Rust conversion traits.
- The version of a crate.
- “OR gate” implementation of
EnsureOrigin,Successtype for bothLandRmust be equal. - “OR gate” implementation of
EnsureOriginallowing for differentSuccesstypes forLandR, with them combined using anEithertype. - Adapter type to transform an
EnqueueMessagewith an origin into aHandleMessageimpl. EnsureOriginimplementation that checks that an origin has equal or higher privilege compared to the expectedOrigin.- Implementation of
PrivilegeCmpthat only checks for equal origins. - An implementation of
Containswhich contains only equal members toT. - A
Containsimplementation that contains everything except the values inExclude. - Guard type for pushing a constraint to a
FilterStackand 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.
- Converter
structto use aContainsPairimplementation for aContainsbound. - Implement Get by returning Default for any type that implements Default.
- A structure that performs identity conversion.
- A lookup implementation returning the input value.
- Trivial utility for implementing
Contains/OrderedMembershipwith aVec. - Keccak-256 Hash implementation.
- A storage price that increases linearly with the number of elements and their size.
- An error that indicates that a lookup failed.
- A derivative
EnsureOriginimplementation. It mutates theSuccessresult of anOriginalimplementation with a givenMutator. - Implementation of
Morphwhich converts between types usingInto. - A
TryMorphimplementation to enforce an upper limit for a result of the outer morphed type. EnsureOriginimplementation that always fails.- Special marker struct if no storage version is set for a pallet.
- Services queues by doing nothing.
- Information regarding an instance of a pallet.
- Zero-sized type used to mark things that “act like” they own a
T. - The resource footprint of a queue.
- Mutator which reduces a scalar by a particular amount.
- Morpher to disregard the source value and replace with another.
- Information about a
SignedExtensionfor the runtime metadata. - 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 asStorageValues should blanket implementStoredValues, 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.
- Implementation of
Morphto retrieve just the first element of a tuple. - A non-const
Getimplementation parameterised by aCurrencyimpl which provides the result oftotal_issuance. - Storage key with read/write tracking information.
- Input that adds infinite number of zero after wrapped input.
- Transform the origin of an
EnqueueMessageviaC::convert. - A structure that performs standard conversion using the standard Rust conversion traits.
- A derivative
EnsureOriginimplementation. It mutates theSuccessresult of anOriginalimplementation with a givenMutator, allowing the possibility of an error to be returned from the mutator. - Implementation of
TryMorphwhich attmepts to convert between types usingTryInto. - Reasons for moving funds out of an account.
- A wrapper for any type
Twhich implement encode/decode in a way compatible withVec<u8>. - A wrapper for any type
Twhich implement encode/decode in a way compatible withVec<u8>.
Enums
- Status of funds.
- A
Containsimplementation that contains every value. - Errors that can happen when attempting to execute an overweight message with
ServiceQueues::execute_overweight(). - Simple boolean for whether an account needs to be kept in existence.
- A
Containsimplementation 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 theselfor primary argument of the function that returned it. - Either a positive or a negative imbalance.
- The error type for
TransactionPause.
Constants
- The storage key postfix that is used to store the
StorageVersionper pallet.
Traits
- This type can be converted into and possibly from an AccountId (which itself is generic).
- Trait for creating an asset account with a deposit taken from a designated depositor specified by the client.
- Means of signature verification of an application key.
- An “executable” piece of information, used by the standard Substrate Executive in order to enact a piece of extrinsic information by marshalling and dispatching to a named function call.
- A meta trait for arithmetic.
- A meta trait for arithmetic. Same as
AtLeast32Bit, but also bounded to be unsigned. - A “checkable” piece of information, used by the standard Substrate Executive in order to check the validity of a piece of extrinsic information, usually by verifying the signature. Implement for pieces of information that don’t require additional context in order to be checked.
- Something which fulfills the abstract idea of a Substrate block. It has types for
Extrinsicpieces of information as well as aHeader. - Something that can convert a
BlockIdto a number or a hash. - Get current block number
- 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
OriginTraitimpls, 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 aParameterandMember, 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.
- Something that can be checked for equality and printed out to a debug channel if bad.
- Extract the digest type for a block. A “checkable” piece of information, used by the standard Substrate Executive in order to check the validity of a piece of extrinsic information, usually by verifying the signature. Implement for pieces of information that require some additional context
Contextin order to be checked. - Performs addition that returns
Noneinstead of wrapping around on overflow. - Convenience type to work around the highly unergonomic syntax needed to invoke the functions of overloaded generic traits, in this case
TryFromandTryInto. - Performs division that returns
Noneinstead of panicking on division by zero and instead of wrapping around on underflow and overflow. - Performs multiplication that returns
Noneinstead of wrapping around on underflow or overflow. - Performs a left shift that returns
Noneon shifts larger than or equal to the type width. - Performs a right shift that returns
Noneon shifts larger than or equal to the type width. - Performs subtraction that returns
Noneinstead of wrapping around on underflow. - Trait for things that can be clear (have no bits set). For numeric types, essentially the same as
Zero. - Some sort of cost taken from account temporarily in order to offset the cost to the chain of holding some data
Footprintin 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.
- Infallible conversion trait. Generic over both source and destination types.
- Reversing infallible conversion trait. Generic over both source and destination types.
- Abstraction over a fungible assets system.
- A trait to handle errors and options when you are really sure that a condition must hold, but not brave enough to
expecton 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
Defensivethat can only work for aOption. - Subset of methods similar to
Defensivethat can only work for aResult. - A variant of
Defensivewith 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
TryFromconversion fails. - Trait used to check whether a given validator is currently disabled and should not be participating in consensus (e.g. because they equivocated).
- A lazy call (module function and argument values) that can be executed via its
dispatchmethod. - Can enqueue messages for multiple origins.
- Performs addition that returns
ArithmeticErrorinstead of wrapping around on overflow. - Performs self addition that returns
ArithmeticErrorinstead of wrapping around on overflow. - Performs division that returns
ArithmeticErrorinstead of wrapping around on overflow. - Performs self division that returns
ArithmeticErrorinstead of wrapping around on overflow. - Extends
FixedPointNumberwith the Ensure family functions. - Similar to
TryFrombut returning anArithmeticErrorerror. - A trait to ensure the inherent are before non-inherent in a block.
- Similar to
TryIntobut returning anArithmeticErrorerror. - Performs multiplication that returns
ArithmeticErrorinstead of wrapping around on overflow. - Performs self multiplication that returns
ArithmeticErrorinstead of wrapping around on overflow. - Meta trait that supports all immutable arithmetic
Ensure*operations - Meta trait that supports all assigned arithmetic
Ensure*operations - Some sort of check on the origin is performed by this object.
- Some sort of check on the origin is performed by this object.
- Performs subtraction that returns
ArithmeticErrorinstead of wrapping around on underflow. - Performs self subtraction that returns
ArithmeticErrorinstead of wrapping around on underflow. - 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.
- Something that acts like an
Extrinsic. - An extrinsic on which we can get access to call.
- Implementor is an
Extrinsicand provides metadata about this extrinsic. - FilterDeprecated
- Trait to add a constraint onto the filter.
- A trait for finding the author of a block header based on the
PreRuntimedigests 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.
- A marker trait for something that knows the type of the node block.
- A marker trait for something that knows the type of the runtime block.
- Provides information about the storage version of a pallet.
- A simple, generic one-parameter event notifier/handler.
- Handles incoming messages for a single origin.
- Abstraction around hashing
- Super trait with all the attributes for a hashing output.
- Something which fulfills the abstract idea of a Substrate header. It has types for a
Number, aHashand aHashing. It provides access to anextrinsics_root,state_rootandparent_hash, as well as adigestand a blocknumber. - The pallet hooks trait. This is merely an umbrella trait for:
- Some type that is able to be collapsed into an account ID. It is not possible to recreate the original value from the account ID.
- A trait for a not-quite Linear Type that tracks an imbalance.
- A trait representing an incrementable type.
- 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 implementing integer square root.
- Determine if a
MemberIdis a valid member. - 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).
- A lazy value.
- Anything that can have a
::len()method. - A currency whose accounts can have liquidity restrictions.
- Trait to handle NFT locking mechanism to ensure interactions with the asset can be implemented downstream to extend logic of Uniques/Nfts current functionality.
- Means of changing one type into another in a manner dependent on the source type.
- Fallible conversion trait returning an Option. Generic over both source and destination types.
- Reversing fallible conversion trait returning an Option. Generic over both source and destination types.
- A type that implements Display when in std environment.
- Definition for a bi-directional, fallible conversion between two types.
- A type that implements FromStr when in std environment.
- A type that implements Hash when in std environment.
- A type that implements Serialize when in std environment or serde feature is activated.
- A type that implements Serialize, DeserializeOwned and Debug when in std environment or serde feature is activated.
- A type that can be used in runtime structures.
- Extensible conversion trait. Generic over only source type, with destination type being associated.
- 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.
- A trait which is called when the timestamp is set in the runtime.
- Handler for when some currency “account” decreased in balance for some reason.
- Defines a multiplicative identity element for
Self. - A session handler for specific key type.
- Opaque data type that may be destructured into a series of raw byte slices (which represent individual keys).
- 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. - A interface for looking up preimages from their hash on chain.
- A interface for managing preimages to hashes on chain.
- Trait for things which can be printed from the runtime.
- Something that can compare privileges of two origins.
- Can process messages from a specific origin.
- 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.
- A currency where funds can be reserved from the user.
- Can put the runtime into a safe mode.
- A trait to notify when the runtime enters or exits safe mode.
- Convenience type to work around the highly unergonomic syntax needed to invoke the functions of overloaded generic traits, in this case
SaturatedFromandSaturatedInto. - Saturating arithmetic operations, returning maximum or minimum values instead of overflowing.
- Multiply and divide by a number that isn’t necessarily the same type. Basically just the same as
MulandDivexcept it can be used for all basic numeric types. - Can service queues and execute overweight messages.
- Something that acts like a
SignaturePayloadof anExtrinsic. - Means by which a transaction may be extended. This type embodies both the data and the logic that should be additionally associated with the transaction. It should be plain old data.
- A meta trait for all bit ops.
- A trait for a set which can enumerate its members in order.
- Means of changing one type into another in a manner dependent on the source type. This variant is different to
Lookupin that it doesn’t (can cannot) require any context. - 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. - Fallible conversion trait which returns the argument in the case of being unable to convert. Generic over both source and destination types.
- Reversing fallible conversion trait which returns the argument in the case of being unable to convert back. Generic over both source and destination types.
- A type for which some values make sense to be able to drop without further consideration.
- Extensible conversion trait. Generic over only source type, with destination type being associated.
- A trait for querying a single value from a type defined in the trait.
- Type that can be dispatched with an origin but without checking the origin filter.
- Just like
Fromexcept that if the source value is too big to fit into the destination type then it’ll saturate the destination. - Just like
Intoexcept that if the source value is too big to fit into the destination type then it’ll saturate the destination. - Trait to deal with unix time.
- Provide validation for unsigned extrinsics.
- 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.
ValidatorSetcombined with an identification.- Trait to get the number of variants in any enum.
- Means of signature verification.
- A trait for verifying the seal of a header and returning the author.
- A vesting schedule over a currency. This allows a particular currency to have vesting limits applied to it.
- Allows a pallet to specify storage keys to whitelist during benchmarking. This means those keys will be excluded from the benchmarking performance calculation.
- Defines an additive identity element for
Self.
Functions
- Raises a value to the power of exp, returning
Noneif an overflow occurred. - Raises a value to the power of exp, returning
ArithmeticErrorif an overflow occurred.
Type Definitions
- AllowAllDeprecated
- DenyAllDeprecated
- Shortcut to reference the
Infotype of aDispatchable. - EnsureOneOfDeprecated“OR gate” implementation of
EnsureOriginallowing for differentSuccesstypes forLandR, with them combined using anEithertype. - Extract the hashing type for a block.
- An identifier for a lock. Used for disambiguating different locks so that they can be individually replaced or removed.
- Extract the number type for a block.
- Shortcut to reference the
PostInfotype of aDispatchable.