Crate pallet_example_basic
source ·Expand description
§Basic Example Pallet
A pallet demonstrating concepts, APIs and structures common to most FRAME runtimes.
This pallet serves as an example and is not meant to be used in production.
Made with Substrate, for Polkadot.
§Pallet API
See the pallet
module for more information about the interfaces this pallet exposes,
including its configuration trait, dispatchables, storage items, events and errors.
§Overview
This pallet provides basic examples of using:
- A custom weight calculator able to classify a call’s dispatch class (see:
[
frame_support::dispatch::DispatchClass
]) - Pallet hooks to implement some custom logic that’s executed before and after a block is
imported (see: [
frame_support::traits::Hooks
]) - Inherited weight annotation for pallet calls, used to create less repetition for calls that
use the
Config::WeightInfo
trait to calculate call weights. This can also be overridden, as demonstrated byCall::set_dummy
. - A private function that performs a storage update.
- A simple transaction extension implementation (see:
[
sp_runtime::traits::TransactionExtension
]) which increases the priority of theCall::set_dummy
if it’s present and drops any transaction with an encoded length higher than 200 bytes.
Re-exports§
Modules§
- The
pallet
module in each FRAME pallet hosts the most important items needed to construct this pallet. - Autogenerated weights for pallet_example_basic
Structs§
- A simple transaction extension that checks for the
set_dummy
call. In that case, it increases the priority and prints some log.