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
--- a/pallets/common/src/lib.rs
+++ b/pallets/common/src/lib.rs
@@ -553,65 +553,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) {
-				use up_data_structs::{CollectionVersion1, CollectionVersion2};
-				<CollectionById<T>>::translate::<CollectionVersion1<T::AccountId>, _>(|id, v| {
-					let mut props = Vec::new();
-					if !v.offchain_schema.is_empty() {
-						props.push(Property {
-							key: b"_old_offchainSchema".to_vec().try_into().unwrap(),
-							value: v
-								.offchain_schema
-								.clone()
-								.into_inner()
-								.try_into()
-								.expect("offchain schema too big"),
-						});
-					}
-					if !v.variable_on_chain_schema.is_empty() {
-						props.push(Property {
-							key: b"_old_variableOnChainSchema".to_vec().try_into().unwrap(),
-							value: v
-								.variable_on_chain_schema
-								.clone()
-								.into_inner()
-								.try_into()
-								.expect("offchain schema too big"),
-						});
-					}
-					if !v.const_on_chain_schema.is_empty() {
-						props.push(Property {
-							key: b"_old_constOnChainSchema".to_vec().try_into().unwrap(),
-							value: v
-								.const_on_chain_schema
-								.clone()
-								.into_inner()
-								.try_into()
-								.expect("offchain schema too big"),
-						});
-					}
-					props.push(Property {
-						key: b"_old_schemaVersion".to_vec().try_into().unwrap(),
-						value: match v.schema_version {
-							SchemaVersion::ImageURL => b"ImageUrl".as_slice(),
-							SchemaVersion::Unique => b"Unique".as_slice(),
-						}
-						.to_vec()
-						.try_into()
-						.unwrap(),
-					});
-					Self::set_scoped_collection_properties(
-						id,
-						PropertyScope::None,
-						props.into_iter(),
-					)
-					.expect("existing data larger than properties");
-					let mut new = CollectionVersion2::from(v.clone());
-					new.permissions.access = Some(v.access);
-					new.permissions.mint_mode = Some(v.mint_mode);
-					Some(new)
-				});
-			}
+			StorageVersion::new(1).put::<Pallet<T>>();
 
 			0
 		}
modifiedpallets/nonfungible/src/lib.rsdiffbeforeafterboth
183 #[pallet::hooks]183 #[pallet::hooks]
184 impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {184 impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
185 fn on_runtime_upgrade() -> Weight {185 fn on_runtime_upgrade() -> Weight {
186 if StorageVersion::get::<Pallet<T>>() < StorageVersion::new(1) {186 StorageVersion::new(1).put::<Pallet<T>>();
187 let mut had_consts = BTreeSet::new();
188 <TokenData<T>>::translate::<ItemDataVersion1<T::CrossAccountId>, _>(
189 |(collection, token), v| {
190 let mut props = vec![];
191 if !v.const_data.is_empty() {
192 props.push(Property {
193 key: b"_old_constData".to_vec().try_into().unwrap(),
194 value: v
195 .const_data
196 .clone()
197 .into_inner()
198 .try_into()
199 .expect("const too long"),
200 });
201 had_consts.insert(collection);
202 }
203 if !v.variable_data.is_empty() {
204 props.push(Property {
205 key: b"_old_variableData".to_vec().try_into().unwrap(),
206 value: v
207 .variable_data
208 .clone()
209 .into_inner()
210 .try_into()
211 .expect("variable too long"),
212 })
213 }
214 if !props.is_empty() {
215 Self::set_scoped_token_properties(
216 collection,
217 token,
218 PropertyScope::None,
219 props.into_iter(),
220 )
221 .expect("existing token data exceeds property storage");
222 }
223 Some(<ItemDataVersion2<T::CrossAccountId>>::from(v))
224 },
225 );
226 for collection in had_consts {
227 <PalletCommon<T>>::set_property_permission_unchecked(
228 collection,
229 PropertyKeyPermission {
230 key: b"_old_constData".to_vec().try_into().unwrap(),
231 permission: PropertyPermission {
232 mutable: false,
233 collection_admin: true,
234 token_owner: false,
235 },
236 },
237 )
238 .expect("failed to configure permission");
239 }
240 }
241187
242 0188 0
243 }189 }
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,