difftreelog
Merge pull request #421 from UniqueNetwork/release-v924011
in: master
Release v924011
6 files changed
pallets/common/src/lib.rsdiffbeforeafterboth553 #[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: v564 .offchain_schema565 .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: v575 .variable_on_chain_schema576 .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: v586 .const_on_chain_schema587 .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 }615557616 0558 0617 }559 }pallets/nonfungible/src/lib.rsdiffbeforeafterboth183 #[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: v195 .const_data196 .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: v207 .variable_data208 .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 }241187242 0188 0243 }189 }pallets/refungible/src/lib.rsdiffbeforeafterboth159 #[pallet::hooks]159 #[pallet::hooks]160 impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {160 impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {161 fn on_runtime_upgrade() -> Weight {161 fn on_runtime_upgrade() -> Weight {162 if StorageVersion::get::<Pallet<T>>() < StorageVersion::new(1) {162 StorageVersion::new(1).put::<Pallet<T>>();163 <TokenData<T>>::translate_values::<ItemDataVersion1, _>(|v| {164 Some(<ItemDataVersion2>::from(v))165 })166 }167163168 0164 0169 }165 }runtime/opal/src/lib.rsdiffbeforeafterboth192 spec_name: create_runtime_str!(RUNTIME_NAME),192 spec_name: create_runtime_str!(RUNTIME_NAME),193 impl_name: create_runtime_str!(RUNTIME_NAME),193 impl_name: create_runtime_str!(RUNTIME_NAME),194 authoring_version: 1,194 authoring_version: 1,195 spec_version: 924010,195 spec_version: 924011,196 impl_version: 0,196 impl_version: 0,197 apis: RUNTIME_API_VERSIONS,197 apis: RUNTIME_API_VERSIONS,198 transaction_version: 1,198 transaction_version: 1,runtime/quartz/src/lib.rsdiffbeforeafterboth191 spec_name: create_runtime_str!(RUNTIME_NAME),191 spec_name: create_runtime_str!(RUNTIME_NAME),192 impl_name: create_runtime_str!(RUNTIME_NAME),192 impl_name: create_runtime_str!(RUNTIME_NAME),193 authoring_version: 1,193 authoring_version: 1,194 spec_version: 924010,194 spec_version: 924011,195 impl_version: 0,195 impl_version: 0,196 apis: RUNTIME_API_VERSIONS,196 apis: RUNTIME_API_VERSIONS,197 transaction_version: 1,197 transaction_version: 1,runtime/unique/src/lib.rsdiffbeforeafterboth190 spec_name: create_runtime_str!(RUNTIME_NAME),190 spec_name: create_runtime_str!(RUNTIME_NAME),191 impl_name: create_runtime_str!(RUNTIME_NAME),191 impl_name: create_runtime_str!(RUNTIME_NAME),192 authoring_version: 1,192 authoring_version: 1,193 spec_version: 924010,193 spec_version: 924011,194 impl_version: 0,194 impl_version: 0,195 apis: RUNTIME_API_VERSIONS,195 apis: RUNTIME_API_VERSIONS,196 transaction_version: 1,196 transaction_version: 1,