difftreelog
Merge branch 'develop' into feature/CORE-302-ss58Format
in: master
17 files changed
pallets/common/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/common/src/benchmarking.rs
+++ b/pallets/common/src/benchmarking.rs
@@ -20,8 +20,8 @@
use frame_benchmarking::{benchmarks, account};
use up_data_structs::{
CollectionMode, CreateCollectionData, CollectionId, Property, PropertyKey, PropertyValue,
- MAX_COLLECTION_NAME_LENGTH, MAX_COLLECTION_DESCRIPTION_LENGTH, MAX_TOKEN_PREFIX_LENGTH,
- OFFCHAIN_SCHEMA_LIMIT, CONST_ON_CHAIN_SCHEMA_LIMIT, MAX_PROPERTIES_PER_ITEM,
+ CollectionPermissions, NestingRule, MAX_COLLECTION_NAME_LENGTH,
+ MAX_COLLECTION_DESCRIPTION_LENGTH, MAX_TOKEN_PREFIX_LENGTH, MAX_PROPERTIES_PER_ITEM,
};
use frame_support::{
traits::{Currency, Get},
@@ -74,15 +74,15 @@
}
pub fn create_collection_raw<T: Config, R>(
- owner: T::AccountId,
+ owner: T::CrossAccountId,
mode: CollectionMode,
handler: impl FnOnce(
- T::AccountId,
+ T::CrossAccountId,
CreateCollectionData<T::AccountId>,
) -> Result<CollectionId, DispatchError>,
cast: impl FnOnce(CollectionHandle<T>) -> R,
) -> Result<R, DispatchError> {
- T::Currency::deposit_creating(&owner, T::CollectionCreationPrice::get());
+ <T as Config>::Currency::deposit_creating(&owner.as_sub(), T::CollectionCreationPrice::get());
let name = create_u16_data::<MAX_COLLECTION_NAME_LENGTH>();
let description = create_u16_data::<MAX_COLLECTION_DESCRIPTION_LENGTH>();
let token_prefix = create_data::<MAX_TOKEN_PREFIX_LENGTH>();
@@ -93,13 +93,19 @@
name,
description,
token_prefix,
+ permissions: Some(CollectionPermissions {
+ nesting: Some(NestingRule::Permissive),
+ ..Default::default()
+ }),
..Default::default()
},
)
.and_then(CollectionHandle::try_get)
.map(cast)
}
-fn create_collection<T: Config>(owner: T::AccountId) -> Result<CollectionHandle<T>, DispatchError> {
+fn create_collection<T: Config>(
+ owner: T::CrossAccountId,
+) -> Result<CollectionHandle<T>, DispatchError> {
create_collection_raw(
owner,
CollectionMode::NFT,
@@ -127,7 +133,7 @@
bench_init!($($rest)*);
};
($name:ident: collection($owner:ident); $($rest:tt)*) => {
- let $name = create_collection::<T>($owner.clone())?;
+ let $name = create_collection::<T>(T::CrossAccountId::from_sub($owner.clone()))?;
bench_init!($($rest)*);
};
($name:ident: cross; $($rest:tt)*) => {
pallets/common/src/lib.rsdiffbeforeafterboth--- a/pallets/common/src/lib.rs
+++ b/pallets/common/src/lib.rs
@@ -1168,8 +1168,9 @@
);
Ok(new_limit)
}
+
pub fn clamp_permissions(
- mode: CollectionMode,
+ _mode: CollectionMode,
old_limit: &CollectionPermissions,
mut new_limit: CollectionPermissions,
) -> Result<CollectionPermissions, DispatchError> {
@@ -1204,6 +1205,22 @@
fn approve() -> Weight;
fn transfer_from() -> Weight;
fn burn_from() -> Weight;
+
+ /// Differs from burn_item in case of Fungible and Refungible, as it should burn
+ /// whole users's balance
+ ///
+ /// This method shouldn't be used directly, as it doesn't count breadth price, use `burn_recursively` instead
+ fn burn_recursively_self_raw() -> Weight;
+ /// Cost of iterating over `amount` children while burning, without counting child burning itself
+ ///
+ /// This method shouldn't be used directly, as it doesn't count depth price, use `burn_recursively` instead
+ fn burn_recursively_breadth_raw(amount: u32) -> Weight;
+
+ fn burn_recursively(max_selfs: u32, max_breadth: u32) -> Weight {
+ Self::burn_recursively_self_raw()
+ .saturating_mul(max_selfs.max(1) as u64)
+ .saturating_add(Self::burn_recursively_breadth_raw(max_breadth))
+ }
}
pub trait CommonCollectionOperations<T: Config> {
@@ -1233,6 +1250,13 @@
token: TokenId,
amount: u128,
) -> DispatchResultWithPostInfo;
+ fn burn_item_recursively(
+ &self,
+ sender: T::CrossAccountId,
+ token: TokenId,
+ self_budget: &dyn Budget,
+ breadth_budget: &dyn Budget,
+ ) -> DispatchResultWithPostInfo;
fn set_collection_properties(
&self,
sender: T::CrossAccountId,
pallets/fungible/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/fungible/src/benchmarking.rs
+++ b/pallets/fungible/src/benchmarking.rs
@@ -25,7 +25,9 @@
const SEED: u32 = 1;
-fn create_collection<T: Config>(owner: T::AccountId) -> Result<FungibleHandle<T>, DispatchError> {
+fn create_collection<T: Config>(
+ owner: T::CrossAccountId,
+) -> Result<FungibleHandle<T>, DispatchError> {
create_collection_raw(
owner,
CollectionMode::Fungible(0),
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};20use up_data_structs::{TokenId, CollectionId, CreateItemExData, budget::Budget, CreateItemData};21use pallet_common::{CommonCollectionOperations, CommonWeightInfo, with_weight};22use sp_runtime::ArithmeticError;23use sp_std::{vec::Vec, vec};24use up_data_structs::{Property, PropertyKey, PropertyValue, 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(_data: &[CreateItemData]) -> Weight {37 // All items minted for the same user, so it works same as create_item38 Self::create_item()39 }4041 fn create_multiple_items_ex(data: &CreateItemExData<T::CrossAccountId>) -> Weight {42 match data {43 CreateItemExData::Fungible(f) => {44 <SelfWeightOf<T>>::create_multiple_items_ex(f.len() as u32)45 }46 _ => 0,47 }48 }4950 fn burn_item() -> Weight {51 <SelfWeightOf<T>>::burn_item()52 }5354 fn set_collection_properties(_amount: u32) -> Weight {55 // Error56 057 }5859 fn delete_collection_properties(_amount: u32) -> Weight {60 // Error61 062 }6364 fn set_token_properties(_amount: u32) -> Weight {65 // Error66 067 }6869 fn delete_token_properties(_amount: u32) -> Weight {70 // Error71 072 }7374 fn set_property_permissions(_amount: u32) -> Weight {75 // Error76 077 }7879 fn transfer() -> Weight {80 <SelfWeightOf<T>>::transfer()81 }8283 fn approve() -> Weight {84 <SelfWeightOf<T>>::approve()85 }8687 fn transfer_from() -> Weight {88 <SelfWeightOf<T>>::transfer_from()89 }9091 fn burn_from() -> Weight {92 <SelfWeightOf<T>>::burn_from()93 }94}9596impl<T: Config> CommonCollectionOperations<T> for FungibleHandle<T> {97 fn create_item(98 &self,99 sender: T::CrossAccountId,100 to: T::CrossAccountId,101 data: up_data_structs::CreateItemData,102 nesting_budget: &dyn Budget,103 ) -> DispatchResultWithPostInfo {104 match data {105 up_data_structs::CreateItemData::Fungible(data) => with_weight(106 <Pallet<T>>::create_item(self, &sender, (to, data.value), nesting_budget),107 <CommonWeights<T>>::create_item(),108 ),109 _ => fail!(<Error<T>>::NotFungibleDataUsedToMintFungibleCollectionToken),110 }111 }112113 fn create_multiple_items(114 &self,115 sender: T::CrossAccountId,116 to: T::CrossAccountId,117 data: Vec<up_data_structs::CreateItemData>,118 nesting_budget: &dyn Budget,119 ) -> DispatchResultWithPostInfo {120 let mut sum: u128 = 0;121 for data in data {122 match data {123 up_data_structs::CreateItemData::Fungible(data) => {124 sum = sum125 .checked_add(data.value)126 .ok_or(ArithmeticError::Overflow)?;127 }128 _ => fail!(<Error<T>>::NotFungibleDataUsedToMintFungibleCollectionToken),129 }130 }131132 with_weight(133 <Pallet<T>>::create_item(self, &sender, (to, sum), nesting_budget),134 <CommonWeights<T>>::create_item(),135 )136 }137138 fn create_multiple_items_ex(139 &self,140 sender: <T>::CrossAccountId,141 data: up_data_structs::CreateItemExData<<T>::CrossAccountId>,142 nesting_budget: &dyn Budget,143 ) -> DispatchResultWithPostInfo {144 let weight = <CommonWeights<T>>::create_multiple_items_ex(&data);145 let data = match data {146 up_data_structs::CreateItemExData::Fungible(f) => f,147 _ => fail!(<Error<T>>::NotFungibleDataUsedToMintFungibleCollectionToken),148 };149150 with_weight(151 <Pallet<T>>::create_multiple_items(self, &sender, data.into_inner(), nesting_budget),152 weight,153 )154 }155156 fn burn_item(157 &self,158 sender: T::CrossAccountId,159 token: TokenId,160 amount: u128,161 ) -> DispatchResultWithPostInfo {162 ensure!(163 token == TokenId::default(),164 <Error<T>>::FungibleItemsHaveNoId165 );166167 with_weight(168 <Pallet<T>>::burn(self, &sender, amount),169 <CommonWeights<T>>::burn_item(),170 )171 }172173 fn transfer(174 &self,175 from: T::CrossAccountId,176 to: T::CrossAccountId,177 token: TokenId,178 amount: u128,179 nesting_budget: &dyn Budget,180 ) -> DispatchResultWithPostInfo {181 ensure!(182 token == TokenId::default(),183 <Error<T>>::FungibleItemsHaveNoId184 );185186 with_weight(187 <Pallet<T>>::transfer(self, &from, &to, amount, nesting_budget),188 <CommonWeights<T>>::transfer(),189 )190 }191192 fn approve(193 &self,194 sender: T::CrossAccountId,195 spender: T::CrossAccountId,196 token: TokenId,197 amount: u128,198 ) -> DispatchResultWithPostInfo {199 ensure!(200 token == TokenId::default(),201 <Error<T>>::FungibleItemsHaveNoId202 );203204 with_weight(205 <Pallet<T>>::set_allowance(self, &sender, &spender, amount),206 <CommonWeights<T>>::approve(),207 )208 }209210 fn transfer_from(211 &self,212 sender: T::CrossAccountId,213 from: T::CrossAccountId,214 to: T::CrossAccountId,215 token: TokenId,216 amount: u128,217 nesting_budget: &dyn Budget,218 ) -> DispatchResultWithPostInfo {219 ensure!(220 token == TokenId::default(),221 <Error<T>>::FungibleItemsHaveNoId222 );223224 with_weight(225 <Pallet<T>>::transfer_from(self, &sender, &from, &to, amount, nesting_budget),226 <CommonWeights<T>>::transfer_from(),227 )228 }229230 fn burn_from(231 &self,232 sender: T::CrossAccountId,233 from: T::CrossAccountId,234 token: TokenId,235 amount: u128,236 nesting_budget: &dyn Budget,237 ) -> DispatchResultWithPostInfo {238 ensure!(239 token == TokenId::default(),240 <Error<T>>::FungibleItemsHaveNoId241 );242243 with_weight(244 <Pallet<T>>::burn_from(self, &sender, &from, amount, nesting_budget),245 <CommonWeights<T>>::burn_from(),246 )247 }248249 fn set_collection_properties(250 &self,251 _sender: T::CrossAccountId,252 _property: Vec<Property>,253 ) -> DispatchResultWithPostInfo {254 fail!(<Error<T>>::SettingPropertiesNotAllowed)255 }256257 fn delete_collection_properties(258 &self,259 _sender: &T::CrossAccountId,260 _property_keys: Vec<PropertyKey>,261 ) -> DispatchResultWithPostInfo {262 fail!(<Error<T>>::SettingPropertiesNotAllowed)263 }264265 fn set_token_properties(266 &self,267 _sender: T::CrossAccountId,268 _token_id: TokenId,269 _property: Vec<Property>,270 ) -> DispatchResultWithPostInfo {271 fail!(<Error<T>>::SettingPropertiesNotAllowed)272 }273274 fn set_property_permissions(275 &self,276 _sender: &T::CrossAccountId,277 _property_permissions: Vec<PropertyKeyPermission>,278 ) -> DispatchResultWithPostInfo {279 fail!(<Error<T>>::SettingPropertiesNotAllowed)280 }281282 fn delete_token_properties(283 &self,284 _sender: T::CrossAccountId,285 _token_id: TokenId,286 _property_keys: Vec<PropertyKey>,287 ) -> DispatchResultWithPostInfo {288 fail!(<Error<T>>::SettingPropertiesNotAllowed)289 }290291 fn check_nesting(292 &self,293 _sender: <T>::CrossAccountId,294 _from: (CollectionId, TokenId),295 _under: TokenId,296 _budget: &dyn Budget,297 ) -> sp_runtime::DispatchResult {298 fail!(<Error<T>>::FungibleDisallowsNesting)299 }300301 fn nest(&self, _under: TokenId, _to_nest: (CollectionId, TokenId)) {}302303 fn unnest(&self, _under: TokenId, _to_nest: (CollectionId, TokenId)) {}304305 fn collection_tokens(&self) -> Vec<TokenId> {306 vec![TokenId::default()]307 }308309 fn account_tokens(&self, account: T::CrossAccountId) -> Vec<TokenId> {310 if <Balance<T>>::get((self.id, account)) != 0 {311 vec![TokenId::default()]312 } else {313 vec![]314 }315 }316317 fn token_exists(&self, token: TokenId) -> bool {318 token == TokenId::default()319 }320321 fn last_token_id(&self) -> TokenId {322 TokenId::default()323 }324325 fn token_owner(&self, _token: TokenId) -> Option<T::CrossAccountId> {326 None327 }328329 fn token_property(&self, _token_id: TokenId, _key: &PropertyKey) -> Option<PropertyValue> {330 None331 }332333 fn token_properties(334 &self,335 _token_id: TokenId,336 _keys: Option<Vec<PropertyKey>>,337 ) -> Vec<Property> {338 Vec::new()339 }340341 fn total_supply(&self) -> u32 {342 1343 }344345 fn account_balance(&self, account: T::CrossAccountId) -> u32 {346 if <Balance<T>>::get((self.id, account)) != 0 {347 1348 } else {349 0350 }351 }352353 fn balance(&self, account: T::CrossAccountId, token: TokenId) -> u128 {354 if token != TokenId::default() {355 return 0;356 }357 <Balance<T>>::get((self.id, account))358 }359360 fn allowance(361 &self,362 sender: T::CrossAccountId,363 spender: T::CrossAccountId,364 token: TokenId,365 ) -> u128 {366 if token != TokenId::default() {367 return 0;368 }369 <Allowance<T>>::get((self.id, sender, spender))370 }371}1// 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, traits::Get};20use up_data_structs::{TokenId, CollectionId, CreateItemExData, budget::Budget, CreateItemData};21use pallet_common::{CommonCollectionOperations, CommonWeightInfo, with_weight};22use pallet_structure::Error as StructureError;23use sp_runtime::ArithmeticError;24use sp_std::{vec::Vec, vec};25use up_data_structs::{Property, PropertyKey, PropertyValue, PropertyKeyPermission};2627use crate::{28 Allowance, Balance, Config, Error, FungibleHandle, Pallet, SelfWeightOf, weights::WeightInfo,29};3031pub struct CommonWeights<T: Config>(PhantomData<T>);32impl<T: Config> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T> {33 fn create_item() -> Weight {34 <SelfWeightOf<T>>::create_item()35 }3637 fn create_multiple_items(_data: &[CreateItemData]) -> Weight {38 // All items minted for the same user, so it works same as create_item39 Self::create_item()40 }4142 fn create_multiple_items_ex(data: &CreateItemExData<T::CrossAccountId>) -> Weight {43 match data {44 CreateItemExData::Fungible(f) => {45 <SelfWeightOf<T>>::create_multiple_items_ex(f.len() as u32)46 }47 _ => 0,48 }49 }5051 fn burn_item() -> Weight {52 <SelfWeightOf<T>>::burn_item()53 }5455 fn set_collection_properties(_amount: u32) -> Weight {56 // Error57 058 }5960 fn delete_collection_properties(_amount: u32) -> Weight {61 // Error62 063 }6465 fn set_token_properties(_amount: u32) -> Weight {66 // Error67 068 }6970 fn delete_token_properties(_amount: u32) -> Weight {71 // Error72 073 }7475 fn set_property_permissions(_amount: u32) -> Weight {76 // Error77 078 }7980 fn transfer() -> Weight {81 <SelfWeightOf<T>>::transfer()82 }8384 fn approve() -> Weight {85 <SelfWeightOf<T>>::approve()86 }8788 fn transfer_from() -> Weight {89 <SelfWeightOf<T>>::transfer_from()90 }9192 fn burn_from() -> Weight {93 <SelfWeightOf<T>>::burn_from()94 }9596 fn burn_recursively_self_raw() -> Weight {97 // Read to get total balance98 Self::burn_item() + T::DbWeight::get().reads(1)99 }100101 fn burn_recursively_breadth_raw(_amount: u32) -> Weight {102 // Fungible tokens can't have children103 0104 }105}106107impl<T: Config> CommonCollectionOperations<T> for FungibleHandle<T> {108 fn create_item(109 &self,110 sender: T::CrossAccountId,111 to: T::CrossAccountId,112 data: up_data_structs::CreateItemData,113 nesting_budget: &dyn Budget,114 ) -> DispatchResultWithPostInfo {115 match data {116 up_data_structs::CreateItemData::Fungible(data) => with_weight(117 <Pallet<T>>::create_item(self, &sender, (to, data.value), nesting_budget),118 <CommonWeights<T>>::create_item(),119 ),120 _ => fail!(<Error<T>>::NotFungibleDataUsedToMintFungibleCollectionToken),121 }122 }123124 fn create_multiple_items(125 &self,126 sender: T::CrossAccountId,127 to: T::CrossAccountId,128 data: Vec<up_data_structs::CreateItemData>,129 nesting_budget: &dyn Budget,130 ) -> DispatchResultWithPostInfo {131 let mut sum: u128 = 0;132 for data in data {133 match data {134 up_data_structs::CreateItemData::Fungible(data) => {135 sum = sum136 .checked_add(data.value)137 .ok_or(ArithmeticError::Overflow)?;138 }139 _ => fail!(<Error<T>>::NotFungibleDataUsedToMintFungibleCollectionToken),140 }141 }142143 with_weight(144 <Pallet<T>>::create_item(self, &sender, (to, sum), nesting_budget),145 <CommonWeights<T>>::create_item(),146 )147 }148149 fn create_multiple_items_ex(150 &self,151 sender: <T>::CrossAccountId,152 data: up_data_structs::CreateItemExData<<T>::CrossAccountId>,153 nesting_budget: &dyn Budget,154 ) -> DispatchResultWithPostInfo {155 let weight = <CommonWeights<T>>::create_multiple_items_ex(&data);156 let data = match data {157 up_data_structs::CreateItemExData::Fungible(f) => f,158 _ => fail!(<Error<T>>::NotFungibleDataUsedToMintFungibleCollectionToken),159 };160161 with_weight(162 <Pallet<T>>::create_multiple_items(self, &sender, data.into_inner(), nesting_budget),163 weight,164 )165 }166167 fn burn_item(168 &self,169 sender: T::CrossAccountId,170 token: TokenId,171 amount: u128,172 ) -> DispatchResultWithPostInfo {173 ensure!(174 token == TokenId::default(),175 <Error<T>>::FungibleItemsHaveNoId176 );177178 with_weight(179 <Pallet<T>>::burn(self, &sender, amount),180 <CommonWeights<T>>::burn_item(),181 )182 }183184 fn burn_item_recursively(185 &self,186 sender: T::CrossAccountId,187 token: TokenId,188 self_budget: &dyn Budget,189 _breadth_budget: &dyn Budget,190 ) -> DispatchResultWithPostInfo {191 // Should not happen?192 ensure!(193 token == TokenId::default(),194 <Error<T>>::FungibleItemsHaveNoId195 );196 ensure!(self_budget.consume(), <StructureError<T>>::DepthLimit,);197198 with_weight(199 <Pallet<T>>::burn(self, &sender, <Balance<T>>::get((self.id, &sender))),200 <CommonWeights<T>>::burn_recursively_self_raw(),201 )202 }203204 fn transfer(205 &self,206 from: T::CrossAccountId,207 to: T::CrossAccountId,208 token: TokenId,209 amount: u128,210 nesting_budget: &dyn Budget,211 ) -> DispatchResultWithPostInfo {212 ensure!(213 token == TokenId::default(),214 <Error<T>>::FungibleItemsHaveNoId215 );216217 with_weight(218 <Pallet<T>>::transfer(self, &from, &to, amount, nesting_budget),219 <CommonWeights<T>>::transfer(),220 )221 }222223 fn approve(224 &self,225 sender: T::CrossAccountId,226 spender: T::CrossAccountId,227 token: TokenId,228 amount: u128,229 ) -> DispatchResultWithPostInfo {230 ensure!(231 token == TokenId::default(),232 <Error<T>>::FungibleItemsHaveNoId233 );234235 with_weight(236 <Pallet<T>>::set_allowance(self, &sender, &spender, amount),237 <CommonWeights<T>>::approve(),238 )239 }240241 fn transfer_from(242 &self,243 sender: T::CrossAccountId,244 from: T::CrossAccountId,245 to: T::CrossAccountId,246 token: TokenId,247 amount: u128,248 nesting_budget: &dyn Budget,249 ) -> DispatchResultWithPostInfo {250 ensure!(251 token == TokenId::default(),252 <Error<T>>::FungibleItemsHaveNoId253 );254255 with_weight(256 <Pallet<T>>::transfer_from(self, &sender, &from, &to, amount, nesting_budget),257 <CommonWeights<T>>::transfer_from(),258 )259 }260261 fn burn_from(262 &self,263 sender: T::CrossAccountId,264 from: T::CrossAccountId,265 token: TokenId,266 amount: u128,267 nesting_budget: &dyn Budget,268 ) -> DispatchResultWithPostInfo {269 ensure!(270 token == TokenId::default(),271 <Error<T>>::FungibleItemsHaveNoId272 );273274 with_weight(275 <Pallet<T>>::burn_from(self, &sender, &from, amount, nesting_budget),276 <CommonWeights<T>>::burn_from(),277 )278 }279280 fn set_collection_properties(281 &self,282 _sender: T::CrossAccountId,283 _property: Vec<Property>,284 ) -> DispatchResultWithPostInfo {285 fail!(<Error<T>>::SettingPropertiesNotAllowed)286 }287288 fn delete_collection_properties(289 &self,290 _sender: &T::CrossAccountId,291 _property_keys: Vec<PropertyKey>,292 ) -> DispatchResultWithPostInfo {293 fail!(<Error<T>>::SettingPropertiesNotAllowed)294 }295296 fn set_token_properties(297 &self,298 _sender: T::CrossAccountId,299 _token_id: TokenId,300 _property: Vec<Property>,301 ) -> DispatchResultWithPostInfo {302 fail!(<Error<T>>::SettingPropertiesNotAllowed)303 }304305 fn set_property_permissions(306 &self,307 _sender: &T::CrossAccountId,308 _property_permissions: Vec<PropertyKeyPermission>,309 ) -> DispatchResultWithPostInfo {310 fail!(<Error<T>>::SettingPropertiesNotAllowed)311 }312313 fn delete_token_properties(314 &self,315 _sender: T::CrossAccountId,316 _token_id: TokenId,317 _property_keys: Vec<PropertyKey>,318 ) -> DispatchResultWithPostInfo {319 fail!(<Error<T>>::SettingPropertiesNotAllowed)320 }321322 fn check_nesting(323 &self,324 _sender: <T>::CrossAccountId,325 _from: (CollectionId, TokenId),326 _under: TokenId,327 _budget: &dyn Budget,328 ) -> sp_runtime::DispatchResult {329 fail!(<Error<T>>::FungibleDisallowsNesting)330 }331332 fn nest(&self, _under: TokenId, _to_nest: (CollectionId, TokenId)) {}333334 fn unnest(&self, _under: TokenId, _to_nest: (CollectionId, TokenId)) {}335336 fn collection_tokens(&self) -> Vec<TokenId> {337 vec![TokenId::default()]338 }339340 fn account_tokens(&self, account: T::CrossAccountId) -> Vec<TokenId> {341 if <Balance<T>>::get((self.id, account)) != 0 {342 vec![TokenId::default()]343 } else {344 vec![]345 }346 }347348 fn token_exists(&self, token: TokenId) -> bool {349 token == TokenId::default()350 }351352 fn last_token_id(&self) -> TokenId {353 TokenId::default()354 }355356 fn token_owner(&self, _token: TokenId) -> Option<T::CrossAccountId> {357 None358 }359360 fn token_property(&self, _token_id: TokenId, _key: &PropertyKey) -> Option<PropertyValue> {361 None362 }363364 fn token_properties(365 &self,366 _token_id: TokenId,367 _keys: Option<Vec<PropertyKey>>,368 ) -> Vec<Property> {369 Vec::new()370 }371372 fn total_supply(&self) -> u32 {373 1374 }375376 fn account_balance(&self, account: T::CrossAccountId) -> u32 {377 if <Balance<T>>::get((self.id, account)) != 0 {378 1379 } else {380 0381 }382 }383384 fn balance(&self, account: T::CrossAccountId, token: TokenId) -> u128 {385 if token != TokenId::default() {386 return 0;387 }388 <Balance<T>>::get((self.id, account))389 }390391 fn allowance(392 &self,393 sender: T::CrossAccountId,394 spender: T::CrossAccountId,395 token: TokenId,396 ) -> u128 {397 if token != TokenId::default() {398 return 0;399 }400 <Allowance<T>>::get((self.id, sender, spender))401 }402}pallets/nonfungible/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/benchmarking.rs
+++ b/pallets/nonfungible/src/benchmarking.rs
@@ -18,12 +18,9 @@
use crate::{Pallet, Config, NonfungibleHandle};
use sp_std::prelude::*;
-use pallet_common::benchmarking::{create_collection_raw, create_data, property_key, property_value};
+use pallet_common::benchmarking::{create_collection_raw, property_key, property_value};
use frame_benchmarking::{benchmarks, account};
-use up_data_structs::{
- CollectionMode, MAX_ITEMS_PER_BATCH, MAX_PROPERTIES_PER_ITEM, CUSTOM_DATA_LIMIT,
- budget::Unlimited,
-};
+use up_data_structs::{CollectionMode, MAX_ITEMS_PER_BATCH, MAX_PROPERTIES_PER_ITEM, budget::Unlimited};
use pallet_common::bench_init;
const SEED: u32 = 1;
@@ -49,7 +46,7 @@
}
fn create_collection<T: Config>(
- owner: T::AccountId,
+ owner: T::CrossAccountId,
) -> Result<NonfungibleHandle<T>, DispatchError> {
create_collection_raw(
owner,
@@ -96,6 +93,26 @@
let item = create_max_item(&collection, &sender, burner.clone())?;
}: {<Pallet<T>>::burn(&collection, &burner, item)?}
+ burn_recursively_self_raw {
+ bench_init!{
+ owner: sub; collection: collection(owner);
+ sender: cross_from_sub(owner); burner: cross_sub;
+ };
+ let item = create_max_item(&collection, &sender, burner.clone())?;
+ }: {<Pallet<T>>::burn_recursively(&collection, &burner, item, &Unlimited, &Unlimited)}
+
+ burn_recursively_breadth_plus_self_plus_self_per_each_raw {
+ let b in 0..200;
+ bench_init!{
+ owner: sub; collection: collection(owner);
+ sender: cross_from_sub(owner); burner: cross_sub;
+ };
+ let item = create_max_item(&collection, &sender, burner.clone())?;
+ for i in 0..b {
+ create_max_item(&collection, &sender, T::CrossTokenAddressMapping::token_to_address(collection.id, item))?;
+ }
+ }: {<Pallet<T>>::burn_recursively(&collection, &burner, item, &Unlimited, &Unlimited)}
+
transfer {
bench_init!{
owner: sub; collection: collection(owner);
pallets/nonfungible/src/common.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/common.rs
+++ b/pallets/nonfungible/src/common.rs
@@ -108,6 +108,15 @@
fn burn_from() -> Weight {
<SelfWeightOf<T>>::burn_from()
}
+
+ fn burn_recursively_self_raw() -> Weight {
+ <SelfWeightOf<T>>::burn_recursively_self_raw()
+ }
+
+ fn burn_recursively_breadth_raw(amount: u32) -> Weight {
+ <SelfWeightOf<T>>::burn_recursively_breadth_plus_self_plus_self_per_each_raw(amount)
+ .saturating_sub(Self::burn_recursively_self_raw().saturating_mul(amount as u64 + 1))
+ }
}
fn map_create_data<T: Config>(
@@ -264,6 +273,16 @@
}
}
+ fn burn_item_recursively(
+ &self,
+ sender: T::CrossAccountId,
+ token: TokenId,
+ self_budget: &dyn Budget,
+ breadth_budget: &dyn Budget,
+ ) -> DispatchResultWithPostInfo {
+ <Pallet<T>>::burn_recursively(self, &sender, token, self_budget, breadth_budget)
+ }
+
fn transfer(
&self,
from: T::CrossAccountId,
pallets/nonfungible/src/lib.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/lib.rs
+++ b/pallets/nonfungible/src/lib.rs
@@ -18,7 +18,13 @@
use erc::ERC721Events;
use evm_coder::ToLog;
-use frame_support::{BoundedVec, ensure, fail, transactional, storage::with_transaction};
+use frame_support::{
+ BoundedVec, ensure, fail, transactional,
+ storage::with_transaction,
+ pallet_prelude::DispatchResultWithPostInfo,
+ pallet_prelude::Weight,
+ weights::{PostDispatchInfo, Pays},
+};
use up_data_structs::{
AccessMode, CollectionId, CustomDataLimit, TokenId, CreateCollectionData, CreateNftExData,
mapping::TokenAddressMapping, NestingRule, budget::Budget, Property, PropertyPermission,
@@ -29,7 +35,7 @@
Error as CommonError, Pallet as PalletCommon, Event as CommonEvent, CollectionHandle,
eth::collection_id_to_address,
};
-use pallet_structure::Pallet as PalletStructure;
+use pallet_structure::{Pallet as PalletStructure, Error as StructureError};
use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};
use sp_core::H160;
use sp_runtime::{ArithmeticError, DispatchError, DispatchResult, TransactionOutcome};
@@ -39,6 +45,7 @@
use scale_info::TypeInfo;
pub use pallet::*;
+use weights::WeightInfo;
#[cfg(feature = "runtime-benchmarks")]
pub mod benchmarking;
pub mod common;
@@ -373,7 +380,7 @@
<PalletCommon<T>>::deposit_event(CommonEvent::Approved(
collection.id,
token,
- sender.clone(),
+ token_data.owner.clone(),
old_spender,
0,
));
@@ -396,6 +403,45 @@
Ok(())
}
+ #[transactional]
+ pub fn burn_recursively(
+ collection: &NonfungibleHandle<T>,
+ sender: &T::CrossAccountId,
+ token: TokenId,
+ self_budget: &dyn Budget,
+ breadth_budget: &dyn Budget,
+ ) -> DispatchResultWithPostInfo {
+ ensure!(self_budget.consume(), <StructureError<T>>::DepthLimit,);
+
+ let current_token_account =
+ T::CrossTokenAddressMapping::token_to_address(collection.id, token);
+
+ let mut weight = 0 as Weight;
+
+ // This method is transactional, if user in fact doesn't have permissions to remove token -
+ // tokens removed here will be restored after rejected transaction
+ for ((collection, token), _) in <TokenChildren<T>>::iter_prefix((collection.id, token)) {
+ ensure!(breadth_budget.consume(), <StructureError<T>>::BreadthLimit,);
+ let PostDispatchInfo { actual_weight, .. } =
+ <PalletStructure<T>>::burn_item_recursively(
+ current_token_account.clone(),
+ collection,
+ token,
+ self_budget,
+ breadth_budget,
+ )?;
+ if let Some(actual_weight) = actual_weight {
+ weight = weight.saturating_add(actual_weight);
+ }
+ }
+
+ Self::burn(collection, sender, token)?;
+ DispatchResultWithPostInfo::Ok(PostDispatchInfo {
+ actual_weight: Some(weight + <SelfWeightOf<T>>::burn_item()),
+ pays_fee: Pays::Yes,
+ })
+ }
+
pub fn set_token_property(
collection: &NonfungibleHandle<T>,
sender: &T::CrossAccountId,
@@ -964,6 +1010,7 @@
);
ensure_sender_allowed::<T>(handle.id, under, from, sender, nesting_budget)?
}
+ NestingRule::Permissive => {}
}
Ok(())
}
pallets/nonfungible/src/weights.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/weights.rs
+++ b/pallets/nonfungible/src/weights.rs
@@ -36,6 +36,8 @@
fn create_multiple_items(b: u32, ) -> Weight;
fn create_multiple_items_ex(b: u32, ) -> Weight;
fn burn_item() -> Weight;
+ fn burn_recursively_self_raw() -> Weight;
+ fn burn_recursively_breadth_plus_self_plus_self_per_each_raw(b: u32, ) -> Weight;
fn transfer() -> Weight;
fn approve() -> Weight;
fn transfer_from() -> Weight;
@@ -92,7 +94,35 @@
.saturating_add(T::DbWeight::get().reads(4 as Weight))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
}
-
+ // Storage: Nonfungible TokenChildren (r:1 w:0)
+ // Storage: Nonfungible TokenData (r:1 w:1)
+ // Storage: Nonfungible TokensBurnt (r:1 w:1)
+ // Storage: Nonfungible AccountBalance (r:1 w:1)
+ // Storage: Nonfungible Allowance (r:1 w:0)
+ // Storage: Nonfungible Owned (r:0 w:1)
+ // Storage: Nonfungible TokenProperties (r:0 w:1)
+ fn burn_recursively_self_raw() -> Weight {
+ (86_136_000 as Weight)
+ .saturating_add(T::DbWeight::get().reads(5 as Weight))
+ .saturating_add(T::DbWeight::get().writes(5 as Weight))
+ }
+ // Storage: Nonfungible TokenChildren (r:1 w:0)
+ // Storage: Nonfungible TokenData (r:1 w:1)
+ // Storage: Nonfungible TokensBurnt (r:1 w:1)
+ // Storage: Nonfungible AccountBalance (r:1 w:1)
+ // Storage: Nonfungible Allowance (r:1 w:0)
+ // Storage: Nonfungible Owned (r:0 w:1)
+ // Storage: Nonfungible TokenProperties (r:0 w:1)
+ // Storage: Common CollectionById (r:1 w:0)
+ fn burn_recursively_breadth_plus_self_plus_self_per_each_raw(b: u32, ) -> Weight {
+ (0 as Weight)
+ // Standard Error: 42_828_000
+ .saturating_add((381_478_000 as Weight).saturating_mul(b as Weight))
+ .saturating_add(T::DbWeight::get().reads(6 as Weight))
+ .saturating_add(T::DbWeight::get().reads((4 as Weight).saturating_mul(b as Weight)))
+ .saturating_add(T::DbWeight::get().writes(5 as Weight))
+ .saturating_add(T::DbWeight::get().writes((4 as Weight).saturating_mul(b as Weight)))
+ }
// Storage: Nonfungible TokenData (r:1 w:1)
// Storage: Nonfungible AccountBalance (r:2 w:2)
// Storage: Nonfungible Allowance (r:1 w:0)
@@ -204,7 +234,35 @@
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
.saturating_add(RocksDbWeight::get().writes(4 as Weight))
}
-
+ // Storage: Nonfungible TokenChildren (r:1 w:0)
+ // Storage: Nonfungible TokenData (r:1 w:1)
+ // Storage: Nonfungible TokensBurnt (r:1 w:1)
+ // Storage: Nonfungible AccountBalance (r:1 w:1)
+ // Storage: Nonfungible Allowance (r:1 w:0)
+ // Storage: Nonfungible Owned (r:0 w:1)
+ // Storage: Nonfungible TokenProperties (r:0 w:1)
+ fn burn_recursively_self_raw() -> Weight {
+ (86_136_000 as Weight)
+ .saturating_add(RocksDbWeight::get().reads(5 as Weight))
+ .saturating_add(RocksDbWeight::get().writes(5 as Weight))
+ }
+ // Storage: Nonfungible TokenChildren (r:1 w:0)
+ // Storage: Nonfungible TokenData (r:1 w:1)
+ // Storage: Nonfungible TokensBurnt (r:1 w:1)
+ // Storage: Nonfungible AccountBalance (r:1 w:1)
+ // Storage: Nonfungible Allowance (r:1 w:0)
+ // Storage: Nonfungible Owned (r:0 w:1)
+ // Storage: Nonfungible TokenProperties (r:0 w:1)
+ // Storage: Common CollectionById (r:1 w:0)
+ fn burn_recursively_breadth_plus_self_plus_self_per_each_raw(b: u32, ) -> Weight {
+ (0 as Weight)
+ // Standard Error: 42_828_000
+ .saturating_add((381_478_000 as Weight).saturating_mul(b as Weight))
+ .saturating_add(RocksDbWeight::get().reads(6 as Weight))
+ .saturating_add(RocksDbWeight::get().reads((4 as Weight).saturating_mul(b as Weight)))
+ .saturating_add(RocksDbWeight::get().writes(5 as Weight))
+ .saturating_add(RocksDbWeight::get().writes((4 as Weight).saturating_mul(b as Weight)))
+ }
// Storage: Nonfungible TokenData (r:1 w:1)
// Storage: Nonfungible AccountBalance (r:2 w:2)
// Storage: Nonfungible Allowance (r:1 w:0)
pallets/refungible/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/refungible/src/benchmarking.rs
+++ b/pallets/refungible/src/benchmarking.rs
@@ -50,7 +50,9 @@
Ok(TokenId(<TokensMinted<T>>::get(&collection.id)))
}
-fn create_collection<T: Config>(owner: T::AccountId) -> Result<RefungibleHandle<T>, DispatchError> {
+fn create_collection<T: Config>(
+ owner: T::CrossAccountId,
+) -> Result<RefungibleHandle<T>, DispatchError> {
create_collection_raw(
owner,
CollectionMode::NFT,
pallets/refungible/src/common.rsdiffbeforeafterboth--- a/pallets/refungible/src/common.rs
+++ b/pallets/refungible/src/common.rs
@@ -17,12 +17,13 @@
use core::marker::PhantomData;
use sp_std::collections::btree_map::BTreeMap;
-use frame_support::{dispatch::DispatchResultWithPostInfo, fail, weights::Weight};
+use frame_support::{dispatch::DispatchResultWithPostInfo, ensure, fail, weights::Weight, traits::Get};
use up_data_structs::{
CollectionId, TokenId, CreateItemExData, CreateRefungibleExData, budget::Budget, Property,
PropertyKey, PropertyValue, PropertyKeyPermission, CreateItemData,
};
use pallet_common::{CommonCollectionOperations, CommonWeightInfo, with_weight};
+use pallet_structure::Error as StructureError;
use sp_runtime::DispatchError;
use sp_std::{vec::Vec, vec};
@@ -113,6 +114,15 @@
fn burn_from() -> Weight {
<SelfWeightOf<T>>::burn_from()
}
+
+ fn burn_recursively_self_raw() -> Weight {
+ // Read to get total balance
+ Self::burn_item() + T::DbWeight::get().reads(1)
+ }
+ fn burn_recursively_breadth_raw(_amount: u32) -> Weight {
+ // Refungible token can't have children
+ 0
+ }
}
fn map_create_data<T: Config>(
@@ -205,6 +215,25 @@
)
}
+ fn burn_item_recursively(
+ &self,
+ sender: T::CrossAccountId,
+ token: TokenId,
+ self_budget: &dyn Budget,
+ _breadth_budget: &dyn Budget,
+ ) -> DispatchResultWithPostInfo {
+ ensure!(self_budget.consume(), <StructureError<T>>::DepthLimit,);
+ with_weight(
+ <Pallet<T>>::burn(
+ self,
+ &sender,
+ token,
+ <Balance<T>>::get((self.id, token, &sender)),
+ ),
+ <CommonWeights<T>>::burn_recursively_self_raw(),
+ )
+ }
+
fn transfer(
&self,
from: T::CrossAccountId,
pallets/scheduler/src/lib.rsdiffbeforeafterboth--- a/pallets/scheduler/src/lib.rs
+++ b/pallets/scheduler/src/lib.rs
@@ -60,8 +60,9 @@
// Ensure we're `no_std` when compiling for Wasm.
#![cfg_attr(not(feature = "std"), no_std)]
-#[cfg(feature = "runtime-benchmarks")]
-mod benchmarking;
+// FIXME
+// #[cfg(feature = "runtime-benchmarks")]
+// mod benchmarking;
pub mod weights;
pallets/structure/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/structure/src/benchmarking.rs
+++ b/pallets/structure/src/benchmarking.rs
@@ -5,6 +5,7 @@
use up_data_structs::{
CreateCollectionData, CollectionMode, CreateItemData, CreateNftData, budget::Unlimited,
};
+use pallet_common::Config as CommonConfig;
use pallet_evm::account::CrossAccountId;
const SEED: u32 = 1;
@@ -14,8 +15,8 @@
let caller: T::AccountId = account("caller", 0, SEED);
let caller_cross = T::CrossAccountId::from_sub(caller.clone());
- T::Currency::deposit_creating(&caller, T::CollectionCreationPrice::get());
- T::CollectionDispatch::create(caller, CreateCollectionData {
+ <T as CommonConfig>::Currency::deposit_creating(&caller, T::CollectionCreationPrice::get());
+ T::CollectionDispatch::create(caller_cross.clone(), CreateCollectionData {
mode: CollectionMode::NFT,
..Default::default()
})?;
pallets/structure/src/lib.rsdiffbeforeafterboth--- a/pallets/structure/src/lib.rs
+++ b/pallets/structure/src/lib.rs
@@ -3,7 +3,7 @@
use pallet_common::CommonCollectionOperations;
use sp_std::collections::btree_set::BTreeSet;
-use frame_support::dispatch::{DispatchError, DispatchResult};
+use frame_support::dispatch::{DispatchError, DispatchResult, DispatchResultWithPostInfo};
use frame_support::fail;
pub use pallet::*;
use pallet_common::{dispatch::CollectionDispatch, CollectionHandle};
@@ -29,6 +29,8 @@
OuroborosDetected,
/// While searched for owner, encountered depth limit
DepthLimit,
+ /// While iterating over children, encountered breadth limit
+ BreadthLimit,
/// While searched for owner, found token owner by not-yet-existing token
TokenNotFound,
}
@@ -184,6 +186,19 @@
Err(<Error<T>>::DepthLimit.into())
}
+ pub fn burn_item_recursively(
+ from: T::CrossAccountId,
+ collection: CollectionId,
+ token: TokenId,
+ self_budget: &dyn Budget,
+ breadth_budget: &dyn Budget,
+ ) -> DispatchResultWithPostInfo {
+ let handle = <CollectionHandle<T>>::try_get(collection)?;
+ let dispatch = T::CollectionDispatch::dispatch(handle);
+ let dispatch = dispatch.as_dyn();
+ dispatch.burn_item_recursively(from.clone(), token, self_budget, breadth_budget)
+ }
+
pub fn check_nesting(
from: T::CrossAccountId,
under: &T::CrossAccountId,
pallets/unique/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/unique/src/benchmarking.rs
+++ b/pallets/unique/src/benchmarking.rs
@@ -22,7 +22,10 @@
use frame_support::traits::{tokens::currency::Currency, Get};
use frame_benchmarking::{benchmarks, account};
use sp_runtime::DispatchError;
-use pallet_common::benchmarking::{create_data, create_var_data, create_u16_data};
+use pallet_common::{
+ Config as CommonConfig,
+ benchmarking::{create_data, create_u16_data},
+};
const SEED: u32 = 1;
@@ -30,7 +33,7 @@
owner: T::AccountId,
mode: CollectionMode,
) -> Result<CollectionId, DispatchError> {
- T::Currency::deposit_creating(&owner, T::CollectionCreationPrice::get());
+ <T as CommonConfig>::Currency::deposit_creating(&owner, T::CollectionCreationPrice::get());
let col_name = create_u16_data::<MAX_COLLECTION_NAME_LENGTH>();
let col_desc = create_u16_data::<MAX_COLLECTION_DESCRIPTION_LENGTH>();
let token_prefix = create_data::<MAX_TOKEN_PREFIX_LENGTH>();
@@ -54,7 +57,7 @@
let token_prefix = create_data::<MAX_TOKEN_PREFIX_LENGTH>();
let mode: CollectionMode = CollectionMode::NFT;
let caller: T::AccountId = account("caller", 0, SEED);
- T::Currency::deposit_creating(&caller, T::CollectionCreationPrice::get());
+ <T as CommonConfig>::Currency::deposit_creating(&caller, T::CollectionCreationPrice::get());
}: _(RawOrigin::Signed(caller.clone()), col_name.clone(), col_desc.clone(), token_prefix.clone(), mode)
verify {
assert_eq!(<pallet_common::CollectionById<T>>::get(CollectionId(1)).unwrap().owner, caller);
@@ -77,16 +80,6 @@
let collection = create_nft_collection::<T>(caller.clone())?;
<Pallet<T>>::add_to_allow_list(RawOrigin::Signed(caller.clone()).into(), collection, T::CrossAccountId::from_sub(allowlist_account.clone()))?;
}: _(RawOrigin::Signed(caller.clone()), collection, T::CrossAccountId::from_sub(allowlist_account))
-
- set_public_access_mode {
- let caller: T::AccountId = account("caller", 0, SEED);
- let collection = create_nft_collection::<T>(caller.clone())?;
- }: _(RawOrigin::Signed(caller.clone()), collection, AccessMode::AllowList)
-
- set_mint_permission {
- let caller: T::AccountId = account("caller", 0, SEED);
- let collection = create_nft_collection::<T>(caller.clone())?;
- }: _(RawOrigin::Signed(caller.clone()), collection, true)
change_collection_owner {
let caller: T::AccountId = account("caller", 0, SEED);
@@ -145,7 +138,6 @@
owner_can_transfer: Some(true),
sponsored_data_rate_limit: None,
transfers_enabled: Some(true),
- nesting_rule: None,
};
}: set_collection_limits(RawOrigin::Signed(caller.clone()), collection, cl)
}
primitives/data-structs/src/lib.rsdiffbeforeafterboth--- a/primitives/data-structs/src/lib.rs
+++ b/primitives/data-structs/src/lib.rs
@@ -469,6 +469,8 @@
#[derivative(Debug(format_with = "bounded::set_debug"))]
BoundedBTreeSet<CollectionId, ConstU32<16>>,
),
+ /// Used for tests
+ Permissive,
}
#[derive(Encode, Decode, Debug, Clone, Copy, PartialEq, TypeInfo, MaxEncodedLen)]
runtime/common/src/weights.rsdiffbeforeafterboth--- a/runtime/common/src/weights.rs
+++ b/runtime/common/src/weights.rs
@@ -89,4 +89,12 @@
fn burn_from() -> Weight {
dispatch_weight::<T>() + max_weight_of!(burn_from())
}
+
+ fn burn_recursively_self_raw() -> Weight {
+ max_weight_of!(burn_recursively_self_raw())
+ }
+
+ fn burn_recursively_breadth_raw(amount: u32) -> Weight {
+ max_weight_of!(burn_recursively_breadth_raw(amount))
+ }
}
runtime/unique/src/lib.rsdiffbeforeafterboth--- a/runtime/unique/src/lib.rs
+++ b/runtime/unique/src/lib.rs
@@ -73,6 +73,7 @@
CollectionId, TokenId, TokenData, Property, PropertyKeyPermission, CollectionLimits,
CollectionStats, RpcCollection,
mapping::{EvmTokenAddressMapping, CrossTokenAddressMapping},
+ TokenChild,
};
// use pallet_contracts::weights::WeightInfo;