difftreelog
Add extrinsic: delete collection property
in: master
10 files changed
pallets/common/src/lib.rsdiffbeforeafterboth--- a/pallets/common/src/lib.rs
+++ b/pallets/common/src/lib.rs
@@ -292,6 +292,8 @@
CollectionPropertySet(CollectionId, Property),
+ CollectionPropertyDeleted(CollectionId, PropertyKey),
+
TokenPropertySet(CollectionId, TokenId, Property),
TokenPropertyDeleted(CollectionId, TokenId, PropertyKey),
@@ -761,6 +763,34 @@
Ok(())
}
+ pub fn delete_collection_property(
+ collection: &CollectionHandle<T>,
+ sender: &T::CrossAccountId,
+ property_key: PropertyKey,
+ ) -> DispatchResult {
+ collection.check_is_owner_or_admin(sender)?;
+
+ CollectionProperties::<T>::mutate(collection.id, |properties| {
+ properties.remove_property(&property_key);
+ });
+
+ Self::deposit_event(Event::CollectionPropertyDeleted(collection.id, property_key));
+
+ Ok(())
+ }
+
+ pub fn delete_collection_properties(
+ collection: &CollectionHandle<T>,
+ sender: &T::CrossAccountId,
+ property_keys: Vec<PropertyKey>,
+ ) -> DispatchResult {
+ for key in property_keys {
+ Self::delete_collection_property(collection, sender, key)?;
+ }
+
+ Ok(())
+ }
+
pub fn set_property_permission(
collection: &CollectionHandle<T>,
sender: &T::CrossAccountId,
@@ -956,6 +986,7 @@
fn create_multiple_items_ex(cost: &CreateItemExData<CrossAccountId>) -> Weight;
fn burn_item() -> Weight;
fn set_collection_properties(amount: u32) -> Weight;
+ fn delete_collection_properties(amount: u32) -> Weight;
fn set_token_properties(amount: u32) -> Weight;
fn delete_token_properties(amount: u32) -> Weight;
fn set_property_permissions(amount: u32) -> Weight;
@@ -998,6 +1029,11 @@
sender: T::CrossAccountId,
properties: Vec<Property>,
) -> DispatchResultWithPostInfo;
+ fn delete_collection_properties(
+ &self,
+ sender: &T::CrossAccountId,
+ property_keys: Vec<PropertyKey>,
+ ) -> DispatchResultWithPostInfo;
fn set_token_properties(
&self,
sender: T::CrossAccountId,
pallets/fungible/src/common.rsdiffbeforeafterboth--- a/pallets/fungible/src/common.rs
+++ b/pallets/fungible/src/common.rs
@@ -54,6 +54,10 @@
<SelfWeightOf<T>>::set_collection_properties(amount)
}
+ fn delete_collection_properties(amount: u32) -> Weight {
+ <SelfWeightOf<T>>::delete_collection_properties(amount)
+ }
+
fn set_token_properties(amount: u32) -> Weight {
<SelfWeightOf<T>>::set_token_properties(amount)
}
@@ -249,6 +253,14 @@
fail!(<Error<T>>::PropertiesNotAllowed)
}
+ fn delete_collection_properties(
+ &self,
+ _sender: &T::CrossAccountId,
+ _property_keys: Vec<PropertyKey>,
+ ) -> DispatchResultWithPostInfo {
+ fail!(<Error<T>>::PropertiesNotAllowed)
+ }
+
fn set_token_properties(
&self,
_sender: T::CrossAccountId,
pallets/fungible/src/weights.rsdiffbeforeafterboth--- a/pallets/fungible/src/weights.rs
+++ b/pallets/fungible/src/weights.rs
@@ -36,6 +36,7 @@
fn create_multiple_items_ex(b: u32, ) -> Weight;
fn burn_item() -> Weight;
fn set_collection_properties(amount: u32) -> Weight;
+ fn delete_collection_properties(amount: u32) -> Weight;
fn set_token_properties(amount: u32) -> Weight;
fn delete_token_properties(amount: u32) -> Weight;
fn set_property_permissions(amount: u32) -> Weight;
@@ -79,6 +80,11 @@
0
}
+ fn delete_collection_properties(_amount: u32) -> Weight {
+ // Error
+ 0
+ }
+
fn set_token_properties(_amount: u32) -> Weight {
// Error
0
@@ -157,6 +163,11 @@
0
}
+ fn delete_collection_properties(_amount: u32) -> Weight {
+ // Error
+ 0
+ }
+
fn set_token_properties(_amount: u32) -> Weight {
// Error
0
pallets/nonfungible/src/common.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/common.rs
+++ b/pallets/nonfungible/src/common.rs
@@ -55,6 +55,10 @@
<SelfWeightOf<T>>::set_collection_properties(amount)
}
+ fn delete_collection_properties(amount: u32) -> Weight {
+ <SelfWeightOf<T>>::delete_collection_properties(amount)
+ }
+
fn set_token_properties(amount: u32) -> Weight {
<SelfWeightOf<T>>::set_token_properties(amount)
}
@@ -171,6 +175,19 @@
)
}
+ fn delete_collection_properties(
+ &self,
+ sender: &T::CrossAccountId,
+ property_keys: Vec<PropertyKey>,
+ ) -> DispatchResultWithPostInfo {
+ let weight = <CommonWeights<T>>::delete_collection_properties(property_keys.len() as u32);
+
+ with_weight(
+ <Pallet<T>>::delete_collection_properties(self, &sender, property_keys),
+ weight
+ )
+ }
+
fn set_token_properties(
&self,
sender: T::CrossAccountId,
pallets/nonfungible/src/lib.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/lib.rs
+++ b/pallets/nonfungible/src/lib.rs
@@ -366,6 +366,14 @@
<PalletCommon<T>>::set_collection_properties(collection, sender, properties)
}
+ pub fn delete_collection_properties(
+ collection: &CollectionHandle<T>,
+ sender: &T::CrossAccountId,
+ property_keys: Vec<PropertyKey>,
+ ) -> DispatchResult {
+ <PalletCommon<T>>::delete_collection_properties(collection, sender, property_keys)
+ }
+
pub fn set_property_permissions(
collection: &CollectionHandle<T>,
sender: &T::CrossAccountId,
pallets/nonfungible/src/weights.rsdiffbeforeafterboth1// Template adopted from https://github.com/paritytech/substrate/blob/master/.maintain/frame-weight-template.hbs23//! Autogenerated weights for pallet_nonfungible4//!5//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev6//! DATE: 2022-03-01, STEPS: `50`, REPEAT: 200, LOW RANGE: `[]`, HIGH RANGE: `[]`7//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 102489// Executed Command:10// target/release/unique-collator11// benchmark12// --pallet13// pallet-nonfungible14// --wasm-execution15// compiled16// --extrinsic17// *18// --template19// .maintain/frame-weight-template.hbs20// --steps=5021// --repeat=20022// --heap-pages=409623// --output=./pallets/nonfungible/src/weights.rs2425#![cfg_attr(rustfmt, rustfmt_skip)]26#![allow(unused_parens)]27#![allow(unused_imports)]28#![allow(clippy::unnecessary_cast)]2930use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};31use sp_std::marker::PhantomData;3233/// Weight functions needed for pallet_nonfungible.34pub trait WeightInfo {35 fn create_item() -> Weight;36 fn create_multiple_items(b: u32, ) -> Weight;37 fn create_multiple_items_ex(b: u32, ) -> Weight;38 fn burn_item() -> Weight;39 fn set_collection_properties(amount: u32) -> Weight;40 fn set_token_properties(amount: u32) -> Weight;41 fn delete_token_properties(amount: u32) -> Weight;42 fn set_property_permissions(amount: u32) -> Weight;43 fn transfer() -> Weight;44 fn approve() -> Weight;45 fn transfer_from() -> Weight;46 fn burn_from() -> Weight;47 fn set_variable_metadata(b: u32, ) -> Weight;48}4950/// Weights for pallet_nonfungible using the Substrate node and recommended hardware.51pub struct SubstrateWeight<T>(PhantomData<T>);52impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {53 // Storage: Nonfungible TokensMinted (r:1 w:1)54 // Storage: Nonfungible AccountBalance (r:1 w:1)55 // Storage: Nonfungible TokenData (r:0 w:1)56 // Storage: Nonfungible Owned (r:0 w:1)57 fn create_item() -> Weight {58 (18_450_000 as Weight)59 .saturating_add(T::DbWeight::get().reads(2 as Weight))60 .saturating_add(T::DbWeight::get().writes(4 as Weight))61 }62 // Storage: Nonfungible TokensMinted (r:1 w:1)63 // Storage: Nonfungible AccountBalance (r:1 w:1)64 // Storage: Nonfungible TokenData (r:0 w:4)65 // Storage: Nonfungible Owned (r:0 w:4)66 fn create_multiple_items(b: u32, ) -> Weight {67 (10_228_000 as Weight)68 // Standard Error: 1_00069 .saturating_add((4_392_000 as Weight).saturating_mul(b as Weight))70 .saturating_add(T::DbWeight::get().reads(2 as Weight))71 .saturating_add(T::DbWeight::get().writes(2 as Weight))72 .saturating_add(T::DbWeight::get().writes((2 as Weight).saturating_mul(b as Weight)))73 }74 // Storage: Nonfungible TokensMinted (r:1 w:1)75 // Storage: Nonfungible AccountBalance (r:4 w:4)76 // Storage: Nonfungible TokenData (r:0 w:4)77 // Storage: Nonfungible Owned (r:0 w:4)78 fn create_multiple_items_ex(b: u32, ) -> Weight {79 (6_543_000 as Weight)80 // Standard Error: 2_00081 .saturating_add((7_175_000 as Weight).saturating_mul(b as Weight))82 .saturating_add(T::DbWeight::get().reads(1 as Weight))83 .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))84 .saturating_add(T::DbWeight::get().writes(1 as Weight))85 .saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(b as Weight)))86 }87 // Storage: Nonfungible TokenData (r:1 w:1)88 // Storage: Nonfungible TokensBurnt (r:1 w:1)89 // Storage: Nonfungible AccountBalance (r:1 w:1)90 // Storage: Nonfungible Allowance (r:1 w:0)91 // Storage: Nonfungible Owned (r:0 w:1)92 fn burn_item() -> Weight {93 (24_554_000 as Weight)94 .saturating_add(T::DbWeight::get().reads(4 as Weight))95 .saturating_add(T::DbWeight::get().writes(4 as Weight))96 }9798 fn set_collection_properties(amount: u32) -> Weight {99 // TODO calculate appropriate weight100 (50_000_000 as Weight).saturating_mul(amount as Weight)101 }102103 fn set_token_properties(amount: u32) -> Weight {104 // TODO calculate appropriate weight105 (50_000_000 as Weight).saturating_mul(amount as Weight)106 }107108 fn delete_token_properties(amount: u32) -> Weight {109 // TODO calculate appropriate weight110 (50_000_000 as Weight).saturating_mul(amount as Weight)111 }112113 fn set_property_permissions(amount: u32) -> Weight {114 // TODO calculate appropriate weight115 (50_000_000 as Weight).saturating_mul(amount as Weight)116 }117118 // Storage: Nonfungible TokenData (r:1 w:1)119 // Storage: Nonfungible AccountBalance (r:2 w:2)120 // Storage: Nonfungible Allowance (r:1 w:0)121 // Storage: Nonfungible Owned (r:0 w:2)122 fn transfer() -> Weight {123 (28_339_000 as Weight)124 .saturating_add(T::DbWeight::get().reads(4 as Weight))125 .saturating_add(T::DbWeight::get().writes(5 as Weight))126 }127 // Storage: Nonfungible TokenData (r:1 w:0)128 // Storage: Nonfungible Allowance (r:1 w:1)129 fn approve() -> Weight {130 (17_616_000 as Weight)131 .saturating_add(T::DbWeight::get().reads(2 as Weight))132 .saturating_add(T::DbWeight::get().writes(1 as Weight))133 }134 // Storage: Nonfungible Allowance (r:1 w:1)135 // Storage: Nonfungible TokenData (r:1 w:1)136 // Storage: Nonfungible AccountBalance (r:2 w:2)137 // Storage: Nonfungible Owned (r:0 w:2)138 fn transfer_from() -> Weight {139 (32_196_000 as Weight)140 .saturating_add(T::DbWeight::get().reads(4 as Weight))141 .saturating_add(T::DbWeight::get().writes(6 as Weight))142 }143 // Storage: Nonfungible Allowance (r:1 w:1)144 // Storage: Nonfungible TokenData (r:1 w:1)145 // Storage: Nonfungible TokensBurnt (r:1 w:1)146 // Storage: Nonfungible AccountBalance (r:1 w:1)147 // Storage: Nonfungible Owned (r:0 w:1)148 fn burn_from() -> Weight {149 (27_580_000 as Weight)150 .saturating_add(T::DbWeight::get().reads(4 as Weight))151 .saturating_add(T::DbWeight::get().writes(5 as Weight))152 }153 // Storage: Nonfungible TokenData (r:1 w:1)154 fn set_variable_metadata(_b: u32, ) -> Weight {155 (7_700_000 as Weight)156 .saturating_add(T::DbWeight::get().reads(1 as Weight))157 .saturating_add(T::DbWeight::get().writes(1 as Weight))158 }159}160161// For backwards compatibility and tests162impl WeightInfo for () {163 // Storage: Nonfungible TokensMinted (r:1 w:1)164 // Storage: Nonfungible AccountBalance (r:1 w:1)165 // Storage: Nonfungible TokenData (r:0 w:1)166 // Storage: Nonfungible Owned (r:0 w:1)167 fn create_item() -> Weight {168 (18_450_000 as Weight)169 .saturating_add(RocksDbWeight::get().reads(2 as Weight))170 .saturating_add(RocksDbWeight::get().writes(4 as Weight))171 }172 // Storage: Nonfungible TokensMinted (r:1 w:1)173 // Storage: Nonfungible AccountBalance (r:1 w:1)174 // Storage: Nonfungible TokenData (r:0 w:4)175 // Storage: Nonfungible Owned (r:0 w:4)176 fn create_multiple_items(b: u32, ) -> Weight {177 (10_228_000 as Weight)178 // Standard Error: 1_000179 .saturating_add((4_392_000 as Weight).saturating_mul(b as Weight))180 .saturating_add(RocksDbWeight::get().reads(2 as Weight))181 .saturating_add(RocksDbWeight::get().writes(2 as Weight))182 .saturating_add(RocksDbWeight::get().writes((2 as Weight).saturating_mul(b as Weight)))183 }184 // Storage: Nonfungible TokensMinted (r:1 w:1)185 // Storage: Nonfungible AccountBalance (r:4 w:4)186 // Storage: Nonfungible TokenData (r:0 w:4)187 // Storage: Nonfungible Owned (r:0 w:4)188 fn create_multiple_items_ex(b: u32, ) -> Weight {189 (6_543_000 as Weight)190 // Standard Error: 2_000191 .saturating_add((7_175_000 as Weight).saturating_mul(b as Weight))192 .saturating_add(RocksDbWeight::get().reads(1 as Weight))193 .saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))194 .saturating_add(RocksDbWeight::get().writes(1 as Weight))195 .saturating_add(RocksDbWeight::get().writes((3 as Weight).saturating_mul(b as Weight)))196 }197 // Storage: Nonfungible TokenData (r:1 w:1)198 // Storage: Nonfungible TokensBurnt (r:1 w:1)199 // Storage: Nonfungible AccountBalance (r:1 w:1)200 // Storage: Nonfungible Allowance (r:1 w:0)201 // Storage: Nonfungible Owned (r:0 w:1)202 fn burn_item() -> Weight {203 (24_554_000 as Weight)204 .saturating_add(RocksDbWeight::get().reads(4 as Weight))205 .saturating_add(RocksDbWeight::get().writes(4 as Weight))206 }207208 fn set_collection_properties(amount: u32) -> Weight {209 // TODO calculate appropriate weight210 (50_000_000 as Weight).saturating_mul(amount as Weight)211 }212213 fn set_token_properties(amount: u32) -> Weight {214 // TODO calculate appropriate weight215 (50_000_000 as Weight).saturating_mul(amount as Weight)216 }217218 fn delete_token_properties(amount: u32) -> Weight {219 // TODO calculate appropriate weight220 (50_000_000 as Weight).saturating_mul(amount as Weight)221 }222223 fn set_property_permissions(amount: u32) -> Weight {224 // TODO calculate appropriate weight225 (50_000_000 as Weight).saturating_mul(amount as Weight)226 }227228 // Storage: Nonfungible TokenData (r:1 w:1)229 // Storage: Nonfungible AccountBalance (r:2 w:2)230 // Storage: Nonfungible Allowance (r:1 w:0)231 // Storage: Nonfungible Owned (r:0 w:2)232 fn transfer() -> Weight {233 (28_339_000 as Weight)234 .saturating_add(RocksDbWeight::get().reads(4 as Weight))235 .saturating_add(RocksDbWeight::get().writes(5 as Weight))236 }237 // Storage: Nonfungible TokenData (r:1 w:0)238 // Storage: Nonfungible Allowance (r:1 w:1)239 fn approve() -> Weight {240 (17_616_000 as Weight)241 .saturating_add(RocksDbWeight::get().reads(2 as Weight))242 .saturating_add(RocksDbWeight::get().writes(1 as Weight))243 }244 // Storage: Nonfungible Allowance (r:1 w:1)245 // Storage: Nonfungible TokenData (r:1 w:1)246 // Storage: Nonfungible AccountBalance (r:2 w:2)247 // Storage: Nonfungible Owned (r:0 w:2)248 fn transfer_from() -> Weight {249 (32_196_000 as Weight)250 .saturating_add(RocksDbWeight::get().reads(4 as Weight))251 .saturating_add(RocksDbWeight::get().writes(6 as Weight))252 }253 // Storage: Nonfungible Allowance (r:1 w:1)254 // Storage: Nonfungible TokenData (r:1 w:1)255 // Storage: Nonfungible TokensBurnt (r:1 w:1)256 // Storage: Nonfungible AccountBalance (r:1 w:1)257 // Storage: Nonfungible Owned (r:0 w:1)258 fn burn_from() -> Weight {259 (27_580_000 as Weight)260 .saturating_add(RocksDbWeight::get().reads(4 as Weight))261 .saturating_add(RocksDbWeight::get().writes(5 as Weight))262 }263 // Storage: Nonfungible TokenData (r:1 w:1)264 fn set_variable_metadata(_b: u32, ) -> Weight {265 (7_700_000 as Weight)266 .saturating_add(RocksDbWeight::get().reads(1 as Weight))267 .saturating_add(RocksDbWeight::get().writes(1 as Weight))268 }269}1// Template adopted from https://github.com/paritytech/substrate/blob/master/.maintain/frame-weight-template.hbs23//! Autogenerated weights for pallet_nonfungible4//!5//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev6//! DATE: 2022-03-01, STEPS: `50`, REPEAT: 200, LOW RANGE: `[]`, HIGH RANGE: `[]`7//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 102489// Executed Command:10// target/release/unique-collator11// benchmark12// --pallet13// pallet-nonfungible14// --wasm-execution15// compiled16// --extrinsic17// *18// --template19// .maintain/frame-weight-template.hbs20// --steps=5021// --repeat=20022// --heap-pages=409623// --output=./pallets/nonfungible/src/weights.rs2425#![cfg_attr(rustfmt, rustfmt_skip)]26#![allow(unused_parens)]27#![allow(unused_imports)]28#![allow(clippy::unnecessary_cast)]2930use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};31use sp_std::marker::PhantomData;3233/// Weight functions needed for pallet_nonfungible.34pub trait WeightInfo {35 fn create_item() -> Weight;36 fn create_multiple_items(b: u32, ) -> Weight;37 fn create_multiple_items_ex(b: u32, ) -> Weight;38 fn burn_item() -> Weight;39 fn set_collection_properties(amount: u32) -> Weight;40 fn delete_collection_properties(amount: u32) -> Weight;41 fn set_token_properties(amount: u32) -> Weight;42 fn delete_token_properties(amount: u32) -> Weight;43 fn set_property_permissions(amount: u32) -> Weight;44 fn transfer() -> Weight;45 fn approve() -> Weight;46 fn transfer_from() -> Weight;47 fn burn_from() -> Weight;48 fn set_variable_metadata(b: u32, ) -> Weight;49}5051/// Weights for pallet_nonfungible using the Substrate node and recommended hardware.52pub struct SubstrateWeight<T>(PhantomData<T>);53impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {54 // Storage: Nonfungible TokensMinted (r:1 w:1)55 // Storage: Nonfungible AccountBalance (r:1 w:1)56 // Storage: Nonfungible TokenData (r:0 w:1)57 // Storage: Nonfungible Owned (r:0 w:1)58 fn create_item() -> Weight {59 (18_450_000 as Weight)60 .saturating_add(T::DbWeight::get().reads(2 as Weight))61 .saturating_add(T::DbWeight::get().writes(4 as Weight))62 }63 // Storage: Nonfungible TokensMinted (r:1 w:1)64 // Storage: Nonfungible AccountBalance (r:1 w:1)65 // Storage: Nonfungible TokenData (r:0 w:4)66 // Storage: Nonfungible Owned (r:0 w:4)67 fn create_multiple_items(b: u32, ) -> Weight {68 (10_228_000 as Weight)69 // Standard Error: 1_00070 .saturating_add((4_392_000 as Weight).saturating_mul(b as Weight))71 .saturating_add(T::DbWeight::get().reads(2 as Weight))72 .saturating_add(T::DbWeight::get().writes(2 as Weight))73 .saturating_add(T::DbWeight::get().writes((2 as Weight).saturating_mul(b as Weight)))74 }75 // Storage: Nonfungible TokensMinted (r:1 w:1)76 // Storage: Nonfungible AccountBalance (r:4 w:4)77 // Storage: Nonfungible TokenData (r:0 w:4)78 // Storage: Nonfungible Owned (r:0 w:4)79 fn create_multiple_items_ex(b: u32, ) -> Weight {80 (6_543_000 as Weight)81 // Standard Error: 2_00082 .saturating_add((7_175_000 as Weight).saturating_mul(b as Weight))83 .saturating_add(T::DbWeight::get().reads(1 as Weight))84 .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))85 .saturating_add(T::DbWeight::get().writes(1 as Weight))86 .saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(b as Weight)))87 }88 // Storage: Nonfungible TokenData (r:1 w:1)89 // Storage: Nonfungible TokensBurnt (r:1 w:1)90 // Storage: Nonfungible AccountBalance (r:1 w:1)91 // Storage: Nonfungible Allowance (r:1 w:0)92 // Storage: Nonfungible Owned (r:0 w:1)93 fn burn_item() -> Weight {94 (24_554_000 as Weight)95 .saturating_add(T::DbWeight::get().reads(4 as Weight))96 .saturating_add(T::DbWeight::get().writes(4 as Weight))97 }9899 fn set_collection_properties(amount: u32) -> Weight {100 // TODO calculate appropriate weight101 (50_000_000 as Weight).saturating_mul(amount as Weight)102 }103104 fn delete_collection_properties(amount: u32) -> Weight {105 // TODO calculate appropriate weight106 (50_000_000 as Weight).saturating_mul(amount as Weight)107 }108109 fn set_token_properties(amount: u32) -> Weight {110 // TODO calculate appropriate weight111 (50_000_000 as Weight).saturating_mul(amount as Weight)112 }113114 fn delete_token_properties(amount: u32) -> Weight {115 // TODO calculate appropriate weight116 (50_000_000 as Weight).saturating_mul(amount as Weight)117 }118119 fn set_property_permissions(amount: u32) -> Weight {120 // TODO calculate appropriate weight121 (50_000_000 as Weight).saturating_mul(amount as Weight)122 }123124 // Storage: Nonfungible TokenData (r:1 w:1)125 // Storage: Nonfungible AccountBalance (r:2 w:2)126 // Storage: Nonfungible Allowance (r:1 w:0)127 // Storage: Nonfungible Owned (r:0 w:2)128 fn transfer() -> Weight {129 (28_339_000 as Weight)130 .saturating_add(T::DbWeight::get().reads(4 as Weight))131 .saturating_add(T::DbWeight::get().writes(5 as Weight))132 }133 // Storage: Nonfungible TokenData (r:1 w:0)134 // Storage: Nonfungible Allowance (r:1 w:1)135 fn approve() -> Weight {136 (17_616_000 as Weight)137 .saturating_add(T::DbWeight::get().reads(2 as Weight))138 .saturating_add(T::DbWeight::get().writes(1 as Weight))139 }140 // Storage: Nonfungible Allowance (r:1 w:1)141 // Storage: Nonfungible TokenData (r:1 w:1)142 // Storage: Nonfungible AccountBalance (r:2 w:2)143 // Storage: Nonfungible Owned (r:0 w:2)144 fn transfer_from() -> Weight {145 (32_196_000 as Weight)146 .saturating_add(T::DbWeight::get().reads(4 as Weight))147 .saturating_add(T::DbWeight::get().writes(6 as Weight))148 }149 // Storage: Nonfungible Allowance (r:1 w:1)150 // Storage: Nonfungible TokenData (r:1 w:1)151 // Storage: Nonfungible TokensBurnt (r:1 w:1)152 // Storage: Nonfungible AccountBalance (r:1 w:1)153 // Storage: Nonfungible Owned (r:0 w:1)154 fn burn_from() -> Weight {155 (27_580_000 as Weight)156 .saturating_add(T::DbWeight::get().reads(4 as Weight))157 .saturating_add(T::DbWeight::get().writes(5 as Weight))158 }159 // Storage: Nonfungible TokenData (r:1 w:1)160 fn set_variable_metadata(_b: u32, ) -> Weight {161 (7_700_000 as Weight)162 .saturating_add(T::DbWeight::get().reads(1 as Weight))163 .saturating_add(T::DbWeight::get().writes(1 as Weight))164 }165}166167// For backwards compatibility and tests168impl WeightInfo for () {169 // Storage: Nonfungible TokensMinted (r:1 w:1)170 // Storage: Nonfungible AccountBalance (r:1 w:1)171 // Storage: Nonfungible TokenData (r:0 w:1)172 // Storage: Nonfungible Owned (r:0 w:1)173 fn create_item() -> Weight {174 (18_450_000 as Weight)175 .saturating_add(RocksDbWeight::get().reads(2 as Weight))176 .saturating_add(RocksDbWeight::get().writes(4 as Weight))177 }178 // Storage: Nonfungible TokensMinted (r:1 w:1)179 // Storage: Nonfungible AccountBalance (r:1 w:1)180 // Storage: Nonfungible TokenData (r:0 w:4)181 // Storage: Nonfungible Owned (r:0 w:4)182 fn create_multiple_items(b: u32, ) -> Weight {183 (10_228_000 as Weight)184 // Standard Error: 1_000185 .saturating_add((4_392_000 as Weight).saturating_mul(b as Weight))186 .saturating_add(RocksDbWeight::get().reads(2 as Weight))187 .saturating_add(RocksDbWeight::get().writes(2 as Weight))188 .saturating_add(RocksDbWeight::get().writes((2 as Weight).saturating_mul(b as Weight)))189 }190 // Storage: Nonfungible TokensMinted (r:1 w:1)191 // Storage: Nonfungible AccountBalance (r:4 w:4)192 // Storage: Nonfungible TokenData (r:0 w:4)193 // Storage: Nonfungible Owned (r:0 w:4)194 fn create_multiple_items_ex(b: u32, ) -> Weight {195 (6_543_000 as Weight)196 // Standard Error: 2_000197 .saturating_add((7_175_000 as Weight).saturating_mul(b as Weight))198 .saturating_add(RocksDbWeight::get().reads(1 as Weight))199 .saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))200 .saturating_add(RocksDbWeight::get().writes(1 as Weight))201 .saturating_add(RocksDbWeight::get().writes((3 as Weight).saturating_mul(b as Weight)))202 }203 // Storage: Nonfungible TokenData (r:1 w:1)204 // Storage: Nonfungible TokensBurnt (r:1 w:1)205 // Storage: Nonfungible AccountBalance (r:1 w:1)206 // Storage: Nonfungible Allowance (r:1 w:0)207 // Storage: Nonfungible Owned (r:0 w:1)208 fn burn_item() -> Weight {209 (24_554_000 as Weight)210 .saturating_add(RocksDbWeight::get().reads(4 as Weight))211 .saturating_add(RocksDbWeight::get().writes(4 as Weight))212 }213214 fn set_collection_properties(amount: u32) -> Weight {215 // TODO calculate appropriate weight216 (50_000_000 as Weight).saturating_mul(amount as Weight)217 }218219 fn delete_collection_properties(amount: u32) -> Weight {220 // TODO calculate appropriate weight221 (50_000_000 as Weight).saturating_mul(amount as Weight)222 }223224 fn set_token_properties(amount: u32) -> Weight {225 // TODO calculate appropriate weight226 (50_000_000 as Weight).saturating_mul(amount as Weight)227 }228229 fn delete_token_properties(amount: u32) -> Weight {230 // TODO calculate appropriate weight231 (50_000_000 as Weight).saturating_mul(amount as Weight)232 }233234 fn set_property_permissions(amount: u32) -> Weight {235 // TODO calculate appropriate weight236 (50_000_000 as Weight).saturating_mul(amount as Weight)237 }238239 // Storage: Nonfungible TokenData (r:1 w:1)240 // Storage: Nonfungible AccountBalance (r:2 w:2)241 // Storage: Nonfungible Allowance (r:1 w:0)242 // Storage: Nonfungible Owned (r:0 w:2)243 fn transfer() -> Weight {244 (28_339_000 as Weight)245 .saturating_add(RocksDbWeight::get().reads(4 as Weight))246 .saturating_add(RocksDbWeight::get().writes(5 as Weight))247 }248 // Storage: Nonfungible TokenData (r:1 w:0)249 // Storage: Nonfungible Allowance (r:1 w:1)250 fn approve() -> Weight {251 (17_616_000 as Weight)252 .saturating_add(RocksDbWeight::get().reads(2 as Weight))253 .saturating_add(RocksDbWeight::get().writes(1 as Weight))254 }255 // Storage: Nonfungible Allowance (r:1 w:1)256 // Storage: Nonfungible TokenData (r:1 w:1)257 // Storage: Nonfungible AccountBalance (r:2 w:2)258 // Storage: Nonfungible Owned (r:0 w:2)259 fn transfer_from() -> Weight {260 (32_196_000 as Weight)261 .saturating_add(RocksDbWeight::get().reads(4 as Weight))262 .saturating_add(RocksDbWeight::get().writes(6 as Weight))263 }264 // Storage: Nonfungible Allowance (r:1 w:1)265 // Storage: Nonfungible TokenData (r:1 w:1)266 // Storage: Nonfungible TokensBurnt (r:1 w:1)267 // Storage: Nonfungible AccountBalance (r:1 w:1)268 // Storage: Nonfungible Owned (r:0 w:1)269 fn burn_from() -> Weight {270 (27_580_000 as Weight)271 .saturating_add(RocksDbWeight::get().reads(4 as Weight))272 .saturating_add(RocksDbWeight::get().writes(5 as Weight))273 }274 // Storage: Nonfungible TokenData (r:1 w:1)275 fn set_variable_metadata(_b: u32, ) -> Weight {276 (7_700_000 as Weight)277 .saturating_add(RocksDbWeight::get().reads(1 as Weight))278 .saturating_add(RocksDbWeight::get().writes(1 as Weight))279 }280}pallets/refungible/src/common.rsdiffbeforeafterboth--- a/pallets/refungible/src/common.rs
+++ b/pallets/refungible/src/common.rs
@@ -70,6 +70,10 @@
<SelfWeightOf<T>>::set_collection_properties(amount)
}
+ fn delete_collection_properties(amount: u32) -> Weight {
+ <SelfWeightOf<T>>::delete_collection_properties(amount)
+ }
+
fn set_token_properties(amount: u32) -> Weight {
<SelfWeightOf<T>>::set_token_properties(amount)
}
@@ -268,6 +272,14 @@
fail!(<Error<T>>::PropertiesNotAllowed)
}
+ fn delete_collection_properties(
+ &self,
+ _sender: &T::CrossAccountId,
+ _property_keys: Vec<PropertyKey>,
+ ) -> DispatchResultWithPostInfo {
+ fail!(<Error<T>>::PropertiesNotAllowed)
+ }
+
fn set_token_properties(
&self,
_sender: T::CrossAccountId,
pallets/refungible/src/weights.rsdiffbeforeafterboth--- a/pallets/refungible/src/weights.rs
+++ b/pallets/refungible/src/weights.rs
@@ -39,6 +39,7 @@
fn burn_item_partial() -> Weight;
fn burn_item_fully() -> Weight;
fn set_collection_properties(amount: u32) -> Weight;
+ fn delete_collection_properties(amount: u32) -> Weight;
fn set_token_properties(amount: u32) -> Weight;
fn delete_token_properties(amount: u32) -> Weight;
fn set_property_permissions(amount: u32) -> Weight;
@@ -139,6 +140,11 @@
0
}
+ fn delete_collection_properties(_amount: u32) -> Weight {
+ // Error
+ 0
+ }
+
fn set_token_properties(_amount: u32) -> Weight {
// Error
0
@@ -328,6 +334,11 @@
0
}
+ fn delete_collection_properties(_amount: u32) -> Weight {
+ // Error
+ 0
+ }
+
fn set_token_properties(_amount: u32) -> Weight {
// Error
0
pallets/unique/src/lib.rsdiffbeforeafterboth--- a/pallets/unique/src/lib.rs
+++ b/pallets/unique/src/lib.rs
@@ -708,6 +708,20 @@
dispatch_call::<T, _>(collection_id, |d| d.set_collection_properties(sender, properties))
}
+ #[weight = T::CommonWeightInfo::delete_collection_properties(property_keys.len() as u32)]
+ #[transactional]
+ pub fn delete_collection_properties(
+ origin,
+ collection_id: CollectionId,
+ property_keys: Vec<PropertyKey>,
+ ) -> DispatchResultWithPostInfo {
+ ensure!(!property_keys.is_empty(), Error::<T>::EmptyArgument);
+
+ let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
+
+ dispatch_call::<T, _>(collection_id, |d| d.delete_collection_properties(&sender, property_keys))
+ }
+
#[weight = T::CommonWeightInfo::set_token_properties(properties.len() as u32)]
#[transactional]
pub fn set_token_properties(
@@ -723,19 +737,19 @@
dispatch_call::<T, _>(collection_id, |d| d.set_token_properties(sender, token_id, properties))
}
- #[weight = T::CommonWeightInfo::delete_token_properties(properties.len() as u32)]
+ #[weight = T::CommonWeightInfo::delete_token_properties(property_keys.len() as u32)]
#[transactional]
pub fn delete_token_properties(
origin,
collection_id: CollectionId,
token_id: TokenId,
- properties: Vec<PropertyKey>
+ property_keys: Vec<PropertyKey>
) -> DispatchResultWithPostInfo {
- ensure!(!properties.is_empty(), Error::<T>::EmptyArgument);
+ ensure!(!property_keys.is_empty(), Error::<T>::EmptyArgument);
let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
- dispatch_call::<T, _>(collection_id, |d| d.delete_token_properties(sender, token_id, properties))
+ dispatch_call::<T, _>(collection_id, |d| d.delete_token_properties(sender, token_id, property_keys))
}
#[weight = T::CommonWeightInfo::set_property_permissions(property_permissions.len() as u32)]
runtime/common/src/weights.rsdiffbeforeafterboth--- a/runtime/common/src/weights.rs
+++ b/runtime/common/src/weights.rs
@@ -58,6 +58,10 @@
dispatch_weight::<T>() + max_weight_of!(set_collection_properties(amount))
}
+ fn delete_collection_properties(amount: u32) -> Weight {
+ dispatch_weight::<T>() + max_weight_of!(delete_collection_properties(amount))
+ }
+
fn set_token_properties(amount: u32) -> Weight {
dispatch_weight::<T>() + max_weight_of!(set_token_properties(amount))
}