mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-22 10:21:04 +00:00
Auto-incremental CollectionId (#11796)
* autoincrementing CollectionId * fix * benchmarking fix * fmt * fix * update before checking * fmt * fix * fmt * commit * tests & fix * fix * commit * docs * safe math * unexpose function * benchmark * fmt * better naming * fix? * merge fixes * fmt * ".git/.scripts/bench-bot.sh" pallet dev pallet_uniques * wrong weight * Update frame/uniques/src/lib.rs Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Update frame/uniques/src/lib.rs Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * using substrate trait instead of num-traits * remove unnecessary trait * emit NextCollectionIdIncremented in do_create_collection * fix in benchmarks * check for event & group import * docs Co-authored-by: Sergej Sakač <sergejsakac@Sergejs-MacBook-Air.local> Co-authored-by: command-bot <> Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
This commit is contained in:
@@ -88,7 +88,12 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
|
||||
},
|
||||
);
|
||||
|
||||
let next_id = collection.saturating_add(1u32.into());
|
||||
|
||||
CollectionAccount::<T, I>::insert(&owner, &collection, ());
|
||||
NextCollectionId::<T, I>::set(next_id);
|
||||
|
||||
Self::deposit_event(Event::NextCollectionIdIncremented { next_id });
|
||||
Self::deposit_event(event);
|
||||
Ok(())
|
||||
}
|
||||
@@ -208,6 +213,16 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(any(test, feature = "runtime-benchmarks"))]
|
||||
pub fn set_next_id(count: u32) {
|
||||
NextCollectionId::<T, I>::set(count.into());
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub fn get_next_id() -> T::CollectionId {
|
||||
NextCollectionId::<T, I>::get()
|
||||
}
|
||||
|
||||
pub fn do_set_price(
|
||||
collection: T::CollectionId,
|
||||
item: T::ItemId,
|
||||
|
||||
Reference in New Issue
Block a user