mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-22 09:11:02 +00:00
Allow to set the max supply for collection (#11441)
* Allow to set the max supply for collection * Update error * Add weights info * cargo run --quiet --profile=production --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark pallet --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 * Update frame/uniques/src/lib.rs Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: Parity Bot <admin@parity.io> Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
This commit is contained in:
@@ -142,6 +142,10 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
|
||||
|
||||
with_details(collection_details)?;
|
||||
|
||||
if let Ok(max_supply) = CollectionMaxSupply::<T, I>::try_get(&collection) {
|
||||
ensure!(collection_details.items < max_supply, Error::<T, I>::MaxSupplyReached);
|
||||
}
|
||||
|
||||
let items =
|
||||
collection_details.items.checked_add(1).ok_or(ArithmeticError::Overflow)?;
|
||||
collection_details.items = items;
|
||||
|
||||
Reference in New Issue
Block a user