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§
- base2
- 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
. - base16
- 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. - defensive_
prelude - Prelude module for all defensive traits to be imported at once.
- dynamic_
params - Types and traits for dynamic parameters.
- schedule
- Traits and associated utilities for scheduling dispatchables in FRAME.
- tasks
- Contains the
Task
trait, which defines a general-purpose way for defining and executing service work, and supporting types. - tokens
- Traits for working with tokens and their associated datastructures.
Structs§
- AsContains
- Adapter struct for turning an
OrderedMembership
impl into aContains
impl. - AsEnsure
Origin With Arg - Backing
- Some amount of backing from a group. The precise definition of what it means to “back” something is left flexible.
- Binary
Merkle Tree Prover - Implements
VerifyExistenceProof
using a binary merkle tree. - Call
Metadata - The function and pallet name of the Call.
- Class
Count Of - Clear
Filter Guard - Guard type for clearing all pushed constraints from a
FilterStack
and reinstating them when dropped. - Const
Bool - Const getter for a basic type.
- ConstI8
- Const getter for a basic type.
- Const
I16 - Const getter for a basic type.
- Const
I32 - Const getter for a basic type.
- Const
I64 - Const getter for a basic type.
- Const
I128 - Const getter for a basic type.
- Const
Int - Const getter for signed integers.
- ConstU8
- Const getter for a basic type.
- Const
U16 - Const getter for a basic type.
- Const
U32 - Const getter for a basic type.
- Const
U64 - Const getter for a basic type.
- Const
U128 - Const getter for a basic type.
- Const
Uint - Const getter for unsigned integers.
- Constant
Storage Price - Constant
Price
regardless of the givenFootprint
. - Crate
Version - The version of a crate.
- Disabled
- Placeholder marking functionality disabled. Useful for disabling various (sub)features.
- Either
Of - “OR gate” implementation of
EnsureOrigin
,Success
type for bothL
andR
must be equal. - Either
OfDiverse - “OR gate” implementation of
EnsureOrigin
allowing for differentSuccess
types forL
andR
, with them combined using anEither
type. - Enqueue
With Origin - Adapter type to transform an
EnqueueMessage
with an origin into aHandleMessage
impl. - Ensure
Origin Equal OrHigher Privilege EnsureOrigin
implementation that checks that an origin has equal or higher privilege compared to the expectedOrigin
.- Equal
Privilege Only - Implementation of
PrivilegeCmp
that only checks for equal origins. - Equals
- An implementation of
Contains
which contains only equal members toT
. - Everything
But - A
Contains
implementation that contains everything except the values inExclude
. - Filter
Stack Guard - Guard type for pushing a constraint to a
FilterStack
and popping when dropped. - Footprint
- The resource footprint of a bunch of blobs. We assume only the number of blobs and their total size in bytes matter.
- From
Contains - A
ContainsPair
implementation that has aContains
implementation for each member of the pair. - From
Contains Pair - Converter
struct
to use aContainsPair
implementation for aContains
bound. - GetDefault
- Implement Get by returning Default for any type that implements Default.
- Inside
Both - A
Contains
implementation which contains all members ofThese
which are also members ofThose
. - IsInVec
- Trivial utility for implementing
Contains
/OrderedMembership
with aVec
. - Linear
Storage Price - A storage price that increases linearly with the number of elements and their size.
- MapSuccess
- A derivative
EnsureOrigin
implementation. It mutates theSuccess
result of anOriginal
implementation with a givenMutator
. - Never
Ensure Origin EnsureOrigin
implementation that always fails.- NoOp
Poll - NoOp polling is required if pallet-referenda functionality not needed.
- NoStorage
Version Set - Special marker struct used when
storage_version
is not defined for a pallet. - Noop
Service Queues - Services queues by doing nothing.
- Pallet
Info Data - Information regarding an instance of a pallet.
- Queue
Footprint - The resource footprint of a queue.
- Sixteen
Patricia Merkle Tree Existence Proof - Proof used by
SixteenPatriciaMerkleTreeProver
forVerifyExistenceProof
. - Sixteen
Patricia Merkle Tree Prover - Implements
VerifyExistenceProof
using a 16-patricia merkle tree. - Storage
Info - Metadata about storage from the runtime.
- Storage
MapShim - 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. - Storage
Version - The storage version of a pallet.
- These
Except - A
Contains
implementation that contains all members ofThese
excepting any members inExcept
. - Tracked
Storage Key - Storage key with read/write tracking information.
- Transform
Origin - Transform the origin of an
EnqueueMessage
viaC::convert
. - TryMap
Success - 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. - TryWith
Morphed Arg - Variant
Count Of - Adapter for
Get<u32>
to accessVARIANT_COUNT
fromtrait pub trait VariantCount {
. - Wrapper
Keep Opaque - A wrapper for any type
T
which implement encode/decode in a way compatible withVec<u8>
. - Wrapper
Opaque - A wrapper for any type
T
which implement encode/decode in a way compatible withVec<u8>
.
Enums§
- Bounded
- Everything
- A
Contains
implementation that contains every value. - Execute
Overweight Error - Errors that can happen when attempting to execute an overweight message with
ServiceQueues::execute_overweight()
. - Nothing
- A
Contains
implementation that contains no value. - Poll
Status - Process
Message Error - Errors that can happen when attempting to process a message with
ProcessMessage::process_message()
. - Safe
Mode Error - The error type for
SafeMode
. - Same
OrOther - 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. - Transaction
Pause Error - The error type for
TransactionPause
. - Trie
Error - A runtime friendly error type for tries.
Constants§
- STORAGE_
VERSION_ STORAGE_ KEY_ POSTFIX - The storage key postfix that is used to store the
StorageVersion
per pallet.
Traits§
- Account
Touch - Trait for touching/creating an asset account with a deposit taken from a designated depositor specified by the client.
- Before
AllRuntime Migrations - Implemented by pallets, allows defining logic to run prior to any
OnRuntimeUpgrade
logic. - Build
Genesis Config - A trait to define the build function of a genesis config for both runtime and pallets.
- Caller
Trait - 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. - Change
Members - Trait for type that can handle incremental changes to a set of account IDs.
- Consideration
- Some sort of cost taken from account temporarily in order to offset the cost to the chain of
holding some data
Footprint
in state. - Contains
- A trait for querying whether a type can be said to “contain” a value.
- Contains
Length Bound - A trait for querying bound for the length of an implementation of
Contains
- Contains
Pair - A trait for querying whether a type can be said to “contain” a pair-value.
- Defensive
- 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. - Defensive
Max - Defensively calculates the maximum of two values.
- Defensive
Min - Defensively calculates the minimum of two values.
- Defensive
Option - Subset of methods similar to
Defensive
that can only work for aOption
. - Defensive
Result - Subset of methods similar to
Defensive
that can only work for aResult
. - Defensive
Saturating - A variant of
Defensive
with the same rationale, for the arithmetic operations where in case an infallible operation fails, it saturates. - Defensive
Truncate From - Construct an object by defensively truncating an input if the
TryFrom
conversion fails. - Disabled
Validators - Trait used to check whether a given validator is currently disabled and should not be participating in consensus (e.g. because they equivocated).
- Enqueue
Message - Can enqueue messages for multiple origins.
- Ensure
Inherents AreFirst - A trait to ensure the inherent are before non-inherent in a block.
- Ensure
Origin - Some sort of check on the origin is performed by this object.
- Ensure
Origin With Arg - Some sort of check on the origin is performed by this object.
- Estimate
Call Fee - Something that can estimate the fee of a (frame-based) call.
- Estimate
Next NewSession - Something that can estimate at which block scheduling of the next session will happen (i.e when we will try to fetch new validators).
- Estimate
Next Session Rotation - Something that can estimate at which block the next session rotation will happen (i.e. a new session starts).
- Execute
Block - Something that can execute a given block.
- Extrinsic
Call - An extrinsic on which we can get access to call.
- Filter
Deprecated - Filter
Stack - Trait to add a constraint onto the filter.
- Find
Author - A trait for finding the author of a block header based on the
PreRuntime
digests contained within it. - Genesis
Build Deprecated - A trait to define the build function of a genesis config, T and I are placeholder for pallet trait and pallet instance.
- Get
- A trait for querying a single value from a type.
- GetBacking
- Retrieve the backing from an object’s ref.
- GetCall
Index - Gets the function index of the Call.
- GetCall
Metadata - Gets the metadata for the Call - function name and pallet name.
- GetCall
Name - Gets the function name of the Call.
- GetStorage
Version - Provides information about a pallet’s storage versions.
- Handle
Lifetime - A simple, generic one-parameter event notifier/handler.
- Handle
Message - Handles incoming messages for a single origin.
- Hooks
- The pallet hooks trait. This is merely an umbrella trait for:
- Incrementable
- A trait representing an incrementable type.
- Inherent
Builder - Interface for types capable of constructing an inherent extrinsic.
- Initialize
Members - Trait for type that can handle the initialization of account IDs at genesis.
- Instance
- An instance of a pallet in the storage.
- Instance
Filter - Simple trait for providing a filter over a reference to some type, given an instance of itself.
- Integrity
Test - See
Hooks::integrity_test
. - IsInherent
- A trait to check if an extrinsic is an inherent.
- IsSub
Type - Something that can be checked to be a of sub type
T
. - IsType
- Trait to be used when types are exactly same.
- KeyOwner
Proof System - Something which can compute and check proofs of a historical key owner and return full identification data of that key owner.
- Lateness
- 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).
- Len
- Anything that can have a
::len()
method. - Offchain
Worker - Off-chain computation trait.
- OnFinalize
- See
Hooks::on_finalize
. - OnGenesis
- A trait that will be called at genesis.
- OnIdle
- See
Hooks::on_idle
. - OnInitialize
- See
Hooks::on_initialize
. - OnKilled
Account - The account with the given id was reaped.
- OnNew
Account - Handler for when a new account has been created.
- OnPoll
- Periodically executes logic. Is not guaranteed to run within a specific timeframe and should only be used on logic that has no deadline.
- OnRuntime
Upgrade - See
Hooks::on_runtime_upgrade
. - OnTimestamp
Set - A trait which is called when the timestamp is set in the runtime.
- OneSession
Handler - A session handler for specific key type.
- Origin
Trait - Methods available on
frame_system::Config::RuntimeOrigin
. - Pallet
Error - Trait indicating that the implementing type is going to be included as a field in a variant of
the
#[pallet::error]
enum type. - Pallet
Info - Provides information about the pallet itself and its setup in the runtime.
- Pallet
Info Access - Provides information about the pallet itself and its setup in the runtime.
- Pallets
Info Access - Provide information about a bunch of pallets.
- Partial
Storage Info Trait - Similar to
StorageInfoTrait
, a trait to give partial information about storage. - Polling
- Post
Inherents - Provides a callback to execute logic after the all inherents.
- Post
Transactions - Provides a callback to execute logic before the all transactions.
- PreInherents
- Provides a callback to execute logic before the all inherents.
- Preimage
Provider - A interface for looking up preimages from their hash on chain.
- Preimage
Recipient - A interface for managing preimages to hashes on chain.
- Privilege
Cmp - Something that can compare privileges of two origins.
- Process
Message - Can process messages from a specific origin.
- Proof
ToHashes - 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.
- Proving
Trie - An interface for creating, interacting with, and creating proofs in a merkle trie.
- Query
Preimage - A interface for looking up preimages from their hash on chain.
- Queue
Paused Query - Provides information on paused queues.
- Randomness
- A trait that is able to provide randomness.
- Ranked
Members - Ranked membership data structure.
- Ranked
Members Swap Handler - Handler that can deal with the swap of two members.
- Safe
Mode - Can put the runtime into a safe mode.
- Safe
Mode Notify - A trait to notify when the runtime enters or exits safe mode.
- Service
Queues - Can service queues and execute overweight messages.
- Signed
Transaction Builder - Interface for types capable of constructing a signed transaction.
- Sorted
Members - A trait for a set which can enumerate its members in order.
- Storage
Info Trait - A trait to give information about storage.
- Storage
Instance - An instance of a storage in a pallet.
- Store
Preimage - A interface for managing preimages to hashes on chain.
- Stored
Map - An abstraction of a value stored within storage, but possibly as part of a larger composite item.
- Time
- Transaction
Pause - Can pause specific transactions from being processed.
- TryCollect
- Try and collect into a collection
C
. - TryDrop
- A type for which some values make sense to be able to drop without further consideration.
- Typed
Get - A trait for querying a single value from a type defined in the trait.
- Unchecked
OnRuntime Upgrade - 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. - Unfiltered
Dispatchable - Type that can be dispatched with an origin but without checking the origin filter.
- Unix
Time - Trait to deal with unix time.
- Validator
Registration - Implementors of this trait provide information about whether or not some validator has been registered with them. The Session module is an implementor.
- Validator
Set - A trait for online node inspection in a session.
- Validator
SetWith Identification ValidatorSet
combined with an identification.- Variant
Count - Trait to get the number of variants in any enum.
- Verify
Existence Proof - Something that can verify the existence of some data in a given proof.
- Verify
Seal - A trait for verifying the seal of a header and returning the author.
- Vote
Tally - Whitelisted
Storage Keys - 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§
- Allow
All Deprecated - Bounded
Inline - DenyAll
Deprecated - Ensure
OneOf Deprecated - “OR gate” implementation of
EnsureOrigin
allowing for differentSuccess
types forL
andR
, with them combined using anEither
type. - Fetch
Result