Crate frame_support
source ·Expand description
Re-exports§
pub use self::storage::storage_noop_guard::StorageNoopGuard;
pub use self::dispatch::Callable;
pub use self::dispatch::Parameter;
pub use self::storage::migration;
pub use self::storage::IterableStorageDoubleMap;
pub use self::storage::IterableStorageMap;
pub use self::storage::IterableStorageNMap;
pub use self::storage::StorageDoubleMap;
pub use self::storage::StorageMap;
pub use self::storage::StorageNMap;
pub use self::storage::StoragePrefixedMap;
pub use self::storage::StorageValue;
pub use sp_runtime;
Modules§
- Utilities for dealing with crypto primitives. Sometimes we need to use these from inside WASM contracts, where crypto calculations have weak performance.
- Dispatch system. Contains a macro for defining runtime modules and generating values representing lazy module function calls.
- Provides functions to interact with the dispatch context.
- Experimental macros for defining dynamic params that can be used in pallet configs.
- errorDeprecated
- Helper for generating the
RuntimeGenesisConfig
instance for presets. Helper macro allowing to construct JSON representation of partially initialized structs. - Helper for implementing GenesisBuilder runtime API Helper functions for implementing
sp_genesis_builder::GenesisBuilder
for runtimes. - Some instance placeholder to be used in
frame_support::pallet
attribute macro. - Contains macro stubs for all of the
pallet::
macros - Prelude to be used alongside pallet macro, for ease of use.
- Stuff to do with the runtime’s storage.
- Prelude to be used for pallet testing, for ease of use.
- Traits and associated utilities for use in the FRAME environment.
- Re-exports
sp-weights
public API, and contains benchmarked weight constants specific to FRAME.
Macros§
- Assert an expression returns an error specified.
- Assert an expression returns an error specified.
- Assert an expression returns error with the given weight.
- Assert that the maximum encoding size does not exceed the value defined in
MAX_MODULE_ERROR_ENCODED_SIZE
during compilation. - Evaluate an expression, assert it returns an expected
Err
value and that runtime storage has not been mutated (i.e. expression is a no-operation). - Panic if an expression doesn’t evaluate to
Ok
. - Evaluate any expression and assert that runtime storage has not been mutated (i.e. expression is a storage no-operation).
- Creates a JSON patch for given
struct_type
, supporting recursive field initialization. - Construct a runtime, with the given name and the given pallets.
- Convert the current crate version into a
CrateVersion
. - Generic function to mark an execution path as ONLY defensive.
- Trigger a defensive failure if a condition is not met.
- Evaluate
$x:expr
and if not true returnErr($y:expr)
. - Return Err of the expression:
return Err($expression);
. - Do something hypothetically by rolling back any changes afterwards.
- Assert something to be hypothetically
Ok
, without actually committing it. - Simple macro to explicitly implement EnsureOriginWithArg to be used on any type which implements EnsureOrigin. This is quick and dirty, so you must use the type parameters
O
(the origin type),T
(the argument type) andAccountId
(if you are using theO: ..
form). - Macro that inserts some tokens after the first match of some pattern.
- match_typeDeprecatedCreate a type which implements the
Contains
trait for a particular type with syntax similar tomatches!
. - Create a type which implements the
Contains
trait for a particular type with syntax similar tomatches!
. - Macro for easily creating a new implementation of both the
Get
andContains
traits. Use exactly as withparameter_types
, only the type must beOrd
. - Create new implementations of the
Get
trait. - Print out a formatted message.
- Enable/disable the given code depending on
feature = "std"
being enabled for the crate or not. - Enable/disable the given code depending on
all(not(feature = "try-runtime"), not(feature = "std"))
being enabled for the crate or not. - Enable/disable the given code depending on
feature = "try-runtime"
being enabled for the crate or not. - Enable/disable the given code depending on
any(feature = "try-runtime", feature = "std")
being enabled for the crate or not.
Structs§
- Hash storage keys with blake2 128
- Hash storage keys with blake2 256
- Hash storage keys with
concat(blake2_128(key), key)
- A bounded map based on a B-Tree.
- A bounded set based on a B-Tree.
- A bounded slice.
- A bounded vector.
- Store the key directly.
- A pallet identifier. These are per pallet and should be stored in a registry somewhere.
- Hash storage keys with
concat(twox64(key), key)
- Hash storage keys with twox 128
- Hash storage keys with twox 256
- A weakly bounded vector.
Enums§
- A type that cannot be instantiated.
Constants§
- A unified log target for support operations.
- The number of bytes of the module-specific
error
field defined inModuleError
. In FRAME, this is the maximum encoded size of a pallet error type.
Traits§
- Trait for things which can be printed from the runtime.
- Hasher to use to hash keys to insert to storage.
- Hasher to use to hash keys to insert to storage.
Functions§
- Print out the debuggable type.
- Print something that implements
Printable
from the runtime.
Type Aliases§
- Consensus engine unique ID.
Attribute Macros§
- This attribute can be used to derive a full implementation of a trait based on a local partial impl and an external impl containing defaults that can be overridden in the local impl.
- The pallet macro has 2 purposes:
- Attach this attribute to an impl statement that you want to use with
#[derive_impl(..)]
. - Assert the annotated function is executed within a storage transaction.
- Construct a runtime, with the given name and the given pallets.
- Generate a
#[pallet::storage]
alias outside of a pallet. - Execute the annotated function in a new storage transaction.
Derive Macros§
- Derive
Clone
but do not bound any generic. - Derive
Debug
but do not bound any generic. - Derive
Default
but do not bound any generic. - Derive
Eq
but do not bound any generic. - Derive
Ord
but do not bound any generic. - Derive
PartialEq
but do not bound any generic. - Derive
PartialOrd
but do not bound any generic. - Derive [
Debug
], ifstd
is enabled it usesframe_support::DebugNoBound
, ifstd
is not enabled it just returns"<wasm:stripped>"
. This behaviour is useful to prevent bloating the runtime WASM blob from unneeded code.