pop_chains/new_pallet/
new_pallet_options.rs

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