Module pallet_prelude

Source
Expand description

Prelude to be used alongside pallet macro, for ease of use.

Re-exports§

pub use crate::dispatch::DispatchClass;
pub use crate::dispatch::DispatchResult;
pub use crate::dispatch::DispatchResultWithPostInfo;
pub use crate::dispatch::Parameter;
pub use crate::dispatch::Pays;
pub use crate::inherent::ProvideInherent;
pub use crate::storage;
pub use crate::storage::types::CountedStorageMap;
pub use crate::storage::types::CountedStorageNMap;
pub use crate::storage::types::Key as NMapKey;
pub use crate::storage::types::OptionQuery;
pub use crate::storage::types::ResultQuery;
pub use crate::storage::types::StorageDoubleMap;
pub use crate::storage::types::StorageMap;
pub use crate::storage::types::StorageNMap;
pub use crate::storage::types::StorageValue;
pub use crate::storage::types::ValueQuery;
pub use crate::storage::StorageList;
pub use crate::traits::Authorize;
pub use crate::traits::BuildGenesisConfig;
pub use crate::traits::EnsureOrigin;
pub use crate::traits::GetStorageVersion;
pub use crate::traits::Hooks;
pub use crate::traits::IsType;
pub use crate::traits::OriginTrait;
pub use crate::traits::PalletInfoAccess;
pub use crate::traits::StorageInfoTrait;
pub use crate::traits::StorageVersion;
pub use crate::traits::Task;
pub use crate::Blake2_128;
pub use crate::Blake2_128Concat;
pub use crate::Blake2_256;
pub use crate::Identity;
pub use crate::Twox128;
pub use crate::Twox256;
pub use crate::Twox64Concat;
pub use frame_support::pallet_macros::*;

Macros§

defensive
Generic function to mark an execution path as ONLY defensive.
defensive_assert
Trigger a defensive failure if a condition is not met.
ensure
Evaluate $x:expr and if not true return Err($y:expr).

Structs§

BoundedBTreeMap
A bounded map based on a B-Tree.
BoundedBTreeSet
A bounded set based on a B-Tree.
BoundedVec
A bounded vector.
ConstU32
Const getter for a basic type.
ConstUint
Const getter for unsigned integers.
GetDefault
Implement Get by returning Default for any type that implements Default.
InherentData
Inherent data to include in a block.
MakeFatalError
Auxiliary to make any given error resolve to is_fatal_error() == true for IsFatalError.
PhantomData
Zero-sized type used to mark things that “act like” they own a T.
ValidTransaction
Information concerning a valid transaction.
WeakBoundedVec
A weakly bounded vector.
Weight

Enums§

DispatchError
Reason why a dispatch call failed.
InvalidTransaction
An invalid transaction validity.
TransactionSource
The source of the transaction.
TransactionValidityError
Errors that can occur while checking the validity of a transaction.
UnknownTransaction
An unknown transaction validity.

Constants§

MAX_MODULE_ERROR_ENCODED_SIZE
The number of bytes of the module-specific error field defined in ModuleError. In FRAME, this is the maximum encoded size of a pallet error type.

Traits§

CheckedAdd
Performs addition that returns None instead of wrapping around on overflow.
CheckedConversion
Convenience type to work around the highly unergonomic syntax needed to invoke the functions of overloaded generic traits, in this case TryFrom and TryInto.
CheckedDiv
Performs division that returns None instead of panicking on division by zero and instead of wrapping around on underflow and overflow.
CheckedMul
Performs multiplication that returns None instead of wrapping around on underflow or overflow.
CheckedShl
Performs a left shift that returns None on shifts larger than or equal to the type width.
CheckedShr
Performs a right shift that returns None on shifts larger than or equal to the type width.
CheckedSub
Performs subtraction that returns None instead of wrapping around on underflow.
Decode
Trait that allows zero-copy read of value-references from slices in LE format.
DecodeWithMemTracking
Marker trait used for identifying types that call the Input::on_before_alloc_mem hook while decoding.
Encode
Trait that allows zero-copy write of value-references to slices in LE format.
Get
A trait for querying a single value from a type.
MaxEncodedLen
Items implementing MaxEncodedLen have a statically known maximum encoded size.
MaybeSerializeDeserialize
A type that implements Serialize, DeserializeOwned and Debug when in std environment or serde feature is activated.
Member
A type that can be used in runtime structures.
One
Defines a multiplicative identity element for Self.
TypeInfo
Implementors return their meta type information.
TypedGet
A trait for querying a single value from a type defined in the trait.
ValidateUnsigned
Provide validation for unsigned extrinsics.
Zero
Defines an additive identity element for Self.

Type Aliases§

InherentIdentifier
An identifier for an inherent.
TransactionLongevity
Minimum number of blocks a transaction will remain valid for. TransactionLongevity::max_value() means “forever”.
TransactionPriority
Priority for a transaction. Additive. Higher is better.
TransactionTag
Tag for a transaction. No two transactions with the same tag should be placed on-chain.
TransactionValidity
Information on a transaction’s validity and, if valid, on how it relates to other transactions.
TransactionValidityWithRefund
Information on a transaction’s validity and, if valid, on how it relates to other transactions and some refund for the operation.
ValidateResult
Shortcut for the result value of the validate function.

Attribute Macros§

inject_runtime_type
The optional attribute #[inject_runtime_type] can be attached to RuntimeCall, RuntimeEvent, RuntimeOrigin or PalletInfo in an impl statement that has #[register_default_impl] attached to indicate that this item is generated by construct_runtime.
register_default_impl
Attach this attribute to an impl statement that you want to use with #[derive_impl(..)].

Derive Macros§

CloneNoBound
Derive Clone but do not bound any generic.
DebugNoBound
Derive Debug but do not bound any generic.
Decode
Derive parity_scale_codec::Decode for struct and enum.
DecodeWithMemTracking
Derive parity_scale_codec::DecodeWithMemTracking for struct and enum.
Encode
Derive parity_scale_codec::Encode and parity_scale_codec::EncodeLike for struct and enum.
EqNoBound
Derive Eq but do not bound any generic.
MaxEncodedLen
Derive parity_scale_codec::MaxEncodedLen for struct and enum.
PartialEqNoBound
Derive PartialEq but do not bound any generic.
RuntimeDebug
RuntimeDebugNoBound
Derive [Debug], if std is enabled it uses frame_support::DebugNoBound, if std is not enabled it just returns "<wasm:stripped>". This behaviour is useful to prevent bloating the runtime WASM blob from unneeded code.
TypeInfo