From 5e5dd9227b0d86306c9fe6d86133e10bcbb03c7c Mon Sep 17 00:00:00 2001 From: Yaroslav Bolyukin Date: Fri, 08 Jul 2022 07:10:00 +0000 Subject: [PATCH] feat: force version upgrade --- --- a/pallets/nonfungible/src/lib.rs +++ b/pallets/nonfungible/src/lib.rs @@ -183,61 +183,7 @@ #[pallet::hooks] impl Hooks> for Pallet { fn on_runtime_upgrade() -> Weight { - if StorageVersion::get::>() < StorageVersion::new(1) { - let mut had_consts = BTreeSet::new(); - >::translate::, _>( - |(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(>::from(v)) - }, - ); - for collection in had_consts { - >::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::>(); 0 } -- gitstuff