git.delta.rocks / unique-network / refs/commits / 81e4404a75c5

difftreelog

feat(pallet nft) added GenesisConfig

PraetorP2023-04-20parent: #fb505f1.patch.diff
in: master

3 files changed

modifiednode/cli/src/chain_spec.rsdiffbeforeafterboth
168 .collect(),168 .collect(),
169 },169 },
170 common: Default::default(),170 common: Default::default(),
171 nonfungible: Default::default(),
171 treasury: Default::default(),172 treasury: Default::default(),
172 tokens: TokensConfig { balances: vec![] },173 tokens: TokensConfig { balances: vec![] },
173 sudo: SudoConfig {174 sudo: SudoConfig {
227 .to_vec(),228 .to_vec(),
228 },229 },
229 common: Default::default(),230 common: Default::default(),
231 nonfungible: Default::default(),
230 balances: BalancesConfig {232 balances: BalancesConfig {
231 balances: $endowed_accounts233 balances: $endowed_accounts
232 .iter()234 .iter()
modifiedpallets/common/src/lib.rsdiffbeforeafterboth
--- a/pallets/common/src/lib.rs
+++ b/pallets/common/src/lib.rs
@@ -496,6 +496,7 @@
 			StorageVersion::new(1).put::<Pallet<T>>();
 		}
 	}
+
 	impl<T: Config> Pallet<T> {
 		/// Helper function that handles deposit events
 		pub fn deposit_event(event: Event<T>) {
modifiedpallets/nonfungible/src/lib.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/lib.rs
+++ b/pallets/nonfungible/src/lib.rs
@@ -281,6 +281,23 @@
 		Value = bool,
 		QueryKind = ValueQuery,
 	>;
+
+	#[pallet::genesis_config]
+	pub struct GenesisConfig<T>(PhantomData<T>);
+
+	#[cfg(feature = "std")]
+	impl<T: Config> Default for GenesisConfig<T> {
+		fn default() -> Self {
+			Self(Default::default())
+		}
+	}
+
+	#[pallet::genesis_build]
+	impl<T: Config> GenesisBuild<T> for GenesisConfig<T> {
+		fn build(&self) {
+			StorageVersion::new(1).put::<Pallet<T>>();
+		}
+	}
 }
 
 pub struct NonfungibleHandle<T: Config>(pallet_common::CollectionHandle<T>);