frame_support_test_pallet/lib.rs
1// This file is part of Substrate.
2
3// Copyright (C) Parity Technologies (UK) Ltd.
4// SPDX-License-Identifier: Apache-2.0
5
6// Licensed under the Apache License, Version 2.0 (the "License");
7// you may not use this file except in compliance with the License.
8// You may obtain a copy of the License at
9//
10// http://www.apache.org/licenses/LICENSE-2.0
11//
12// Unless required by applicable law or agreed to in writing, software
13// distributed under the License is distributed on an "AS IS" BASIS,
14// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15// See the License for the specific language governing permissions and
16// limitations under the License.
17
18//! A basic pallet that can be used to test `construct_runtime!`.
19
20// Ensure docs are propagated properly by the macros.
21#![warn(missing_docs)]
22
23pub use pallet::*;
24
25#[frame_support::pallet]
26pub mod pallet {
27 use frame_support::pallet_prelude::*;
28
29 #[pallet::pallet]
30 pub struct Pallet<T>(_);
31
32 #[pallet::config]
33 pub trait Config: frame_system::Config {}
34
35 /// I'm the documentation
36 #[pallet::storage]
37 pub type Value<T> = StorageValue<_, u32>;
38
39 #[pallet::genesis_config]
40 #[derive(frame_support::DefaultNoBound)]
41 pub struct GenesisConfig<T: Config> {
42 #[serde(skip)]
43 _config: core::marker::PhantomData<T>,
44 }
45
46 #[pallet::genesis_build]
47 impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
48 fn build(&self) {}
49 }
50
51 #[pallet::error]
52 pub enum Error<T> {
53 /// Something failed
54 Test,
55 }
56}