pop_chains/new_pallet/
new_pallet_options.rs

1use clap::ValueEnum;
2use serde::Serialize;
3use strum_macros::{EnumIter, EnumMessage};
4
5/// This enum is used to register from the CLI which types that are kind of usual in config traits
6/// are included in the pallet
7#[derive(Debug, Copy, Clone, PartialEq, EnumIter, EnumMessage, ValueEnum, Serialize)]
8pub enum TemplatePalletConfigCommonTypes {
9	/// This type will enable your pallet to emit events.
10	#[strum(
11		message = "RuntimeEvent",
12		detailed_message = "This type will enable your pallet to emit events."
13	)]
14	RuntimeEvent,
15	/// This type will be helpful if your pallet needs to deal with the outer RuntimeOrigin enum,
16	/// or if your pallet needs to use custom origins. Note: If you have run the command using -o,
17	/// this type will be added anyway.
18	#[strum(
19		message = "RuntimeOrigin",
20		detailed_message = "This type will be helpful if your pallet needs to deal with the outer RuntimeOrigin enum, or if your pallet needs to use custom origins. Note: If you have run the command using -o, this type will be added anyway."
21	)]
22	RuntimeOrigin,
23	/// This type will allow your pallet to interact with the native currency of the blockchain.
24	#[strum(
25		message = "Currency",
26		detailed_message = "This type will allow your pallet to interact with the native currency of the blockchain."
27	)]
28	Currency,
29}
30
31/// This enum is used to determine which storage shape has a storage item in the pallet
32#[derive(Debug, Copy, Clone, PartialEq, EnumIter, EnumMessage, ValueEnum, Serialize)]
33pub enum TemplatePalletStorageTypes {
34	/// A storage value is a single value of a given type stored on-chain.
35	#[strum(
36		message = "StorageValue",
37		detailed_message = "A storage value is a single value of a given type stored on-chain."
38	)]
39	StorageValue,
40	/// A storage map is a mapping of keys to values of a given type stored on-chain.
41	#[strum(
42		message = "StorageMap",
43		detailed_message = "A storage map is a mapping of keys to values of a given type stored on-chain."
44	)]
45	StorageMap,
46	/// A wrapper around a StorageMap and a StorageValue (with the value being u32) to keep track
47	/// of how many items are in a map.
48	#[strum(
49		message = "CountedStorageMap",
50		detailed_message = "A wrapper around a StorageMap and a StorageValue (with the value being u32) to keep track of how many items are in a map."
51	)]
52	CountedStorageMap,
53	/// This structure associates a pair of keys with a value of a specified type stored on-chain.
54	#[strum(
55		message = "StorageDoubleMap",
56		detailed_message = "This structure associates a pair of keys with a value of a specified type stored on-chain."
57	)]
58	StorageDoubleMap,
59	/// This structure associates an arbitrary number of keys with a value of a specified type
60	/// stored on-chain.
61	#[strum(
62		message = "StorageNMap",
63		detailed_message = "This structure associates an arbitrary number of keys with a value of a specified type stored on-chain."
64	)]
65	StorageNMap,
66	/// A wrapper around a StorageNMap and a StorageValue (with the value being u32) to keep track
67	/// of how many items are in a map.
68	#[strum(
69		message = "CountedStorageNMap",
70		detailed_message = "A wrapper around a StorageNMap and a StorageValue (with the value being u32) to keep track of how many items are in a map."
71	)]
72	CountedStorageNMap,
73}
74
75/// This enum is used to register from the CLI which options are selected by the user to be included
76/// in the pallet.
77#[derive(Debug, Copy, Clone, PartialEq, EnumIter, EnumMessage)]
78pub enum TemplatePalletOptions {
79	/// Uses a default configuration for the pallet's config trait.
80	#[strum(
81		message = "DefaultConfig",
82		detailed_message = "Use a default configuration for your config trait."
83	)]
84	DefaultConfig,
85	/// Adds a genesis config to the pallet.
86	#[strum(message = "GenesisConfig", detailed_message = "Add a genesis config to your pallet.")]
87	GenesisConfig,
88	/// Adds a custom origin to the pallet.
89	#[strum(message = "Custom Origin", detailed_message = "Add a custom origin to your pallet.")]
90	CustomOrigin,
91}