difftreelog
Rename property change to set
in: master
11 files changed
pallets/common/src/lib.rsdiffbeforeafterboth--- a/pallets/common/src/lib.rs
+++ b/pallets/common/src/lib.rs
@@ -731,7 +731,7 @@
Ok(())
}
- pub fn change_collection_property(
+ pub fn set_collection_property(
collection: &CollectionHandle<T>,
sender: &T::CrossAccountId,
property: Property,
@@ -740,7 +740,7 @@
CollectionProperties::<T>::try_mutate(
collection.id,
- |properties| properties.try_change_property(property.clone())
+ |properties| properties.try_set_property(property.clone())
)?;
Self::deposit_event(Event::CollectionPropertySet(collection.id, property));
@@ -748,19 +748,19 @@
Ok(())
}
- pub fn change_collection_properties(
+ pub fn set_collection_properties(
collection: &CollectionHandle<T>,
sender: &T::CrossAccountId,
properties: Vec<Property>,
) -> DispatchResult {
for property in properties {
- Self::change_collection_property(collection, sender, property)?;
+ Self::set_collection_property(collection, sender, property)?;
}
Ok(())
}
- pub fn change_property_permission(
+ pub fn set_property_permission(
collection: &CollectionHandle<T>,
sender: &T::CrossAccountId,
property_permission: PropertyKeyPermission
@@ -784,13 +784,13 @@
Ok(())
}
- pub fn change_property_permissions(
+ pub fn set_property_permissions(
collection: &CollectionHandle<T>,
sender: &T::CrossAccountId,
property_permissions: Vec<PropertyKeyPermission>
) -> DispatchResult {
for prop_pemission in property_permissions {
- Self::change_property_permission(collection, sender, prop_pemission)?;
+ Self::set_property_permission(collection, sender, prop_pemission)?;
}
Ok(())
@@ -948,9 +948,9 @@
fn create_multiple_items(amount: u32) -> Weight;
fn create_multiple_items_ex(cost: &CreateItemExData<CrossAccountId>) -> Weight;
fn burn_item() -> Weight;
- fn change_collection_properties(amount: u32) -> Weight;
- fn change_token_properties(amount: u32) -> Weight;
- fn change_property_permissions(amount: u32) -> Weight;
+ fn set_collection_properties(amount: u32) -> Weight;
+ fn set_token_properties(amount: u32) -> Weight;
+ fn set_property_permissions(amount: u32) -> Weight;
fn transfer() -> Weight;
fn approve() -> Weight;
fn transfer_from() -> Weight;
@@ -985,18 +985,18 @@
token: TokenId,
amount: u128,
) -> DispatchResultWithPostInfo;
- fn change_collection_properties(
+ fn set_collection_properties(
&self,
sender: T::CrossAccountId,
properties: Vec<Property>,
) -> DispatchResultWithPostInfo;
- fn change_token_properties(
+ fn set_token_properties(
&self,
sender: T::CrossAccountId,
token_id: TokenId,
property: Vec<Property>,
) -> DispatchResultWithPostInfo;
- fn change_property_permissions(
+ fn set_property_permissions(
&self,
sender: &T::CrossAccountId,
property_permissions: Vec<PropertyKeyPermission>,
pallets/fungible/src/common.rsdiffbeforeafterboth1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use core::marker::PhantomData;1819use frame_support::{dispatch::DispatchResultWithPostInfo, ensure, fail, weights::Weight, BoundedVec};20use up_data_structs::{TokenId, CollectionId, CreateItemExData, budget::Budget};21use pallet_common::{CommonCollectionOperations, CommonWeightInfo, with_weight};22use sp_runtime::ArithmeticError;23use sp_std::{vec::Vec, vec};24use up_data_structs::{CustomDataLimit, Property, PropertyKeyPermission,};2526use crate::{27 Allowance, Balance, Config, Error, FungibleHandle, Pallet, SelfWeightOf, weights::WeightInfo,28};2930pub struct CommonWeights<T: Config>(PhantomData<T>);31impl<T: Config> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T> {32 fn create_item() -> Weight {33 <SelfWeightOf<T>>::create_item()34 }3536 fn create_multiple_items(_amount: u32) -> Weight {37 Self::create_item()38 }3940 fn create_multiple_items_ex(data: &CreateItemExData<T::CrossAccountId>) -> Weight {41 match data {42 CreateItemExData::Fungible(f) => {43 <SelfWeightOf<T>>::create_multiple_items_ex(f.len() as u32)44 }45 _ => 0,46 }47 }4849 fn burn_item() -> Weight {50 <SelfWeightOf<T>>::burn_item()51 }5253 fn change_collection_properties(amount: u32) -> Weight {54 <SelfWeightOf<T>>::change_collection_properties(amount)55 }5657 fn change_token_properties(amount: u32) -> Weight {58 <SelfWeightOf<T>>::change_token_properties(amount)59 }6061 fn change_property_permissions(amount: u32) -> Weight {62 <SelfWeightOf<T>>::change_property_permissions(amount)63 }6465 fn transfer() -> Weight {66 <SelfWeightOf<T>>::transfer()67 }6869 fn approve() -> Weight {70 <SelfWeightOf<T>>::approve()71 }7273 fn transfer_from() -> Weight {74 <SelfWeightOf<T>>::transfer_from()75 }7677 fn burn_from() -> Weight {78 <SelfWeightOf<T>>::burn_from()79 }8081 fn set_variable_metadata(_bytes: u32) -> Weight {82 // Error83 084 }85}8687impl<T: Config> CommonCollectionOperations<T> for FungibleHandle<T> {88 fn create_item(89 &self,90 sender: T::CrossAccountId,91 to: T::CrossAccountId,92 data: up_data_structs::CreateItemData,93 nesting_budget: &dyn Budget,94 ) -> DispatchResultWithPostInfo {95 match data {96 up_data_structs::CreateItemData::Fungible(data) => with_weight(97 <Pallet<T>>::create_item(self, &sender, (to, data.value), nesting_budget),98 <CommonWeights<T>>::create_item(),99 ),100 _ => fail!(<Error<T>>::NotFungibleDataUsedToMintFungibleCollectionToken),101 }102 }103104 fn create_multiple_items(105 &self,106 sender: T::CrossAccountId,107 to: T::CrossAccountId,108 data: Vec<up_data_structs::CreateItemData>,109 nesting_budget: &dyn Budget,110 ) -> DispatchResultWithPostInfo {111 let mut sum: u128 = 0;112 for data in data {113 match data {114 up_data_structs::CreateItemData::Fungible(data) => {115 sum = sum116 .checked_add(data.value)117 .ok_or(ArithmeticError::Overflow)?;118 }119 _ => fail!(<Error<T>>::NotFungibleDataUsedToMintFungibleCollectionToken),120 }121 }122123 with_weight(124 <Pallet<T>>::create_item(self, &sender, (to, sum), nesting_budget),125 <CommonWeights<T>>::create_item(),126 )127 }128129 fn create_multiple_items_ex(130 &self,131 sender: <T>::CrossAccountId,132 data: up_data_structs::CreateItemExData<<T>::CrossAccountId>,133 nesting_budget: &dyn Budget,134 ) -> DispatchResultWithPostInfo {135 let weight = <CommonWeights<T>>::create_multiple_items_ex(&data);136 let data = match data {137 up_data_structs::CreateItemExData::Fungible(f) => f,138 _ => fail!(<Error<T>>::NotFungibleDataUsedToMintFungibleCollectionToken),139 };140141 with_weight(142 <Pallet<T>>::create_multiple_items(self, &sender, data.into_inner(), nesting_budget),143 weight,144 )145 }146147 fn burn_item(148 &self,149 sender: T::CrossAccountId,150 token: TokenId,151 amount: u128,152 ) -> DispatchResultWithPostInfo {153 ensure!(154 token == TokenId::default(),155 <Error<T>>::FungibleItemsHaveNoId156 );157158 with_weight(159 <Pallet<T>>::burn(self, &sender, amount),160 <CommonWeights<T>>::burn_item(),161 )162 }163164 fn transfer(165 &self,166 from: T::CrossAccountId,167 to: T::CrossAccountId,168 token: TokenId,169 amount: u128,170 nesting_budget: &dyn Budget,171 ) -> DispatchResultWithPostInfo {172 ensure!(173 token == TokenId::default(),174 <Error<T>>::FungibleItemsHaveNoId175 );176177 with_weight(178 <Pallet<T>>::transfer(self, &from, &to, amount, nesting_budget),179 <CommonWeights<T>>::transfer(),180 )181 }182183 fn approve(184 &self,185 sender: T::CrossAccountId,186 spender: T::CrossAccountId,187 token: TokenId,188 amount: u128,189 ) -> DispatchResultWithPostInfo {190 ensure!(191 token == TokenId::default(),192 <Error<T>>::FungibleItemsHaveNoId193 );194195 with_weight(196 <Pallet<T>>::set_allowance(self, &sender, &spender, amount),197 <CommonWeights<T>>::approve(),198 )199 }200201 fn transfer_from(202 &self,203 sender: T::CrossAccountId,204 from: T::CrossAccountId,205 to: T::CrossAccountId,206 token: TokenId,207 amount: u128,208 nesting_budget: &dyn Budget,209 ) -> DispatchResultWithPostInfo {210 ensure!(211 token == TokenId::default(),212 <Error<T>>::FungibleItemsHaveNoId213 );214215 with_weight(216 <Pallet<T>>::transfer_from(self, &sender, &from, &to, amount, nesting_budget),217 <CommonWeights<T>>::transfer_from(),218 )219 }220221 fn burn_from(222 &self,223 sender: T::CrossAccountId,224 from: T::CrossAccountId,225 token: TokenId,226 amount: u128,227 nesting_budget: &dyn Budget,228 ) -> DispatchResultWithPostInfo {229 ensure!(230 token == TokenId::default(),231 <Error<T>>::FungibleItemsHaveNoId232 );233234 with_weight(235 <Pallet<T>>::burn_from(self, &sender, &from, amount, nesting_budget),236 <CommonWeights<T>>::burn_from(),237 )238 }239240 fn change_collection_properties(241 &self,242 _sender: T::CrossAccountId,243 _property: Vec<Property>,244 ) -> DispatchResultWithPostInfo {245 fail!(<Error<T>>::PropertiesNotAllowed)246 }247248 fn change_token_properties(249 &self,250 _sender: T::CrossAccountId,251 _token_id: TokenId,252 _property: Vec<Property>,253 ) -> DispatchResultWithPostInfo {254 fail!(<Error<T>>::PropertiesNotAllowed)255 }256257 fn change_property_permissions(258 &self,259 _sender: &T::CrossAccountId,260 _property_permissions: Vec<PropertyKeyPermission>,261 ) -> DispatchResultWithPostInfo {262 fail!(<Error<T>>::PropertiesNotAllowed)263 }264265 fn set_variable_metadata(266 &self,267 _sender: T::CrossAccountId,268 _token: TokenId,269 _data: BoundedVec<u8, CustomDataLimit>,270 ) -> DispatchResultWithPostInfo {271 fail!(<Error<T>>::FungibleItemsDontHaveData)272 }273274 fn check_nesting(275 &self,276 _sender: <T>::CrossAccountId,277 _from: (CollectionId, TokenId),278 _under: TokenId,279 _budget: &dyn Budget,280 ) -> sp_runtime::DispatchResult {281 fail!(<Error<T>>::FungibleDisallowsNesting)282 }283284 fn collection_tokens(&self) -> Vec<TokenId> {285 vec![TokenId::default()]286 }287288 fn account_tokens(&self, account: T::CrossAccountId) -> Vec<TokenId> {289 if <Balance<T>>::get((self.id, account)) != 0 {290 vec![TokenId::default()]291 } else {292 vec![]293 }294 }295296 fn token_exists(&self, token: TokenId) -> bool {297 token == TokenId::default()298 }299300 fn last_token_id(&self) -> TokenId {301 TokenId::default()302 }303304 fn token_owner(&self, _token: TokenId) -> Option<T::CrossAccountId> {305 None306 }307 fn const_metadata(&self, _token: TokenId) -> Vec<u8> {308 Vec::new()309 }310 fn variable_metadata(&self, _token: TokenId) -> Vec<u8> {311 Vec::new()312 }313314 fn total_supply(&self) -> u32 {315 1316 }317318 fn account_balance(&self, account: T::CrossAccountId) -> u32 {319 if <Balance<T>>::get((self.id, account)) != 0 {320 1321 } else {322 0323 }324 }325326 fn balance(&self, account: T::CrossAccountId, token: TokenId) -> u128 {327 if token != TokenId::default() {328 return 0;329 }330 <Balance<T>>::get((self.id, account))331 }332333 fn allowance(334 &self,335 sender: T::CrossAccountId,336 spender: T::CrossAccountId,337 token: TokenId,338 ) -> u128 {339 if token != TokenId::default() {340 return 0;341 }342 <Allowance<T>>::get((self.id, sender, spender))343 }344}pallets/fungible/src/weights.rsdiffbeforeafterboth--- a/pallets/fungible/src/weights.rs
+++ b/pallets/fungible/src/weights.rs
@@ -35,9 +35,9 @@
fn create_item() -> Weight;
fn create_multiple_items_ex(b: u32, ) -> Weight;
fn burn_item() -> Weight;
- fn change_collection_properties(amount: u32) -> Weight;
- fn change_token_properties(amount: u32) -> Weight;
- fn change_property_permissions(amount: u32) -> Weight;
+ fn set_collection_properties(amount: u32) -> Weight;
+ fn set_token_properties(amount: u32) -> Weight;
+ fn set_property_permissions(amount: u32) -> Weight;
fn transfer() -> Weight;
fn approve() -> Weight;
fn transfer_from() -> Weight;
@@ -73,17 +73,17 @@
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
- fn change_collection_properties(amount: u32) -> Weight {
+ fn set_collection_properties(amount: u32) -> Weight {
// Error
0
}
- fn change_token_properties(amount: u32) -> Weight {
+ fn set_token_properties(amount: u32) -> Weight {
// Error
0
}
- fn change_property_permissions(amount: u32) -> Weight {
+ fn set_property_permissions(amount: u32) -> Weight {
// Error
0
}
@@ -146,17 +146,17 @@
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
}
- fn change_collection_properties(amount: u32) -> Weight {
+ fn set_collection_properties(amount: u32) -> Weight {
// Error
0
}
- fn change_token_properties(amount: u32) -> Weight {
+ fn set_token_properties(amount: u32) -> Weight {
// Error
0
}
- fn change_property_permissions(amount: u32) -> Weight {
+ fn set_property_permissions(amount: u32) -> Weight {
// Error
0
}
pallets/nonfungible/src/common.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/common.rs
+++ b/pallets/nonfungible/src/common.rs
@@ -50,16 +50,16 @@
<SelfWeightOf<T>>::burn_item()
}
- fn change_collection_properties(amount: u32) -> Weight {
- <SelfWeightOf<T>>::change_collection_properties(amount)
+ fn set_collection_properties(amount: u32) -> Weight {
+ <SelfWeightOf<T>>::set_collection_properties(amount)
}
- fn change_token_properties(amount: u32) -> Weight {
- <SelfWeightOf<T>>::change_token_properties(amount)
+ fn set_token_properties(amount: u32) -> Weight {
+ <SelfWeightOf<T>>::set_token_properties(amount)
}
- fn change_property_permissions(amount: u32) -> Weight {
- <SelfWeightOf<T>>::change_property_permissions(amount)
+ fn set_property_permissions(amount: u32) -> Weight {
+ <SelfWeightOf<T>>::set_property_permissions(amount)
}
fn transfer() -> Weight {
@@ -153,42 +153,42 @@
)
}
- fn change_collection_properties(
+ fn set_collection_properties(
&self,
sender: T::CrossAccountId,
properties: Vec<Property>,
) -> DispatchResultWithPostInfo {
- let weight = <CommonWeights<T>>::change_collection_properties(properties.len() as u32);
+ let weight = <CommonWeights<T>>::set_collection_properties(properties.len() as u32);
with_weight(
- <Pallet<T>>::change_collection_properties(self, &sender, properties),
+ <Pallet<T>>::set_collection_properties(self, &sender, properties),
weight
)
}
- fn change_token_properties(
+ fn set_token_properties(
&self,
sender: T::CrossAccountId,
token_id: TokenId,
properties: Vec<Property>,
) -> DispatchResultWithPostInfo {
- let weight = <CommonWeights<T>>::change_token_properties(properties.len() as u32);
+ let weight = <CommonWeights<T>>::set_token_properties(properties.len() as u32);
with_weight(
- <Pallet<T>>::change_token_properties(self, &sender, token_id, properties),
+ <Pallet<T>>::set_token_properties(self, &sender, token_id, properties),
weight
)
}
- fn change_property_permissions(
+ fn set_property_permissions(
&self,
sender: &T::CrossAccountId,
property_permissions: Vec<PropertyKeyPermission>,
) -> DispatchResultWithPostInfo {
- let weight = <CommonWeights<T>>::change_property_permissions(property_permissions.len() as u32);
+ let weight = <CommonWeights<T>>::set_property_permissions(property_permissions.len() as u32);
with_weight(
- <Pallet<T>>::change_property_permissions(self, sender, property_permissions),
+ <Pallet<T>>::set_property_permissions(self, sender, property_permissions),
weight
)
}
pallets/nonfungible/src/lib.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/lib.rs
+++ b/pallets/nonfungible/src/lib.rs
@@ -255,7 +255,7 @@
Ok(())
}
- pub fn change_token_property(
+ pub fn set_token_property(
collection: &NonfungibleHandle<T>,
sender: &T::CrossAccountId,
token_id: TokenId,
@@ -292,7 +292,7 @@
}
<TokenProperties<T>>::try_mutate((collection.id, token_id), |properties| {
- properties.try_change_property(property.clone())
+ properties.try_set_property(property.clone())
})?;
<PalletCommon<T>>::deposit_event(CommonEvent::TokenPropertySet(
@@ -304,33 +304,33 @@
Ok(())
}
- pub fn change_token_properties(
+ pub fn set_token_properties(
collection: &NonfungibleHandle<T>,
sender: &T::CrossAccountId,
token_id: TokenId,
properties: Vec<Property>,
) -> DispatchResult {
for property in properties {
- Self::change_token_property(collection, sender, token_id, property)?;
+ Self::set_token_property(collection, sender, token_id, property)?;
}
Ok(())
}
- pub fn change_collection_properties(
+ pub fn set_collection_properties(
collection: &NonfungibleHandle<T>,
sender: &T::CrossAccountId,
properties: Vec<Property>,
) -> DispatchResult {
- <PalletCommon<T>>::change_collection_properties(collection, sender, properties)
+ <PalletCommon<T>>::set_collection_properties(collection, sender, properties)
}
- pub fn change_property_permissions(
+ pub fn set_property_permissions(
collection: &CollectionHandle<T>,
sender: &T::CrossAccountId,
property_permissions: Vec<PropertyKeyPermission>
) -> DispatchResult {
- <PalletCommon<T>>::change_property_permissions(
+ <PalletCommon<T>>::set_property_permissions(
collection,
sender,
property_permissions,
pallets/nonfungible/src/weights.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/weights.rs
+++ b/pallets/nonfungible/src/weights.rs
@@ -36,9 +36,9 @@
fn create_multiple_items(b: u32, ) -> Weight;
fn create_multiple_items_ex(b: u32, ) -> Weight;
fn burn_item() -> Weight;
- fn change_collection_properties(amount: u32) -> Weight;
- fn change_token_properties(amount: u32) -> Weight;
- fn change_property_permissions(amount: u32) -> Weight;
+ fn set_collection_properties(amount: u32) -> Weight;
+ fn set_token_properties(amount: u32) -> Weight;
+ fn set_property_permissions(amount: u32) -> Weight;
fn transfer() -> Weight;
fn approve() -> Weight;
fn transfer_from() -> Weight;
@@ -94,17 +94,17 @@
.saturating_add(T::DbWeight::get().writes(4 as Weight))
}
- fn change_collection_properties(amount: u32) -> Weight {
+ fn set_collection_properties(amount: u32) -> Weight {
// TODO calculate appropriate weight
(50_000_000 as Weight).saturating_mul(amount as Weight)
}
- fn change_token_properties(amount: u32) -> Weight {
+ fn set_token_properties(amount: u32) -> Weight {
// TODO calculate appropriate weight
(50_000_000 as Weight).saturating_mul(amount as Weight)
}
- fn change_property_permissions(amount: u32) -> Weight {
+ fn set_property_permissions(amount: u32) -> Weight {
// TODO calculate appropriate weight
(50_000_000 as Weight).saturating_mul(amount as Weight)
}
@@ -199,17 +199,17 @@
.saturating_add(RocksDbWeight::get().writes(4 as Weight))
}
- fn change_collection_properties(amount: u32) -> Weight {
+ fn set_collection_properties(amount: u32) -> Weight {
// TODO calculate appropriate weight
(50_000_000 as Weight).saturating_mul(amount as Weight)
}
- fn change_token_properties(amount: u32) -> Weight {
+ fn set_token_properties(amount: u32) -> Weight {
// TODO calculate appropriate weight
(50_000_000 as Weight).saturating_mul(amount as Weight)
}
- fn change_property_permissions(amount: u32) -> Weight {
+ fn set_property_permissions(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
@@ -66,16 +66,16 @@
max_weight_of!(burn_item_partial(), burn_item_fully())
}
- fn change_collection_properties(amount: u32) -> Weight {
- <SelfWeightOf<T>>::change_collection_properties(amount)
+ fn set_collection_properties(amount: u32) -> Weight {
+ <SelfWeightOf<T>>::set_collection_properties(amount)
}
- fn change_token_properties(amount: u32) -> Weight {
- <SelfWeightOf<T>>::change_token_properties(amount)
+ fn set_token_properties(amount: u32) -> Weight {
+ <SelfWeightOf<T>>::set_token_properties(amount)
}
- fn change_property_permissions(amount: u32) -> Weight {
- <SelfWeightOf<T>>::change_property_permissions(amount)
+ fn set_property_permissions(amount: u32) -> Weight {
+ <SelfWeightOf<T>>::set_property_permissions(amount)
}
fn transfer() -> Weight {
@@ -256,7 +256,7 @@
)
}
- fn change_collection_properties(
+ fn set_collection_properties(
&self,
_sender: T::CrossAccountId,
_property: Vec<Property>,
@@ -264,7 +264,7 @@
fail!(<Error<T>>::PropertiesNotAllowed)
}
- fn change_token_properties(
+ fn set_token_properties(
&self,
_sender: T::CrossAccountId,
_token_id: TokenId,
@@ -273,7 +273,7 @@
fail!(<Error<T>>::PropertiesNotAllowed)
}
- fn change_property_permissions(
+ fn set_property_permissions(
&self,
_sender: &T::CrossAccountId,
_property_permissions: Vec<PropertyKeyPermission>,
pallets/refungible/src/weights.rsdiffbeforeafterboth--- a/pallets/refungible/src/weights.rs
+++ b/pallets/refungible/src/weights.rs
@@ -38,9 +38,9 @@
fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight;
fn burn_item_partial() -> Weight;
fn burn_item_fully() -> Weight;
- fn change_collection_properties(amount: u32) -> Weight;
- fn change_token_properties(amount: u32) -> Weight;
- fn change_property_permissions(amount: u32) -> Weight;
+ fn set_collection_properties(amount: u32) -> Weight;
+ fn set_token_properties(amount: u32) -> Weight;
+ fn set_property_permissions(amount: u32) -> Weight;
fn transfer_normal() -> Weight;
fn transfer_creating() -> Weight;
fn transfer_removing() -> Weight;
@@ -133,17 +133,17 @@
.saturating_add(T::DbWeight::get().writes(6 as Weight))
}
- fn change_collection_properties(amount: u32) -> Weight {
+ fn set_collection_properties(amount: u32) -> Weight {
// Error
0
}
- fn change_token_properties(amount: u32) -> Weight {
+ fn set_token_properties(amount: u32) -> Weight {
// Error
0
}
- fn change_property_permissions(amount: u32) -> Weight {
+ fn set_property_permissions(amount: u32) -> Weight {
// Error
0
}
@@ -317,17 +317,17 @@
.saturating_add(RocksDbWeight::get().writes(6 as Weight))
}
- fn change_collection_properties(amount: u32) -> Weight {
+ fn set_collection_properties(amount: u32) -> Weight {
// Error
0
}
- fn change_token_properties(amount: u32) -> Weight {
+ fn set_token_properties(amount: u32) -> Weight {
// Error
0
}
- fn change_property_permissions(amount: u32) -> Weight {
+ fn set_property_permissions(amount: u32) -> Weight {
// Error
0
}
pallets/unique/src/lib.rsdiffbeforeafterboth--- a/pallets/unique/src/lib.rs
+++ b/pallets/unique/src/lib.rs
@@ -694,9 +694,9 @@
dispatch_call::<T, _>(collection_id, |d| d.create_multiple_items(sender, owner, items_data, &budget))
}
- #[weight = T::CommonWeightInfo::change_collection_properties(properties.len() as u32)]
+ #[weight = T::CommonWeightInfo::set_collection_properties(properties.len() as u32)]
#[transactional]
- pub fn change_collection_properties(
+ pub fn set_collection_properties(
origin,
collection_id: CollectionId,
properties: Vec<Property>
@@ -705,12 +705,12 @@
let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
- dispatch_call::<T, _>(collection_id, |d| d.change_collection_properties(sender, properties))
+ dispatch_call::<T, _>(collection_id, |d| d.set_collection_properties(sender, properties))
}
- #[weight = T::CommonWeightInfo::change_token_properties(properties.len() as u32)]
+ #[weight = T::CommonWeightInfo::set_token_properties(properties.len() as u32)]
#[transactional]
- pub fn change_token_properties(
+ pub fn set_token_properties(
origin,
collection_id: CollectionId,
token_id: TokenId,
@@ -720,12 +720,12 @@
let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
- dispatch_call::<T, _>(collection_id, |d| d.change_token_properties(sender, token_id, properties))
+ dispatch_call::<T, _>(collection_id, |d| d.set_token_properties(sender, token_id, properties))
}
- #[weight = T::CommonWeightInfo::change_property_permissions(property_permissions.len() as u32)]
+ #[weight = T::CommonWeightInfo::set_property_permissions(property_permissions.len() as u32)]
#[transactional]
- pub fn change_property_permissions(
+ pub fn set_property_permissions(
origin,
collection_id: CollectionId,
property_permissions: Vec<PropertyKeyPermission>,
@@ -734,7 +734,7 @@
let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
- dispatch_call::<T, _>(collection_id, |d| d.change_property_permissions(&sender, property_permissions))
+ dispatch_call::<T, _>(collection_id, |d| d.set_property_permissions(&sender, property_permissions))
}
#[weight = T::CommonWeightInfo::create_multiple_items_ex(&data)]
primitives/data-structs/src/lib.rsdiffbeforeafterboth--- a/primitives/data-structs/src/lib.rs
+++ b/primitives/data-structs/src/lib.rs
@@ -698,13 +698,13 @@
let mut props = Self::new(MAX_COLLECTION_PROPERTIES_SIZE);
for property in data.into_iter() {
- props.try_change_property(property)?;
+ props.try_set_property(property)?;
}
Ok(props)
}
- pub fn try_change_property(&mut self, property: Property) -> Result<(), PropertiesError> {
+ pub fn try_set_property(&mut self, property: Property) -> Result<(), PropertiesError> {
let value_len = property.value.len();
if self.consumed_space as usize + value_len > self.space_limit as usize {
@@ -740,17 +740,3 @@
Properties::new(MAX_TOKEN_PROPERTIES_SIZE)
}
}
-
-// #[cfg(not(feature = "std"))]
-// fn properties_map_debug(_properties: &PropertiesMap, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
-// write!(f, "<properties>")
-// }
-
-// #[cfg(not(feature = "std"))]
-// fn opt_properties_permissions_map_debug(properties: &Option<PropertiesPermissionMap>, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
-// if properties.is_some() {
-// write!(f, "Some(<properties permissions>)")
-// } else {
-// write!(f, "None")
-// }
-// }
runtime/common/src/weights.rsdiffbeforeafterboth--- a/runtime/common/src/weights.rs
+++ b/runtime/common/src/weights.rs
@@ -54,16 +54,16 @@
dispatch_weight::<T>() + max_weight_of!(burn_item())
}
- fn change_collection_properties(amount: u32) -> Weight {
- dispatch_weight::<T>() + max_weight_of!(change_collection_properties(amount))
+ fn set_collection_properties(amount: u32) -> Weight {
+ dispatch_weight::<T>() + max_weight_of!(set_collection_properties(amount))
}
- fn change_token_properties(amount: u32) -> Weight {
- dispatch_weight::<T>() + max_weight_of!(change_token_properties(amount))
+ fn set_token_properties(amount: u32) -> Weight {
+ dispatch_weight::<T>() + max_weight_of!(set_token_properties(amount))
}
- fn change_property_permissions(amount: u32) -> Weight {
- dispatch_weight::<T>() + max_weight_of!(change_property_permissions(amount))
+ fn set_property_permissions(amount: u32) -> Weight {
+ dispatch_weight::<T>() + max_weight_of!(set_property_permissions(amount))
}
fn transfer() -> Weight {