Add ClassAccount storage to unique pallet (#9940)

* add ClassAccount to uniques storage

* add tests for Class and ClassAccount storage

* fix format

* fix description

* add migration

* remove extra iteration

* Update frame/uniques/src/migration.rs

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* cargo run --quiet --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_uniques --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/uniques/src/weights.rs --template=./.maintain/frame-weight-template.hbs

* fix format

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: Parity Bot <admin@parity.io>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
hamidra
2021-12-18 07:41:05 -08:00
committed by GitHub
parent 8fa5c7608a
commit 94056a4da7
7 changed files with 179 additions and 68 deletions
+2
View File
@@ -81,6 +81,7 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
},
);
ClassAccount::<T, I>::insert(&owner, &class, ());
Self::deposit_event(event);
Ok(())
}
@@ -108,6 +109,7 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
InstanceMetadataOf::<T, I>::remove_prefix(&class, None);
ClassMetadataOf::<T, I>::remove(&class);
Attribute::<T, I>::remove_prefix((&class,), None);
ClassAccount::<T, I>::remove(&class_details.owner, &class);
T::Currency::unreserve(&class_details.owner, class_details.total_deposit);
Self::deposit_event(Event::Destroyed { class });