difftreelog
refactor set_token_property_permissions
in: master
15 files changed
pallets/common/src/lib.rsdiffbeforeafterboth--- a/pallets/common/src/lib.rs
+++ b/pallets/common/src/lib.rs
@@ -1019,7 +1019,7 @@
}
#[transactional]
- pub fn set_property_permissions(
+ pub fn set_token_property_permissions(
collection: &CollectionHandle<T>,
sender: &T::CrossAccountId,
property_permissions: Vec<PropertyKeyPermission>,
@@ -1239,7 +1239,7 @@
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;
+ fn set_token_property_permissions(amount: u32) -> Weight;
fn transfer() -> Weight;
fn approve() -> Weight;
fn transfer_from() -> Weight;
@@ -1318,7 +1318,7 @@
token_id: TokenId,
property_keys: Vec<PropertyKey>,
) -> DispatchResultWithPostInfo;
- fn set_property_permissions(
+ fn set_token_property_permissions(
&self,
sender: &T::CrossAccountId,
property_permissions: Vec<PropertyKeyPermission>,
pallets/fungible/src/common.rsdiffbeforeafterboth--- a/pallets/fungible/src/common.rs
+++ b/pallets/fungible/src/common.rs
@@ -72,7 +72,7 @@
0
}
- fn set_property_permissions(_amount: u32) -> Weight {
+ fn set_token_property_permissions(_amount: u32) -> Weight {
// Error
0
}
@@ -302,7 +302,7 @@
fail!(<Error<T>>::SettingPropertiesNotAllowed)
}
- fn set_property_permissions(
+ fn set_token_property_permissions(
&self,
_sender: &T::CrossAccountId,
_property_permissions: Vec<PropertyKeyPermission>,
pallets/nonfungible/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/benchmarking.rs
+++ b/pallets/nonfungible/src/benchmarking.rs
@@ -147,7 +147,7 @@
<Pallet<T>>::set_allowance(&collection, &sender, item, Some(&burner))?;
}: {<Pallet<T>>::burn_from(&collection, &burner, &sender, item, &Unlimited)?}
- set_property_permissions {
+ set_token_property_permissions {
let b in 0..MAX_PROPERTIES_PER_ITEM;
bench_init!{
owner: sub; collection: collection(owner);
@@ -161,7 +161,7 @@
token_owner: false,
},
}).collect::<Vec<_>>();
- }: {<Pallet<T>>::set_property_permissions(&collection, &owner, perms)?}
+ }: {<Pallet<T>>::set_token_property_permissions(&collection, &owner, perms)?}
set_token_properties {
let b in 0..MAX_PROPERTIES_PER_ITEM;
@@ -177,7 +177,7 @@
token_owner: true,
},
}).collect::<Vec<_>>();
- <Pallet<T>>::set_property_permissions(&collection, &owner, perms)?;
+ <Pallet<T>>::set_token_property_permissions(&collection, &owner, perms)?;
let props = (0..b).map(|k| Property {
key: property_key(k as usize),
value: property_value(),
@@ -199,7 +199,7 @@
token_owner: true,
},
}).collect::<Vec<_>>();
- <Pallet<T>>::set_property_permissions(&collection, &owner, perms)?;
+ <Pallet<T>>::set_token_property_permissions(&collection, &owner, perms)?;
let props = (0..b).map(|k| Property {
key: property_key(k as usize),
value: property_value(),
pallets/nonfungible/src/common.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/common.rs
+++ b/pallets/nonfungible/src/common.rs
@@ -89,8 +89,8 @@
<SelfWeightOf<T>>::delete_token_properties(amount)
}
- fn set_property_permissions(amount: u32) -> Weight {
- <SelfWeightOf<T>>::set_property_permissions(amount)
+ fn set_token_property_permissions(amount: u32) -> Weight {
+ <SelfWeightOf<T>>::set_token_property_permissions(amount)
}
fn transfer() -> Weight {
@@ -242,16 +242,16 @@
)
}
- fn set_property_permissions(
+ fn set_token_property_permissions(
&self,
sender: &T::CrossAccountId,
property_permissions: Vec<PropertyKeyPermission>,
) -> DispatchResultWithPostInfo {
let weight =
- <CommonWeights<T>>::set_property_permissions(property_permissions.len() as u32);
+ <CommonWeights<T>>::set_token_property_permissions(property_permissions.len() as u32);
with_weight(
- <Pallet<T>>::set_property_permissions(self, sender, property_permissions),
+ <Pallet<T>>::set_token_property_permissions(self, sender, property_permissions),
weight,
)
}
pallets/nonfungible/src/lib.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/lib.rs
+++ b/pallets/nonfungible/src/lib.rs
@@ -594,12 +594,12 @@
<PalletCommon<T>>::delete_collection_properties(collection, sender, property_keys)
}
- pub fn set_property_permissions(
+ pub fn set_token_property_permissions(
collection: &CollectionHandle<T>,
sender: &T::CrossAccountId,
property_permissions: Vec<PropertyKeyPermission>,
) -> DispatchResult {
- <PalletCommon<T>>::set_property_permissions(collection, sender, property_permissions)
+ <PalletCommon<T>>::set_token_property_permissions(collection, sender, property_permissions)
}
pub fn set_property_permission(
pallets/nonfungible/src/weights.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/weights.rs
+++ b/pallets/nonfungible/src/weights.rs
@@ -42,7 +42,7 @@
fn approve() -> Weight;
fn transfer_from() -> Weight;
fn burn_from() -> Weight;
- fn set_property_permissions(b: u32) -> Weight;
+ fn set_token_property_permissions(b: u32) -> Weight;
fn set_token_properties(b: u32) -> Weight;
fn delete_token_properties(b: u32) -> Weight;
}
@@ -159,7 +159,7 @@
.saturating_add(T::DbWeight::get().writes(5 as Weight))
}
// Storage: Common CollectionPropertyPermissions (r:1 w:1)
- fn set_property_permissions(b: u32, ) -> Weight {
+ fn set_token_property_permissions(b: u32, ) -> Weight {
(0 as Weight)
// Standard Error: 3_432_000
.saturating_add((126_888_000 as Weight).saturating_mul(b as Weight))
@@ -299,7 +299,7 @@
.saturating_add(RocksDbWeight::get().writes(5 as Weight))
}
// Storage: Common CollectionPropertyPermissions (r:1 w:1)
- fn set_property_permissions(b: u32, ) -> Weight {
+ fn set_token_property_permissions(b: u32, ) -> Weight {
(0 as Weight)
// Standard Error: 3_432_000
.saturating_add((126_888_000 as Weight).saturating_mul(b as Weight))
pallets/refungible/src/common.rsdiffbeforeafterboth--- a/pallets/refungible/src/common.rs
+++ b/pallets/refungible/src/common.rs
@@ -85,8 +85,8 @@
<SelfWeightOf<T>>::delete_token_properties(amount)
}
- fn set_property_permissions(amount: u32) -> Weight {
- <SelfWeightOf<T>>::set_property_permissions(amount)
+ fn set_token_property_permissions(amount: u32) -> Weight {
+ <SelfWeightOf<T>>::set_token_property_permissions(amount)
}
fn transfer() -> Weight {
@@ -315,7 +315,7 @@
fail!(<Error<T>>::SettingPropertiesNotAllowed)
}
- fn set_property_permissions(
+ fn set_token_property_permissions(
&self,
_sender: &T::CrossAccountId,
_property_permissions: Vec<PropertyKeyPermission>,
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_token_properties(amount: u32) -> Weight;42 fn delete_token_properties(amount: u32) -> Weight;43 fn set_property_permissions(amount: u32) -> Weight;44 fn transfer_normal() -> Weight;45 fn transfer_creating() -> Weight;46 fn transfer_removing() -> Weight;47 fn transfer_creating_removing() -> Weight;48 fn approve() -> Weight;49 fn transfer_from_normal() -> Weight;50 fn transfer_from_creating() -> Weight;51 fn transfer_from_removing() -> Weight;52 fn transfer_from_creating_removing() -> Weight;53 fn burn_from() -> Weight;54}5556/// Weights for pallet_refungible using the Substrate node and recommended hardware.57pub struct SubstrateWeight<T>(PhantomData<T>);58impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {59 // Storage: Refungible TokensMinted (r:1 w:1)60 // Storage: Refungible AccountBalance (r:1 w:1)61 // Storage: Refungible Balance (r:0 w:1)62 // Storage: Refungible TotalSupply (r:0 w:1)63 // Storage: Refungible TokenData (r:0 w:1)64 // Storage: Refungible Owned (r:0 w:1)65 fn create_item() -> Weight {66 (21_255_000 as Weight)67 .saturating_add(T::DbWeight::get().reads(2 as Weight))68 .saturating_add(T::DbWeight::get().writes(6 as Weight))69 }70 // Storage: Refungible TokensMinted (r:1 w:1)71 // Storage: Refungible AccountBalance (r:1 w:1)72 // Storage: Refungible Balance (r:0 w:4)73 // Storage: Refungible TotalSupply (r:0 w:4)74 // Storage: Refungible TokenData (r:0 w:4)75 // Storage: Refungible Owned (r:0 w:4)76 fn create_multiple_items(b: u32, ) -> Weight {77 (18_052_000 as Weight)78 // Standard Error: 1_00079 .saturating_add((5_549_000 as Weight).saturating_mul(b as Weight))80 .saturating_add(T::DbWeight::get().reads(2 as Weight))81 .saturating_add(T::DbWeight::get().writes(2 as Weight))82 .saturating_add(T::DbWeight::get().writes((4 as Weight).saturating_mul(b as Weight)))83 }84 // Storage: Refungible TokensMinted (r:1 w:1)85 // Storage: Refungible AccountBalance (r:4 w:4)86 // Storage: Refungible Balance (r:0 w:4)87 // Storage: Refungible TotalSupply (r:0 w:4)88 // Storage: Refungible TokenData (r:0 w:4)89 // Storage: Refungible Owned (r:0 w:4)90 fn create_multiple_items_ex_multiple_items(b: u32, ) -> Weight {91 (15_766_000 as Weight)92 // Standard Error: 2_00093 .saturating_add((8_187_000 as Weight).saturating_mul(b as Weight))94 .saturating_add(T::DbWeight::get().reads(1 as Weight))95 .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))96 .saturating_add(T::DbWeight::get().writes(1 as Weight))97 .saturating_add(T::DbWeight::get().writes((5 as Weight).saturating_mul(b as Weight)))98 }99 // Storage: Refungible TokensMinted (r:1 w:1)100 // Storage: Refungible TotalSupply (r:0 w:1)101 // Storage: Refungible TokenData (r:0 w:1)102 // Storage: Refungible AccountBalance (r:4 w:4)103 // Storage: Refungible Balance (r:0 w:4)104 // Storage: Refungible Owned (r:0 w:4)105 fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight {106 (5_675_000 as Weight)107 // Standard Error: 2_000108 .saturating_add((6_315_000 as Weight).saturating_mul(b as Weight))109 .saturating_add(T::DbWeight::get().reads(1 as Weight))110 .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))111 .saturating_add(T::DbWeight::get().writes(3 as Weight))112 .saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(b as Weight)))113 }114 // Storage: Refungible TotalSupply (r:1 w:1)115 // Storage: Refungible Balance (r:1 w:1)116 // Storage: Refungible AccountBalance (r:1 w:1)117 // Storage: Refungible Owned (r:0 w:1)118 fn burn_item_partial() -> Weight {119 (23_518_000 as Weight)120 .saturating_add(T::DbWeight::get().reads(3 as Weight))121 .saturating_add(T::DbWeight::get().writes(4 as Weight))122 }123 // Storage: Refungible TotalSupply (r:1 w:1)124 // Storage: Refungible Balance (r:1 w:1)125 // Storage: Refungible AccountBalance (r:1 w:1)126 // Storage: Refungible TokensBurnt (r:1 w:1)127 // Storage: Refungible TokenData (r:0 w:1)128 // Storage: Refungible Owned (r:0 w:1)129 fn burn_item_fully() -> Weight {130 (32_489_000 as Weight)131 .saturating_add(T::DbWeight::get().reads(4 as Weight))132 .saturating_add(T::DbWeight::get().writes(6 as Weight))133 }134135 fn set_token_properties(_amount: u32) -> Weight {136 // Error137 0138 }139140 fn delete_token_properties(_amount: u32) -> Weight {141 // Error142 0143 }144145 fn set_property_permissions(_amount: u32) -> Weight {146 // Error147 0148 }149150 // Storage: Refungible Balance (r:2 w:2)151 fn transfer_normal() -> Weight {152 (19_766_000 as Weight)153 .saturating_add(T::DbWeight::get().reads(2 as Weight))154 .saturating_add(T::DbWeight::get().writes(2 as Weight))155 }156 // Storage: Refungible Balance (r:2 w:2)157 // Storage: Refungible AccountBalance (r:1 w:1)158 // Storage: Refungible Owned (r:0 w:1)159 fn transfer_creating() -> Weight {160 (23_360_000 as Weight)161 .saturating_add(T::DbWeight::get().reads(3 as Weight))162 .saturating_add(T::DbWeight::get().writes(4 as Weight))163 }164 // Storage: Refungible Balance (r:2 w:2)165 // Storage: Refungible AccountBalance (r:1 w:1)166 // Storage: Refungible Owned (r:0 w:1)167 fn transfer_removing() -> Weight {168 (25_344_000 as Weight)169 .saturating_add(T::DbWeight::get().reads(3 as Weight))170 .saturating_add(T::DbWeight::get().writes(4 as Weight))171 }172 // Storage: Refungible Balance (r:2 w:2)173 // Storage: Refungible AccountBalance (r:2 w:2)174 // Storage: Refungible Owned (r:0 w:2)175 fn transfer_creating_removing() -> Weight {176 (28_553_000 as Weight)177 .saturating_add(T::DbWeight::get().reads(4 as Weight))178 .saturating_add(T::DbWeight::get().writes(6 as Weight))179 }180 // Storage: Refungible Balance (r:1 w:0)181 // Storage: Refungible Allowance (r:0 w:1)182 fn approve() -> Weight {183 (15_356_000 as Weight)184 .saturating_add(T::DbWeight::get().reads(1 as Weight))185 .saturating_add(T::DbWeight::get().writes(1 as Weight))186 }187 // Storage: Refungible Allowance (r:1 w:1)188 // Storage: Refungible Balance (r:2 w:2)189 fn transfer_from_normal() -> Weight {190 (28_832_000 as Weight)191 .saturating_add(T::DbWeight::get().reads(3 as Weight))192 .saturating_add(T::DbWeight::get().writes(3 as Weight))193 }194 // Storage: Refungible Allowance (r:1 w:1)195 // Storage: Refungible Balance (r:2 w:2)196 // Storage: Refungible AccountBalance (r:1 w:1)197 // Storage: Refungible Owned (r:0 w:1)198 fn transfer_from_creating() -> Weight {199 (32_132_000 as Weight)200 .saturating_add(T::DbWeight::get().reads(4 as Weight))201 .saturating_add(T::DbWeight::get().writes(5 as Weight))202 }203 // Storage: Refungible Allowance (r:1 w:1)204 // Storage: Refungible Balance (r:2 w:2)205 // Storage: Refungible AccountBalance (r:1 w:1)206 // Storage: Refungible Owned (r:0 w:1)207 fn transfer_from_removing() -> Weight {208 (33_237_000 as Weight)209 .saturating_add(T::DbWeight::get().reads(4 as Weight))210 .saturating_add(T::DbWeight::get().writes(5 as Weight))211 }212 // Storage: Refungible Allowance (r:1 w:1)213 // Storage: Refungible Balance (r:2 w:2)214 // Storage: Refungible AccountBalance (r:2 w:2)215 // Storage: Refungible Owned (r:0 w:2)216 fn transfer_from_creating_removing() -> Weight {217 (36_399_000 as Weight)218 .saturating_add(T::DbWeight::get().reads(5 as Weight))219 .saturating_add(T::DbWeight::get().writes(7 as Weight))220 }221 // Storage: Refungible Allowance (r:1 w:1)222 // Storage: Refungible TotalSupply (r:1 w:1)223 // Storage: Refungible Balance (r:1 w:1)224 // Storage: Refungible AccountBalance (r:1 w:1)225 // Storage: Refungible TokensBurnt (r:1 w:1)226 // Storage: Refungible TokenData (r:0 w:1)227 // Storage: Refungible Owned (r:0 w:1)228 fn burn_from() -> Weight {229 (42_043_000 as Weight)230 .saturating_add(T::DbWeight::get().reads(5 as Weight))231 .saturating_add(T::DbWeight::get().writes(7 as Weight))232 }233}234235// For backwards compatibility and tests236impl WeightInfo for () {237 // Storage: Refungible TokensMinted (r:1 w:1)238 // Storage: Refungible AccountBalance (r:1 w:1)239 // Storage: Refungible Balance (r:0 w:1)240 // Storage: Refungible TotalSupply (r:0 w:1)241 // Storage: Refungible TokenData (r:0 w:1)242 // Storage: Refungible Owned (r:0 w:1)243 fn create_item() -> Weight {244 (21_255_000 as Weight)245 .saturating_add(RocksDbWeight::get().reads(2 as Weight))246 .saturating_add(RocksDbWeight::get().writes(6 as Weight))247 }248 // Storage: Refungible TokensMinted (r:1 w:1)249 // Storage: Refungible AccountBalance (r:1 w:1)250 // Storage: Refungible Balance (r:0 w:4)251 // Storage: Refungible TotalSupply (r:0 w:4)252 // Storage: Refungible TokenData (r:0 w:4)253 // Storage: Refungible Owned (r:0 w:4)254 fn create_multiple_items(b: u32, ) -> Weight {255 (18_052_000 as Weight)256 // Standard Error: 1_000257 .saturating_add((5_549_000 as Weight).saturating_mul(b as Weight))258 .saturating_add(RocksDbWeight::get().reads(2 as Weight))259 .saturating_add(RocksDbWeight::get().writes(2 as Weight))260 .saturating_add(RocksDbWeight::get().writes((4 as Weight).saturating_mul(b as Weight)))261 }262 // Storage: Refungible TokensMinted (r:1 w:1)263 // Storage: Refungible AccountBalance (r:4 w:4)264 // Storage: Refungible Balance (r:0 w:4)265 // Storage: Refungible TotalSupply (r:0 w:4)266 // Storage: Refungible TokenData (r:0 w:4)267 // Storage: Refungible Owned (r:0 w:4)268 fn create_multiple_items_ex_multiple_items(b: u32, ) -> Weight {269 (15_766_000 as Weight)270 // Standard Error: 2_000271 .saturating_add((8_187_000 as Weight).saturating_mul(b as Weight))272 .saturating_add(RocksDbWeight::get().reads(1 as Weight))273 .saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))274 .saturating_add(RocksDbWeight::get().writes(1 as Weight))275 .saturating_add(RocksDbWeight::get().writes((5 as Weight).saturating_mul(b as Weight)))276 }277 // Storage: Refungible TokensMinted (r:1 w:1)278 // Storage: Refungible TotalSupply (r:0 w:1)279 // Storage: Refungible TokenData (r:0 w:1)280 // Storage: Refungible AccountBalance (r:4 w:4)281 // Storage: Refungible Balance (r:0 w:4)282 // Storage: Refungible Owned (r:0 w:4)283 fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight {284 (5_675_000 as Weight)285 // Standard Error: 2_000286 .saturating_add((6_315_000 as Weight).saturating_mul(b as Weight))287 .saturating_add(RocksDbWeight::get().reads(1 as Weight))288 .saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))289 .saturating_add(RocksDbWeight::get().writes(3 as Weight))290 .saturating_add(RocksDbWeight::get().writes((3 as Weight).saturating_mul(b as Weight)))291 }292 // Storage: Refungible TotalSupply (r:1 w:1)293 // Storage: Refungible Balance (r:1 w:1)294 // Storage: Refungible AccountBalance (r:1 w:1)295 // Storage: Refungible Owned (r:0 w:1)296 fn burn_item_partial() -> Weight {297 (23_518_000 as Weight)298 .saturating_add(RocksDbWeight::get().reads(3 as Weight))299 .saturating_add(RocksDbWeight::get().writes(4 as Weight))300 }301 // Storage: Refungible TotalSupply (r:1 w:1)302 // Storage: Refungible Balance (r:1 w:1)303 // Storage: Refungible AccountBalance (r:1 w:1)304 // Storage: Refungible TokensBurnt (r:1 w:1)305 // Storage: Refungible TokenData (r:0 w:1)306 // Storage: Refungible Owned (r:0 w:1)307 fn burn_item_fully() -> Weight {308 (32_489_000 as Weight)309 .saturating_add(RocksDbWeight::get().reads(4 as Weight))310 .saturating_add(RocksDbWeight::get().writes(6 as Weight))311 }312313 fn set_token_properties(_amount: u32) -> Weight {314 // Error315 0316 }317318 fn delete_token_properties(_amount: u32) -> Weight {319 // Error320 0321 }322323 fn set_property_permissions(_amount: u32) -> Weight {324 // Error325 0326 }327328 // Storage: Refungible Balance (r:2 w:2)329 fn transfer_normal() -> Weight {330 (19_766_000 as Weight)331 .saturating_add(RocksDbWeight::get().reads(2 as Weight))332 .saturating_add(RocksDbWeight::get().writes(2 as Weight))333 }334 // Storage: Refungible Balance (r:2 w:2)335 // Storage: Refungible AccountBalance (r:1 w:1)336 // Storage: Refungible Owned (r:0 w:1)337 fn transfer_creating() -> Weight {338 (23_360_000 as Weight)339 .saturating_add(RocksDbWeight::get().reads(3 as Weight))340 .saturating_add(RocksDbWeight::get().writes(4 as Weight))341 }342 // Storage: Refungible Balance (r:2 w:2)343 // Storage: Refungible AccountBalance (r:1 w:1)344 // Storage: Refungible Owned (r:0 w:1)345 fn transfer_removing() -> Weight {346 (25_344_000 as Weight)347 .saturating_add(RocksDbWeight::get().reads(3 as Weight))348 .saturating_add(RocksDbWeight::get().writes(4 as Weight))349 }350 // Storage: Refungible Balance (r:2 w:2)351 // Storage: Refungible AccountBalance (r:2 w:2)352 // Storage: Refungible Owned (r:0 w:2)353 fn transfer_creating_removing() -> Weight {354 (28_553_000 as Weight)355 .saturating_add(RocksDbWeight::get().reads(4 as Weight))356 .saturating_add(RocksDbWeight::get().writes(6 as Weight))357 }358 // Storage: Refungible Balance (r:1 w:0)359 // Storage: Refungible Allowance (r:0 w:1)360 fn approve() -> Weight {361 (15_356_000 as Weight)362 .saturating_add(RocksDbWeight::get().reads(1 as Weight))363 .saturating_add(RocksDbWeight::get().writes(1 as Weight))364 }365 // Storage: Refungible Allowance (r:1 w:1)366 // Storage: Refungible Balance (r:2 w:2)367 fn transfer_from_normal() -> Weight {368 (28_832_000 as Weight)369 .saturating_add(RocksDbWeight::get().reads(3 as Weight))370 .saturating_add(RocksDbWeight::get().writes(3 as Weight))371 }372 // Storage: Refungible Allowance (r:1 w:1)373 // Storage: Refungible Balance (r:2 w:2)374 // Storage: Refungible AccountBalance (r:1 w:1)375 // Storage: Refungible Owned (r:0 w:1)376 fn transfer_from_creating() -> Weight {377 (32_132_000 as Weight)378 .saturating_add(RocksDbWeight::get().reads(4 as Weight))379 .saturating_add(RocksDbWeight::get().writes(5 as Weight))380 }381 // Storage: Refungible Allowance (r:1 w:1)382 // Storage: Refungible Balance (r:2 w:2)383 // Storage: Refungible AccountBalance (r:1 w:1)384 // Storage: Refungible Owned (r:0 w:1)385 fn transfer_from_removing() -> Weight {386 (33_237_000 as Weight)387 .saturating_add(RocksDbWeight::get().reads(4 as Weight))388 .saturating_add(RocksDbWeight::get().writes(5 as Weight))389 }390 // Storage: Refungible Allowance (r:1 w:1)391 // Storage: Refungible Balance (r:2 w:2)392 // Storage: Refungible AccountBalance (r:2 w:2)393 // Storage: Refungible Owned (r:0 w:2)394 fn transfer_from_creating_removing() -> Weight {395 (36_399_000 as Weight)396 .saturating_add(RocksDbWeight::get().reads(5 as Weight))397 .saturating_add(RocksDbWeight::get().writes(7 as Weight))398 }399 // Storage: Refungible Allowance (r:1 w:1)400 // Storage: Refungible TotalSupply (r:1 w:1)401 // Storage: Refungible Balance (r:1 w:1)402 // Storage: Refungible AccountBalance (r:1 w:1)403 // Storage: Refungible TokensBurnt (r:1 w:1)404 // Storage: Refungible TokenData (r:0 w:1)405 // Storage: Refungible Owned (r:0 w:1)406 fn burn_from() -> Weight {407 (42_043_000 as Weight)408 .saturating_add(RocksDbWeight::get().reads(5 as Weight))409 .saturating_add(RocksDbWeight::get().writes(7 as Weight))410 }411}pallets/unique/src/lib.rsdiffbeforeafterboth--- a/pallets/unique/src/lib.rs
+++ b/pallets/unique/src/lib.rs
@@ -670,9 +670,9 @@
dispatch_tx::<T, _>(collection_id, |d| d.delete_token_properties(sender, token_id, property_keys))
}
- #[weight = T::CommonWeightInfo::set_property_permissions(property_permissions.len() as u32)]
+ #[weight = T::CommonWeightInfo::set_token_property_permissions(property_permissions.len() as u32)]
#[transactional]
- pub fn set_property_permissions(
+ pub fn set_token_property_permissions(
origin,
collection_id: CollectionId,
property_permissions: Vec<PropertyKeyPermission>,
@@ -681,7 +681,7 @@
let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
- dispatch_tx::<T, _>(collection_id, |d| d.set_property_permissions(&sender, property_permissions))
+ dispatch_tx::<T, _>(collection_id, |d| d.set_token_property_permissions(&sender, property_permissions))
}
#[weight = T::CommonWeightInfo::create_multiple_items_ex(&data)]
runtime/common/src/weights.rsdiffbeforeafterboth--- a/runtime/common/src/weights.rs
+++ b/runtime/common/src/weights.rs
@@ -70,8 +70,8 @@
dispatch_weight::<T>() + max_weight_of!(delete_token_properties(amount))
}
- fn set_property_permissions(amount: u32) -> Weight {
- dispatch_weight::<T>() + max_weight_of!(set_property_permissions(amount))
+ fn set_token_property_permissions(amount: u32) -> Weight {
+ dispatch_weight::<T>() + max_weight_of!(set_token_property_permissions(amount))
}
fn transfer() -> Weight {
tests/src/createMultipleItems.test.tsdiffbeforeafterboth--- a/tests/src/createMultipleItems.test.ts
+++ b/tests/src/createMultipleItems.test.ts
@@ -48,7 +48,7 @@
const alice = privateKeyWrapper('//Alice');
await submitTransactionAsync(
alice,
- api.tx.unique.setPropertyPermissions(collectionId, [{key: 'data', permission: {tokenOwner: true}}]),
+ api.tx.unique.setTokenPropertyPermissions(collectionId, [{key: 'data', permission: {tokenOwner: true}}]),
);
const args = [
@@ -470,7 +470,7 @@
const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
- const tx1 = api.tx.unique.setPropertyPermissions(collectionId, propPerms);
+ const tx1 = api.tx.unique.setTokenPropertyPermissions(collectionId, propPerms);
await expect(executeTransaction(api, alice, tx1)).to.be.rejectedWith(/common\.PropertyLimitReached/);
const itemsListIndexBefore = await getLastTokenId(api, collectionId);
tests/src/createMultipleItemsEx.test.tsdiffbeforeafterboth--- a/tests/src/createMultipleItemsEx.test.ts
+++ b/tests/src/createMultipleItemsEx.test.ts
@@ -222,7 +222,7 @@
const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
await usingApi(async (api, privateKeyWrapper) => {
const alice = privateKeyWrapper('//Alice');
- await expect(executeTransaction(api, alice, api.tx.unique.setPropertyPermissions(collection, propPerms))).to.be.rejectedWith(/common\.PropertyLimitReached/);
+ await expect(executeTransaction(api, alice, api.tx.unique.setTokenPropertyPermissions(collection, propPerms))).to.be.rejectedWith(/common\.PropertyLimitReached/);
});
});
tests/src/eth/tokenProperties.test.tsdiffbeforeafterboth--- a/tests/src/eth/tokenProperties.test.ts
+++ b/tests/src/eth/tokenProperties.test.ts
@@ -29,7 +29,7 @@
const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
const token = await createItemExpectSuccess(alice, collection, 'NFT');
- await executeTransaction(api, alice, api.tx.unique.setPropertyPermissions(collection, [{
+ await executeTransaction(api, alice, api.tx.unique.setTokenPropertyPermissions(collection, [{
key: 'testKey',
permission: {
collectionAdmin: true,
@@ -52,7 +52,7 @@
const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
const token = await createItemExpectSuccess(alice, collection, 'NFT');
- await executeTransaction(api, alice, api.tx.unique.setPropertyPermissions(collection, [{
+ await executeTransaction(api, alice, api.tx.unique.setTokenPropertyPermissions(collection, [{
key: 'testKey',
permission: {
mutable: true,
@@ -77,7 +77,7 @@
const collection = await createCollectionExpectSuccess({mode: {type:'NFT'}});
const token = await createItemExpectSuccess(alice, collection, 'NFT');
- await executeTransaction(api, alice, api.tx.unique.setPropertyPermissions(collection, [{
+ await executeTransaction(api, alice, api.tx.unique.setTokenPropertyPermissions(collection, [{
key: 'testKey',
permission: {
collectionAdmin: true,
tests/src/nesting/properties.test.tsdiffbeforeafterboth--- a/tests/src/nesting/properties.test.ts
+++ b/tests/src/nesting/properties.test.ts
@@ -38,7 +38,7 @@
await expect(executeTransaction(
api,
alice,
- api.tx.unique.setPropertyPermissions(collectionId, propertyPermissions),
+ api.tx.unique.setTokenPropertyPermissions(collectionId, propertyPermissions),
)).to.not.be.rejected;
const collectionProperties = [
@@ -362,7 +362,7 @@
await expect(executeTransaction(
api,
alice,
- api.tx.unique.setPropertyPermissions(collection, [{key: 'skullduggery', permission: {mutable: true}}]),
+ api.tx.unique.setTokenPropertyPermissions(collection, [{key: 'skullduggery', permission: {mutable: true}}]),
)).to.not.be.rejected;
await addCollectionAdminExpectSuccess(alice, collection, bob.address);
@@ -370,7 +370,7 @@
await expect(executeTransaction(
api,
alice,
- api.tx.unique.setPropertyPermissions(collection, [{key: 'mindgame', permission: {collectionAdmin: true, tokenOwner: false}}]),
+ api.tx.unique.setTokenPropertyPermissions(collection, [{key: 'mindgame', permission: {collectionAdmin: true, tokenOwner: false}}]),
)).to.not.be.rejected;
const propertyRights = (await api.rpc.unique.propertyPermissions(collection, ['skullduggery', 'mindgame'])).toHuman();
@@ -388,13 +388,13 @@
await expect(executeTransaction(
api,
alice,
- api.tx.unique.setPropertyPermissions(collection, [{key: 'skullduggery', permission: {mutable: true, collectionAdmin: true}}]),
+ api.tx.unique.setTokenPropertyPermissions(collection, [{key: 'skullduggery', permission: {mutable: true, collectionAdmin: true}}]),
)).to.not.be.rejected;
await expect(executeTransaction(
api,
alice,
- api.tx.unique.setPropertyPermissions(collection, [{key: 'skullduggery', permission: {mutable: false, tokenOwner: true}}]),
+ api.tx.unique.setTokenPropertyPermissions(collection, [{key: 'skullduggery', permission: {mutable: false, tokenOwner: true}}]),
)).to.not.be.rejected;
const propertyRights = (await api.rpc.unique.propertyPermissions(collection, ['skullduggery'])).toHuman();
@@ -420,7 +420,7 @@
await expect(executeTransaction(
api,
bob,
- api.tx.unique.setPropertyPermissions(collection, [{key: 'skullduggery', permission: {mutable: true, tokenOwner: true}}]),
+ api.tx.unique.setTokenPropertyPermissions(collection, [{key: 'skullduggery', permission: {mutable: true, tokenOwner: true}}]),
)).to.be.rejectedWith(/common\.NoPermission/);
const propertyRights = (await api.rpc.unique.propertyPermissions(collection, ['skullduggery'])).toJSON();
@@ -443,7 +443,7 @@
await expect(executeTransaction(
api,
alice,
- api.tx.unique.setPropertyPermissions(collection, constitution),
+ api.tx.unique.setTokenPropertyPermissions(collection, constitution),
)).to.be.rejectedWith(/common\.PropertyLimitReached/);
const propertyRights = (await api.query.common.collectionPropertyPermissions(collection)).toJSON();
@@ -458,13 +458,13 @@
await expect(executeTransaction(
api,
alice,
- api.tx.unique.setPropertyPermissions(collection, [{key: 'skullduggery', permission: {mutable: false, tokenOwner: true}}]),
+ api.tx.unique.setTokenPropertyPermissions(collection, [{key: 'skullduggery', permission: {mutable: false, tokenOwner: true}}]),
)).to.not.be.rejected;
await expect(executeTransaction(
api,
alice,
- api.tx.unique.setPropertyPermissions(collection, [{key: 'skullduggery', permission: {}}]),
+ api.tx.unique.setTokenPropertyPermissions(collection, [{key: 'skullduggery', permission: {}}]),
)).to.be.rejectedWith(/common\.NoPermission/);
const propertyRights = (await api.rpc.unique.propertyPermissions(collection, ['skullduggery'])).toHuman();
@@ -488,21 +488,21 @@
await expect(executeTransaction(
api,
alice,
- api.tx.unique.setPropertyPermissions(collection, invalidProperties[i]),
+ api.tx.unique.setTokenPropertyPermissions(collection, invalidProperties[i]),
), `on setting the new badly-named property #${i}`).to.be.rejectedWith(/common\.InvalidCharacterInPropertyKey/);
}
await expect(executeTransaction(
api,
alice,
- api.tx.unique.setPropertyPermissions(collection, [{key: '', permission: {}}]),
+ api.tx.unique.setTokenPropertyPermissions(collection, [{key: '', permission: {}}]),
), 'on rejecting an unnamed property').to.be.rejectedWith(/common\.EmptyPropertyKey/);
const correctKey = '--0x03116e387820CA05'; // PolkadotJS would parse this as an already encoded hex-string
await expect(executeTransaction(
api,
alice,
- api.tx.unique.setPropertyPermissions(collection, [
+ api.tx.unique.setTokenPropertyPermissions(collection, [
{key: correctKey, permission: {collectionAdmin: true}},
]),
), 'on setting the correctly-but-still-badly-named property').to.not.be.rejected;
@@ -576,7 +576,7 @@
await expect(executeTransaction(
api,
alice,
- api.tx.unique.setPropertyPermissions(collection, [{key: key, permission: permission.permission}]),
+ api.tx.unique.setTokenPropertyPermissions(collection, [{key: key, permission: permission.permission}]),
), `on setting permission ${i} by ${signer.address}`).to.not.be.rejected;
await expect(executeTransaction(
@@ -612,7 +612,7 @@
await expect(executeTransaction(
api,
alice,
- api.tx.unique.setPropertyPermissions(collection, [{key: key, permission: permission.permission}]),
+ api.tx.unique.setTokenPropertyPermissions(collection, [{key: key, permission: permission.permission}]),
), `on setting permission ${i} by ${signer.address}`).to.not.be.rejected;
await expect(executeTransaction(
@@ -655,7 +655,7 @@
await expect(executeTransaction(
api,
alice,
- api.tx.unique.setPropertyPermissions(collection, [{key: key, permission: permission.permission}]),
+ api.tx.unique.setTokenPropertyPermissions(collection, [{key: key, permission: permission.permission}]),
), `on setting permission ${i} by ${signer.address}`).to.not.be.rejected;
await expect(executeTransaction(
@@ -721,7 +721,7 @@
await expect(executeTransaction(
api,
alice,
- api.tx.unique.setPropertyPermissions(collection, [{key: `${i}`, permission: passage.permission}]),
+ api.tx.unique.setTokenPropertyPermissions(collection, [{key: `${i}`, permission: passage.permission}]),
), `on setting permission ${i} by ${signer.address}`).to.not.be.rejected;
await expect(executeTransaction(
@@ -798,7 +798,7 @@
await expect(executeTransaction(
api,
alice,
- api.tx.unique.setPropertyPermissions(collection, [{key: 'now-existent', permission: {}}]),
+ api.tx.unique.setTokenPropertyPermissions(collection, [{key: 'now-existent', permission: {}}]),
), 'on setting a new non-permitted property').to.not.be.rejected;
await expect(executeTransaction(
@@ -818,7 +818,7 @@
await expect(executeTransaction(
api,
alice,
- api.tx.unique.setPropertyPermissions(collection, [
+ api.tx.unique.setTokenPropertyPermissions(collection, [
{key: 'a_holy_book', permission: {collectionAdmin: true, tokenOwner: true}},
{key: 'young_years', permission: {collectionAdmin: true, tokenOwner: true}},
]),
tests/src/rmrk/rmrk.test.tsdiffbeforeafterboth--- a/tests/src/rmrk/rmrk.test.ts
+++ b/tests/src/rmrk/rmrk.test.ts
@@ -129,8 +129,8 @@
await expect(executeTransaction(api, alice, txDeleteCollectionProperties), 'deleting collection properties')
.to.be.rejectedWith(/common\.CollectionIsExternal/);
- const txSetPropertyPermissions = api.tx.unique.setPropertyPermissions(uniqueCollectionId, [{key: 'a', permission: {mutable: true}}]);
- await expect(executeTransaction(api, alice, txSetPropertyPermissions), 'setting property permissions')
+ const txsetTokenPropertyPermissions = api.tx.unique.setTokenPropertyPermissions(uniqueCollectionId, [{key: 'a', permission: {mutable: true}}]);
+ await expect(executeTransaction(api, alice, txsetTokenPropertyPermissions), 'setting property permissions')
.to.be.rejectedWith(/common\.CollectionIsExternal/);
// NFT