pezstaging_teyrchain_info/
lib.rs1#![cfg_attr(not(feature = "std"), no_std)]
20
21pub use pezpallet::*;
22
23#[pezframe_support::pezpallet]
24pub mod pezpallet {
25 use pezcumulus_primitives_core::ParaId;
26 use pezframe_support::pezpallet_prelude::*;
27 use pezframe_system::pezpallet_prelude::*;
28
29 #[pezpallet::pezpallet]
30 pub struct Pezpallet<T>(_);
31
32 #[pezpallet::config]
33 pub trait Config: pezframe_system::Config {}
34
35 #[pezpallet::hooks]
36 impl<T: Config> Hooks<BlockNumberFor<T>> for Pezpallet<T> {}
37
38 #[pezpallet::call]
39 impl<T: Config> Pezpallet<T> {}
40
41 #[pezpallet::genesis_config]
42 pub struct GenesisConfig<T: Config> {
43 #[serde(skip)]
44 pub _config: core::marker::PhantomData<T>,
45 pub teyrchain_id: ParaId,
46 }
47
48 impl<T: Config> Default for GenesisConfig<T> {
49 fn default() -> Self {
50 Self { teyrchain_id: 100.into(), _config: Default::default() }
51 }
52 }
53
54 #[pezpallet::genesis_build]
55 impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
56 fn build(&self) {
57 TeyrchainId::<T>::put(self.teyrchain_id);
58 }
59 }
60
61 #[pezpallet::type_value]
62 pub(super) fn DefaultForTeyrchainId() -> ParaId {
63 100.into()
64 }
65
66 #[pezpallet::storage]
67 pub(super) type TeyrchainId<T: Config> =
68 StorageValue<_, ParaId, ValueQuery, DefaultForTeyrchainId>;
69
70 impl<T: Config> Get<ParaId> for Pezpallet<T> {
71 fn get() -> ParaId {
72 TeyrchainId::<T>::get()
73 }
74 }
75
76 impl<T: Config> Pezpallet<T> {
77 pub fn teyrchain_id() -> ParaId {
78 TeyrchainId::<T>::get()
79 }
80 }
81}