git.delta.rocks / unique-network / refs/commits / 566036f697e1

difftreelog

Merge pull request #421 from UniqueNetwork/release-v924011

kozyrevdev2022-07-08parents: #a458077 #846700d.patch.diff
in: master
Release v924011

6 files changed

modifiedpallets/common/src/lib.rsdiffbeforeafterboth
553 #[pallet::hooks]553 #[pallet::hooks]
554 impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {554 impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
555 fn on_runtime_upgrade() -> Weight {555 fn on_runtime_upgrade() -> Weight {
556 if StorageVersion::get::<Pallet<T>>() < StorageVersion::new(1) {556 StorageVersion::new(1).put::<Pallet<T>>();
557 use up_data_structs::{CollectionVersion1, CollectionVersion2};
558 <CollectionById<T>>::translate::<CollectionVersion1<T::AccountId>, _>(|id, v| {
559 let mut props = Vec::new();
560 if !v.offchain_schema.is_empty() {
561 props.push(Property {
562 key: b"_old_offchainSchema".to_vec().try_into().unwrap(),
563 value: v
564 .offchain_schema
565 .clone()
566 .into_inner()
567 .try_into()
568 .expect("offchain schema too big"),
569 });
570 }
571 if !v.variable_on_chain_schema.is_empty() {
572 props.push(Property {
573 key: b"_old_variableOnChainSchema".to_vec().try_into().unwrap(),
574 value: v
575 .variable_on_chain_schema
576 .clone()
577 .into_inner()
578 .try_into()
579 .expect("offchain schema too big"),
580 });
581 }
582 if !v.const_on_chain_schema.is_empty() {
583 props.push(Property {
584 key: b"_old_constOnChainSchema".to_vec().try_into().unwrap(),
585 value: v
586 .const_on_chain_schema
587 .clone()
588 .into_inner()
589 .try_into()
590 .expect("offchain schema too big"),
591 });
592 }
593 props.push(Property {
594 key: b"_old_schemaVersion".to_vec().try_into().unwrap(),
595 value: match v.schema_version {
596 SchemaVersion::ImageURL => b"ImageUrl".as_slice(),
597 SchemaVersion::Unique => b"Unique".as_slice(),
598 }
599 .to_vec()
600 .try_into()
601 .unwrap(),
602 });
603 Self::set_scoped_collection_properties(
604 id,
605 PropertyScope::None,
606 props.into_iter(),
607 )
608 .expect("existing data larger than properties");
609 let mut new = CollectionVersion2::from(v.clone());
610 new.permissions.access = Some(v.access);
611 new.permissions.mint_mode = Some(v.mint_mode);
612 Some(new)
613 });
614 }
615557
616 0558 0
617 }559 }
modifiedpallets/nonfungible/src/lib.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/lib.rs
+++ b/pallets/nonfungible/src/lib.rs
@@ -183,61 +183,7 @@
 	#[pallet::hooks]
 	impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
 		fn on_runtime_upgrade() -> Weight {
-			if StorageVersion::get::<Pallet<T>>() < StorageVersion::new(1) {
-				let mut had_consts = BTreeSet::new();
-				<TokenData<T>>::translate::<ItemDataVersion1<T::CrossAccountId>, _>(
-					|(collection, token), v| {
-						let mut props = vec![];
-						if !v.const_data.is_empty() {
-							props.push(Property {
-								key: b"_old_constData".to_vec().try_into().unwrap(),
-								value: v
-									.const_data
-									.clone()
-									.into_inner()
-									.try_into()
-									.expect("const too long"),
-							});
-							had_consts.insert(collection);
-						}
-						if !v.variable_data.is_empty() {
-							props.push(Property {
-								key: b"_old_variableData".to_vec().try_into().unwrap(),
-								value: v
-									.variable_data
-									.clone()
-									.into_inner()
-									.try_into()
-									.expect("variable too long"),
-							})
-						}
-						if !props.is_empty() {
-							Self::set_scoped_token_properties(
-								collection,
-								token,
-								PropertyScope::None,
-								props.into_iter(),
-							)
-							.expect("existing token data exceeds property storage");
-						}
-						Some(<ItemDataVersion2<T::CrossAccountId>>::from(v))
-					},
-				);
-				for collection in had_consts {
-					<PalletCommon<T>>::set_property_permission_unchecked(
-						collection,
-						PropertyKeyPermission {
-							key: b"_old_constData".to_vec().try_into().unwrap(),
-							permission: PropertyPermission {
-								mutable: false,
-								collection_admin: true,
-								token_owner: false,
-							},
-						},
-					)
-					.expect("failed to configure permission");
-				}
-			}
+			StorageVersion::new(1).put::<Pallet<T>>();
 
 			0
 		}
modifiedpallets/refungible/src/lib.rsdiffbeforeafterboth
--- a/pallets/refungible/src/lib.rs
+++ b/pallets/refungible/src/lib.rs
@@ -159,11 +159,7 @@
 	#[pallet::hooks]
 	impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
 		fn on_runtime_upgrade() -> Weight {
-			if StorageVersion::get::<Pallet<T>>() < StorageVersion::new(1) {
-				<TokenData<T>>::translate_values::<ItemDataVersion1, _>(|v| {
-					Some(<ItemDataVersion2>::from(v))
-				})
-			}
+			StorageVersion::new(1).put::<Pallet<T>>();
 
 			0
 		}
modifiedruntime/opal/src/lib.rsdiffbeforeafterboth
--- a/runtime/opal/src/lib.rs
+++ b/runtime/opal/src/lib.rs
@@ -192,7 +192,7 @@
 	spec_name: create_runtime_str!(RUNTIME_NAME),
 	impl_name: create_runtime_str!(RUNTIME_NAME),
 	authoring_version: 1,
-	spec_version: 924010,
+	spec_version: 924011,
 	impl_version: 0,
 	apis: RUNTIME_API_VERSIONS,
 	transaction_version: 1,
modifiedruntime/quartz/src/lib.rsdiffbeforeafterboth
--- a/runtime/quartz/src/lib.rs
+++ b/runtime/quartz/src/lib.rs
@@ -191,7 +191,7 @@
 	spec_name: create_runtime_str!(RUNTIME_NAME),
 	impl_name: create_runtime_str!(RUNTIME_NAME),
 	authoring_version: 1,
-	spec_version: 924010,
+	spec_version: 924011,
 	impl_version: 0,
 	apis: RUNTIME_API_VERSIONS,
 	transaction_version: 1,
modifiedruntime/unique/src/lib.rsdiffbeforeafterboth
--- a/runtime/unique/src/lib.rs
+++ b/runtime/unique/src/lib.rs
@@ -190,7 +190,7 @@
 	spec_name: create_runtime_str!(RUNTIME_NAME),
 	impl_name: create_runtime_str!(RUNTIME_NAME),
 	authoring_version: 1,
-	spec_version: 924010,
+	spec_version: 924011,
 	impl_version: 0,
 	apis: RUNTIME_API_VERSIONS,
 	transaction_version: 1,