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.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/weights.rs
+++ b/pallets/nonfungible/src/weights.rs
@@ -37,6 +37,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;
@@ -100,6 +101,11 @@
(50_000_000 as Weight).saturating_mul(amount as Weight)
}
+ fn delete_collection_properties(amount: u32) -> Weight {
+ // TODO calculate appropriate weight
+ (50_000_000 as Weight).saturating_mul(amount as Weight)
+ }
+
fn set_token_properties(amount: u32) -> Weight {
// TODO calculate appropriate weight
(50_000_000 as Weight).saturating_mul(amount as Weight)
@@ -210,6 +216,11 @@
(50_000_000 as Weight).saturating_mul(amount as Weight)
}
+ fn delete_collection_properties(amount: u32) -> Weight {
+ // TODO calculate appropriate weight
+ (50_000_000 as Weight).saturating_mul(amount as Weight)
+ }
+
fn set_token_properties(amount: u32) -> Weight {
// TODO calculate appropriate weight
(50_000_000 as Weight).saturating_mul(amount as Weight)
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.rsdiffbeforeafterboth1// Template adopted from https://github.com/paritytech/substrate/blob/master/.maintain/frame-weight-template.hbs23//! Autogenerated weights for pallet_refungible4//!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-refungible14// --wasm-execution15// compiled16// --extrinsic17// *18// --template19// .maintain/frame-weight-template.hbs20// --steps=5021// --repeat=20022// --heap-pages=409623// --output=./pallets/refungible/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_refungible.34pub trait WeightInfo {35 fn create_item() -> Weight;36 fn create_multiple_items(b: u32, ) -> Weight;37 fn create_multiple_items_ex_multiple_items(b: u32, ) -> Weight;38 fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight;39 fn burn_item_partial() -> Weight;40 fn burn_item_fully() -> Weight;41 fn set_collection_properties(amount: u32) -> Weight;42 fn set_token_properties(amount: u32) -> Weight;43 fn delete_token_properties(amount: u32) -> Weight;44 fn set_property_permissions(amount: u32) -> Weight;45 fn transfer_normal() -> Weight;46 fn transfer_creating() -> Weight;47 fn transfer_removing() -> Weight;48 fn transfer_creating_removing() -> Weight;49 fn approve() -> Weight;50 fn transfer_from_normal() -> Weight;51 fn transfer_from_creating() -> Weight;52 fn transfer_from_removing() -> Weight;53 fn transfer_from_creating_removing() -> Weight;54 fn burn_from() -> Weight;55 fn set_variable_metadata(b: u32, ) -> Weight;56}5758/// Weights for pallet_refungible using the Substrate node and recommended hardware.59pub struct SubstrateWeight<T>(PhantomData<T>);60impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {61 // Storage: Refungible TokensMinted (r:1 w:1)62 // Storage: Refungible AccountBalance (r:1 w:1)63 // Storage: Refungible Balance (r:0 w:1)64 // Storage: Refungible TotalSupply (r:0 w:1)65 // Storage: Refungible TokenData (r:0 w:1)66 // Storage: Refungible Owned (r:0 w:1)67 fn create_item() -> Weight {68 (21_255_000 as Weight)69 .saturating_add(T::DbWeight::get().reads(2 as Weight))70 .saturating_add(T::DbWeight::get().writes(6 as Weight))71 }72 // Storage: Refungible TokensMinted (r:1 w:1)73 // Storage: Refungible AccountBalance (r:1 w:1)74 // Storage: Refungible Balance (r:0 w:4)75 // Storage: Refungible TotalSupply (r:0 w:4)76 // Storage: Refungible TokenData (r:0 w:4)77 // Storage: Refungible Owned (r:0 w:4)78 fn create_multiple_items(b: u32, ) -> Weight {79 (18_052_000 as Weight)80 // Standard Error: 1_00081 .saturating_add((5_549_000 as Weight).saturating_mul(b as Weight))82 .saturating_add(T::DbWeight::get().reads(2 as Weight))83 .saturating_add(T::DbWeight::get().writes(2 as Weight))84 .saturating_add(T::DbWeight::get().writes((4 as Weight).saturating_mul(b as Weight)))85 }86 // Storage: Refungible TokensMinted (r:1 w:1)87 // Storage: Refungible AccountBalance (r:4 w:4)88 // Storage: Refungible Balance (r:0 w:4)89 // Storage: Refungible TotalSupply (r:0 w:4)90 // Storage: Refungible TokenData (r:0 w:4)91 // Storage: Refungible Owned (r:0 w:4)92 fn create_multiple_items_ex_multiple_items(b: u32, ) -> Weight {93 (15_766_000 as Weight)94 // Standard Error: 2_00095 .saturating_add((8_187_000 as Weight).saturating_mul(b as Weight))96 .saturating_add(T::DbWeight::get().reads(1 as Weight))97 .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))98 .saturating_add(T::DbWeight::get().writes(1 as Weight))99 .saturating_add(T::DbWeight::get().writes((5 as Weight).saturating_mul(b as Weight)))100 }101 // Storage: Refungible TokensMinted (r:1 w:1)102 // Storage: Refungible TotalSupply (r:0 w:1)103 // Storage: Refungible TokenData (r:0 w:1)104 // Storage: Refungible AccountBalance (r:4 w:4)105 // Storage: Refungible Balance (r:0 w:4)106 // Storage: Refungible Owned (r:0 w:4)107 fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight {108 (5_675_000 as Weight)109 // Standard Error: 2_000110 .saturating_add((6_315_000 as Weight).saturating_mul(b as Weight))111 .saturating_add(T::DbWeight::get().reads(1 as Weight))112 .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))113 .saturating_add(T::DbWeight::get().writes(3 as Weight))114 .saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(b as Weight)))115 }116 // Storage: Refungible TotalSupply (r:1 w:1)117 // Storage: Refungible Balance (r:1 w:1)118 // Storage: Refungible AccountBalance (r:1 w:1)119 // Storage: Refungible Owned (r:0 w:1)120 fn burn_item_partial() -> Weight {121 (23_518_000 as Weight)122 .saturating_add(T::DbWeight::get().reads(3 as Weight))123 .saturating_add(T::DbWeight::get().writes(4 as Weight))124 }125 // Storage: Refungible TotalSupply (r:1 w:1)126 // Storage: Refungible Balance (r:1 w:1)127 // Storage: Refungible AccountBalance (r:1 w:1)128 // Storage: Refungible TokensBurnt (r:1 w:1)129 // Storage: Refungible TokenData (r:0 w:1)130 // Storage: Refungible Owned (r:0 w:1)131 fn burn_item_fully() -> Weight {132 (32_489_000 as Weight)133 .saturating_add(T::DbWeight::get().reads(4 as Weight))134 .saturating_add(T::DbWeight::get().writes(6 as Weight))135 }136137 fn set_collection_properties(_amount: u32) -> Weight {138 // Error139 0140 }141142 fn set_token_properties(_amount: u32) -> Weight {143 // Error144 0145 }146147 fn delete_token_properties(_amount: u32) -> Weight {148 // Error149 0150 }151152 fn set_property_permissions(_amount: u32) -> Weight {153 // Error154 0155 }156157 // Storage: Refungible Balance (r:2 w:2)158 fn transfer_normal() -> Weight {159 (19_766_000 as Weight)160 .saturating_add(T::DbWeight::get().reads(2 as Weight))161 .saturating_add(T::DbWeight::get().writes(2 as Weight))162 }163 // Storage: Refungible Balance (r:2 w:2)164 // Storage: Refungible AccountBalance (r:1 w:1)165 // Storage: Refungible Owned (r:0 w:1)166 fn transfer_creating() -> Weight {167 (23_360_000 as Weight)168 .saturating_add(T::DbWeight::get().reads(3 as Weight))169 .saturating_add(T::DbWeight::get().writes(4 as Weight))170 }171 // Storage: Refungible Balance (r:2 w:2)172 // Storage: Refungible AccountBalance (r:1 w:1)173 // Storage: Refungible Owned (r:0 w:1)174 fn transfer_removing() -> Weight {175 (25_344_000 as Weight)176 .saturating_add(T::DbWeight::get().reads(3 as Weight))177 .saturating_add(T::DbWeight::get().writes(4 as Weight))178 }179 // Storage: Refungible Balance (r:2 w:2)180 // Storage: Refungible AccountBalance (r:2 w:2)181 // Storage: Refungible Owned (r:0 w:2)182 fn transfer_creating_removing() -> Weight {183 (28_553_000 as Weight)184 .saturating_add(T::DbWeight::get().reads(4 as Weight))185 .saturating_add(T::DbWeight::get().writes(6 as Weight))186 }187 // Storage: Refungible Balance (r:1 w:0)188 // Storage: Refungible Allowance (r:0 w:1)189 fn approve() -> Weight {190 (15_356_000 as Weight)191 .saturating_add(T::DbWeight::get().reads(1 as Weight))192 .saturating_add(T::DbWeight::get().writes(1 as Weight))193 }194 // Storage: Refungible Allowance (r:1 w:1)195 // Storage: Refungible Balance (r:2 w:2)196 fn transfer_from_normal() -> Weight {197 (28_832_000 as Weight)198 .saturating_add(T::DbWeight::get().reads(3 as Weight))199 .saturating_add(T::DbWeight::get().writes(3 as Weight))200 }201 // Storage: Refungible Allowance (r:1 w:1)202 // Storage: Refungible Balance (r:2 w:2)203 // Storage: Refungible AccountBalance (r:1 w:1)204 // Storage: Refungible Owned (r:0 w:1)205 fn transfer_from_creating() -> Weight {206 (32_132_000 as Weight)207 .saturating_add(T::DbWeight::get().reads(4 as Weight))208 .saturating_add(T::DbWeight::get().writes(5 as Weight))209 }210 // Storage: Refungible Allowance (r:1 w:1)211 // Storage: Refungible Balance (r:2 w:2)212 // Storage: Refungible AccountBalance (r:1 w:1)213 // Storage: Refungible Owned (r:0 w:1)214 fn transfer_from_removing() -> Weight {215 (33_237_000 as Weight)216 .saturating_add(T::DbWeight::get().reads(4 as Weight))217 .saturating_add(T::DbWeight::get().writes(5 as Weight))218 }219 // Storage: Refungible Allowance (r:1 w:1)220 // Storage: Refungible Balance (r:2 w:2)221 // Storage: Refungible AccountBalance (r:2 w:2)222 // Storage: Refungible Owned (r:0 w:2)223 fn transfer_from_creating_removing() -> Weight {224 (36_399_000 as Weight)225 .saturating_add(T::DbWeight::get().reads(5 as Weight))226 .saturating_add(T::DbWeight::get().writes(7 as Weight))227 }228 // Storage: Refungible Allowance (r:1 w:1)229 // Storage: Refungible TotalSupply (r:1 w:1)230 // Storage: Refungible Balance (r:1 w:1)231 // Storage: Refungible AccountBalance (r:1 w:1)232 // Storage: Refungible TokensBurnt (r:1 w:1)233 // Storage: Refungible TokenData (r:0 w:1)234 // Storage: Refungible Owned (r:0 w:1)235 fn burn_from() -> Weight {236 (42_043_000 as Weight)237 .saturating_add(T::DbWeight::get().reads(5 as Weight))238 .saturating_add(T::DbWeight::get().writes(7 as Weight))239 }240 // Storage: Refungible TokenData (r:1 w:1)241 fn set_variable_metadata(_b: u32, ) -> Weight {242 (7_364_000 as Weight)243 .saturating_add(T::DbWeight::get().reads(1 as Weight))244 .saturating_add(T::DbWeight::get().writes(1 as Weight))245 }246}247248// For backwards compatibility and tests249impl WeightInfo for () {250 // Storage: Refungible TokensMinted (r:1 w:1)251 // Storage: Refungible AccountBalance (r:1 w:1)252 // Storage: Refungible Balance (r:0 w:1)253 // Storage: Refungible TotalSupply (r:0 w:1)254 // Storage: Refungible TokenData (r:0 w:1)255 // Storage: Refungible Owned (r:0 w:1)256 fn create_item() -> Weight {257 (21_255_000 as Weight)258 .saturating_add(RocksDbWeight::get().reads(2 as Weight))259 .saturating_add(RocksDbWeight::get().writes(6 as Weight))260 }261 // Storage: Refungible TokensMinted (r:1 w:1)262 // Storage: Refungible AccountBalance (r:1 w:1)263 // Storage: Refungible Balance (r:0 w:4)264 // Storage: Refungible TotalSupply (r:0 w:4)265 // Storage: Refungible TokenData (r:0 w:4)266 // Storage: Refungible Owned (r:0 w:4)267 fn create_multiple_items(b: u32, ) -> Weight {268 (18_052_000 as Weight)269 // Standard Error: 1_000270 .saturating_add((5_549_000 as Weight).saturating_mul(b as Weight))271 .saturating_add(RocksDbWeight::get().reads(2 as Weight))272 .saturating_add(RocksDbWeight::get().writes(2 as Weight))273 .saturating_add(RocksDbWeight::get().writes((4 as Weight).saturating_mul(b as Weight)))274 }275 // Storage: Refungible TokensMinted (r:1 w:1)276 // Storage: Refungible AccountBalance (r:4 w:4)277 // Storage: Refungible Balance (r:0 w:4)278 // Storage: Refungible TotalSupply (r:0 w:4)279 // Storage: Refungible TokenData (r:0 w:4)280 // Storage: Refungible Owned (r:0 w:4)281 fn create_multiple_items_ex_multiple_items(b: u32, ) -> Weight {282 (15_766_000 as Weight)283 // Standard Error: 2_000284 .saturating_add((8_187_000 as Weight).saturating_mul(b as Weight))285 .saturating_add(RocksDbWeight::get().reads(1 as Weight))286 .saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))287 .saturating_add(RocksDbWeight::get().writes(1 as Weight))288 .saturating_add(RocksDbWeight::get().writes((5 as Weight).saturating_mul(b as Weight)))289 }290 // Storage: Refungible TokensMinted (r:1 w:1)291 // Storage: Refungible TotalSupply (r:0 w:1)292 // Storage: Refungible TokenData (r:0 w:1)293 // Storage: Refungible AccountBalance (r:4 w:4)294 // Storage: Refungible Balance (r:0 w:4)295 // Storage: Refungible Owned (r:0 w:4)296 fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight {297 (5_675_000 as Weight)298 // Standard Error: 2_000299 .saturating_add((6_315_000 as Weight).saturating_mul(b as Weight))300 .saturating_add(RocksDbWeight::get().reads(1 as Weight))301 .saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))302 .saturating_add(RocksDbWeight::get().writes(3 as Weight))303 .saturating_add(RocksDbWeight::get().writes((3 as Weight).saturating_mul(b as Weight)))304 }305 // Storage: Refungible TotalSupply (r:1 w:1)306 // Storage: Refungible Balance (r:1 w:1)307 // Storage: Refungible AccountBalance (r:1 w:1)308 // Storage: Refungible Owned (r:0 w:1)309 fn burn_item_partial() -> Weight {310 (23_518_000 as Weight)311 .saturating_add(RocksDbWeight::get().reads(3 as Weight))312 .saturating_add(RocksDbWeight::get().writes(4 as Weight))313 }314 // Storage: Refungible TotalSupply (r:1 w:1)315 // Storage: Refungible Balance (r:1 w:1)316 // Storage: Refungible AccountBalance (r:1 w:1)317 // Storage: Refungible TokensBurnt (r:1 w:1)318 // Storage: Refungible TokenData (r:0 w:1)319 // Storage: Refungible Owned (r:0 w:1)320 fn burn_item_fully() -> Weight {321 (32_489_000 as Weight)322 .saturating_add(RocksDbWeight::get().reads(4 as Weight))323 .saturating_add(RocksDbWeight::get().writes(6 as Weight))324 }325326 fn set_collection_properties(_amount: u32) -> Weight {327 // Error328 0329 }330331 fn set_token_properties(_amount: u32) -> Weight {332 // Error333 0334 }335336 fn delete_token_properties(_amount: u32) -> Weight {337 // Error338 0339 }340341 fn set_property_permissions(_amount: u32) -> Weight {342 // Error343 0344 }345346 // Storage: Refungible Balance (r:2 w:2)347 fn transfer_normal() -> Weight {348 (19_766_000 as Weight)349 .saturating_add(RocksDbWeight::get().reads(2 as Weight))350 .saturating_add(RocksDbWeight::get().writes(2 as Weight))351 }352 // Storage: Refungible Balance (r:2 w:2)353 // Storage: Refungible AccountBalance (r:1 w:1)354 // Storage: Refungible Owned (r:0 w:1)355 fn transfer_creating() -> Weight {356 (23_360_000 as Weight)357 .saturating_add(RocksDbWeight::get().reads(3 as Weight))358 .saturating_add(RocksDbWeight::get().writes(4 as Weight))359 }360 // Storage: Refungible Balance (r:2 w:2)361 // Storage: Refungible AccountBalance (r:1 w:1)362 // Storage: Refungible Owned (r:0 w:1)363 fn transfer_removing() -> Weight {364 (25_344_000 as Weight)365 .saturating_add(RocksDbWeight::get().reads(3 as Weight))366 .saturating_add(RocksDbWeight::get().writes(4 as Weight))367 }368 // Storage: Refungible Balance (r:2 w:2)369 // Storage: Refungible AccountBalance (r:2 w:2)370 // Storage: Refungible Owned (r:0 w:2)371 fn transfer_creating_removing() -> Weight {372 (28_553_000 as Weight)373 .saturating_add(RocksDbWeight::get().reads(4 as Weight))374 .saturating_add(RocksDbWeight::get().writes(6 as Weight))375 }376 // Storage: Refungible Balance (r:1 w:0)377 // Storage: Refungible Allowance (r:0 w:1)378 fn approve() -> Weight {379 (15_356_000 as Weight)380 .saturating_add(RocksDbWeight::get().reads(1 as Weight))381 .saturating_add(RocksDbWeight::get().writes(1 as Weight))382 }383 // Storage: Refungible Allowance (r:1 w:1)384 // Storage: Refungible Balance (r:2 w:2)385 fn transfer_from_normal() -> Weight {386 (28_832_000 as Weight)387 .saturating_add(RocksDbWeight::get().reads(3 as Weight))388 .saturating_add(RocksDbWeight::get().writes(3 as Weight))389 }390 // Storage: Refungible Allowance (r:1 w:1)391 // Storage: Refungible Balance (r:2 w:2)392 // Storage: Refungible AccountBalance (r:1 w:1)393 // Storage: Refungible Owned (r:0 w:1)394 fn transfer_from_creating() -> Weight {395 (32_132_000 as Weight)396 .saturating_add(RocksDbWeight::get().reads(4 as Weight))397 .saturating_add(RocksDbWeight::get().writes(5 as Weight))398 }399 // Storage: Refungible Allowance (r:1 w:1)400 // Storage: Refungible Balance (r:2 w:2)401 // Storage: Refungible AccountBalance (r:1 w:1)402 // Storage: Refungible Owned (r:0 w:1)403 fn transfer_from_removing() -> Weight {404 (33_237_000 as Weight)405 .saturating_add(RocksDbWeight::get().reads(4 as Weight))406 .saturating_add(RocksDbWeight::get().writes(5 as Weight))407 }408 // Storage: Refungible Allowance (r:1 w:1)409 // Storage: Refungible Balance (r:2 w:2)410 // Storage: Refungible AccountBalance (r:2 w:2)411 // Storage: Refungible Owned (r:0 w:2)412 fn transfer_from_creating_removing() -> Weight {413 (36_399_000 as Weight)414 .saturating_add(RocksDbWeight::get().reads(5 as Weight))415 .saturating_add(RocksDbWeight::get().writes(7 as Weight))416 }417 // Storage: Refungible Allowance (r:1 w:1)418 // Storage: Refungible TotalSupply (r:1 w:1)419 // Storage: Refungible Balance (r:1 w:1)420 // Storage: Refungible AccountBalance (r:1 w:1)421 // Storage: Refungible TokensBurnt (r:1 w:1)422 // Storage: Refungible TokenData (r:0 w:1)423 // Storage: Refungible Owned (r:0 w:1)424 fn burn_from() -> Weight {425 (42_043_000 as Weight)426 .saturating_add(RocksDbWeight::get().reads(5 as Weight))427 .saturating_add(RocksDbWeight::get().writes(7 as Weight))428 }429 // Storage: Refungible TokenData (r:1 w:1)430 fn set_variable_metadata(_b: u32, ) -> Weight {431 (7_364_000 as Weight)432 .saturating_add(RocksDbWeight::get().reads(1 as Weight))433 .saturating_add(RocksDbWeight::get().writes(1 as Weight))434 }435}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))
}