difftreelog
fix remove unused fn
in: master
1 file changed
pallets/proxy-rmrk-core/src/benchmarking.rsdiffbeforeafterboth1use sp_std::vec;23use frame_benchmarking::{benchmarks, account};4use frame_system::RawOrigin;5use frame_support::{6 traits::{Currency, Get},7 BoundedVec,8};9use sp_runtime::Permill;1011use up_data_structs::*;1213use super::*;1415const SEED: u32 = 1;1617fn create_data<S: Get<u32>>() -> BoundedVec<u8, S> {18 vec![b'A'; S::get() as usize].try_into().expect("size == S")19}2021fn create_u32_array<S: Get<u32>>() -> BoundedVec<u32, S> {22 vec![0; S::get() as usize].try_into().expect("size == S")23}2425fn create_basic_resource() -> RmrkBasicResource {26 RmrkBasicResource {27 src: Some(create_data()),28 metadata: Some(create_data()),29 license: Some(create_data()),30 thumb: Some(create_data()),31 }32}3334fn create_composable_resource() -> RmrkComposableResource {35 RmrkComposableResource {36 parts: create_u32_array(),37 base: 100,38 src: Some(create_data()),39 metadata: Some(create_data()),40 license: Some(create_data()),41 thumb: Some(create_data()),42 }43}4445fn create_slot_resource() -> RmrkSlotResource {46 RmrkSlotResource {47 base: 100,48 slot: 200,49 src: Some(create_data()),50 metadata: Some(create_data()),51 license: Some(create_data()),52 thumb: Some(create_data()),53 }54}5556fn create_max_resource_types_array<S: Get<u32>>(num: usize) -> BoundedVec<RmrkResourceTypes, S> {57 vec![RmrkResourceTypes::Composable(create_composable_resource()); num]58 .try_into()59 .expect("num <= S")60}6162fn create_max_collection<T: Config>(owner: &T::AccountId) -> DispatchResult {63 <T as pallet_common::Config>::Currency::deposit_creating(64 owner,65 T::CollectionCreationPrice::get(),66 );6768 let metadata = create_data();69 let max = None;70 let symbol = create_data();7172 <Pallet<T>>::create_collection(73 RawOrigin::Signed(owner.clone()).into(),74 metadata,75 max,76 symbol,77 )78}7980fn create_nft<T: Config>(owner: &T::AccountId, collection_id: RmrkCollectionId) -> DispatchResult {81 let royalty_recipient = Some(owner.clone());82 let royalty_amount = Some(Permill::from_percent(25));83 let metadata = create_data();84 let transferable = true;8586 <Pallet<T>>::mint_nft(87 RawOrigin::Signed(owner.clone()).into(),88 owner.clone(),89 collection_id,90 royalty_recipient,91 royalty_amount,92 metadata,93 transferable,94 None,95 )96}9798struct NftBuilder {99 collection_id: RmrkCollectionId,100 current_nft_id: RmrkNftId,101}102103impl NftBuilder {104 fn new(collection_id: RmrkCollectionId) -> Self {105 Self {106 collection_id,107 current_nft_id: 0,108 }109 }110111 fn current_nft_id(&self) -> RmrkNftId {112 self.current_nft_id113 }114115 fn build<T: Config>(&mut self, owner: &T::AccountId) -> Result<RmrkNftId, DispatchError> {116 create_nft::<T>(owner, self.collection_id)?;117 self.current_nft_id += 1;118119 Ok(self.current_nft_id)120 }121122 fn build_tower<T: Config>(123 &mut self,124 owner: &T::AccountId,125 height: u32,126 ) -> Result<(RmrkNftId, RmrkNftId), DispatchError> {127 self.build::<T>(owner)?;128129 let root_nft_id = self.current_nft_id;130 let mut prev_nft_id = root_nft_id;131132 for _ in 0..height {133 self.build::<T>(owner)?;134135 let new_owner =136 <RmrkAccountIdOrCollectionNftTuple<T::AccountId>>::CollectionAndNftTuple(137 self.collection_id,138 prev_nft_id,139 );140141 <Pallet<T>>::send(142 RawOrigin::Signed(owner.clone()).into(),143 self.collection_id,144 self.current_nft_id,145 new_owner,146 )?;147148 prev_nft_id = self.current_nft_id;149 }150151 let deepest_nft_id = self.current_nft_id;152153 Ok((root_nft_id, deepest_nft_id))154 }155156 fn build_wide_tree<T: Config>(157 &mut self,158 owner: &T::AccountId,159 width: u32,160 ) -> Result<RmrkNftId, DispatchError> {161 self.build::<T>(owner)?;162163 let root_nft_id = self.current_nft_id;164165 let root_owner = <RmrkAccountIdOrCollectionNftTuple<T::AccountId>>::CollectionAndNftTuple(166 self.collection_id,167 root_nft_id,168 );169170 for _ in 0..width {171 self.build::<T>(owner)?;172173 <Pallet<T>>::send(174 RawOrigin::Signed(owner.clone()).into(),175 self.collection_id,176 self.current_nft_id,177 root_owner.clone(),178 )?;179 }180181 Ok(root_nft_id)182 }183}184185benchmarks! {186 create_collection {187 let caller = account("caller", 0, SEED);188 <T as pallet_common::Config>::Currency::deposit_creating(&caller, T::CollectionCreationPrice::get());189 let metadata = create_data();190 let max = None;191 let symbol = create_data();192 }: _(RawOrigin::Signed(caller), metadata, max, symbol)193194 destroy_collection {195 let caller = account("caller", 0, SEED);196197 create_max_collection::<T>(&caller)?;198 let collection_id = 0;199 }: _(RawOrigin::Signed(caller), collection_id)200201 change_collection_issuer {202 let caller: T::AccountId = account("caller", 0, SEED);203204 create_max_collection::<T>(&caller)?;205 let collection_id = 0;206207 let new_owner: T::AccountId = account("new_owner", 0, SEED);208209 let new_owner_source = T::Lookup::unlookup(new_owner);210 }: _(RawOrigin::Signed(caller), collection_id, new_owner_source)211212 lock_collection {213 let caller: T::AccountId = account("caller", 0, SEED);214215 create_max_collection::<T>(&caller)?;216 let collection_id = 0;217 }: _(RawOrigin::Signed(caller), collection_id)218219 mint_nft {220 let b in 0..100;221222 let caller: T::AccountId = account("caller", 0, SEED);223224 create_max_collection::<T>(&caller)?;225 let collection_id = 0;226 let owner = caller.clone();227228 let royalty_recipient = Some(caller.clone());229 let royalty_amount = Some(Permill::from_percent(25));230 let metadata = create_data();231 let transferable = true;232 }: _(233 RawOrigin::Signed(caller),234 owner,235 collection_id,236 royalty_recipient,237 royalty_amount,238 metadata,239 transferable,240 Some(create_max_resource_types_array(b as usize))241 )242243 burn_nft {244 let b in 0..200;245246 let caller: T::AccountId = account("caller", 0, SEED);247 create_max_collection::<T>(&caller)?;248 let collection_id = 0;249250 let mut nft_builder = NftBuilder::new(collection_id);251 let root_nft_id = nft_builder.build_wide_tree::<T>(&caller, b)?;252 let max_burns = b + 1;253 }: _(254 RawOrigin::Signed(caller),255 collection_id,256 root_nft_id,257 max_burns258 )259260 send {261 let caller: T::AccountId = account("caller", 0, SEED);262 create_max_collection::<T>(&caller)?;263 let collection_id = 0;264265 let mut nft_builder = NftBuilder::new(collection_id);266 let src_nft_id = nft_builder.build::<T>(&caller)?;267 let (_, target_nft_id) = nft_builder.build_tower::<T>(&caller, NESTING_BUDGET - 2)?;268 }: _(269 RawOrigin::Signed(caller),270 collection_id,271 src_nft_id,272 <RmrkAccountIdOrCollectionNftTuple<T::AccountId>>::CollectionAndNftTuple(collection_id, target_nft_id)273 )274275 accept_nft {276 let caller: T::AccountId = account("caller", 0, SEED);277 let sender: T::AccountId = account("sender", 0, SEED);278279 create_max_collection::<T>(&sender)?;280 let src_collection_id = 0;281282 create_max_collection::<T>(&caller)?;283 let target_collection_id = 1;284285 let mut src_nft_builder = NftBuilder::new(src_collection_id);286 let src_nft_id = src_nft_builder.build::<T>(&sender)?;287288 let mut target_nft_builder = NftBuilder::new(target_collection_id);289 let fake_target_nft_id = target_nft_builder.build::<T>(&caller)?;290 let (_, target_nft_id) = target_nft_builder.build_tower::<T>(&caller, NESTING_BUDGET - 1)?;291292 let new_owner = <RmrkAccountIdOrCollectionNftTuple<T::AccountId>>::CollectionAndNftTuple(293 target_collection_id,294 fake_target_nft_id295 );296297 let actual_new_owner = <RmrkAccountIdOrCollectionNftTuple<T::AccountId>>::CollectionAndNftTuple(298 target_collection_id,299 target_nft_id300 );301302 <Pallet<T>>::send(303 RawOrigin::Signed(sender.clone()).into(),304 src_collection_id,305 src_nft_id,306 new_owner,307 )?;308 }: _(309 RawOrigin::Signed(caller),310 src_collection_id,311 src_nft_id,312 actual_new_owner313 )314315 reject_nft {316 let caller: T::AccountId = account("caller", 0, SEED);317 let sender: T::AccountId = account("sender", 0, SEED);318319 create_max_collection::<T>(&sender)?;320 let src_collection_id = 0;321322 create_max_collection::<T>(&caller)?;323 let target_collection_id = 1;324325 let mut src_nft_builder = NftBuilder::new(src_collection_id);326 let (src_root_nft_id, _) = src_nft_builder.build_tower::<T>(&sender, NESTING_BUDGET - 1)?;327328 let mut target_nft_builder = NftBuilder::new(target_collection_id);329 let target_nft_id = target_nft_builder.build::<T>(&caller)?;330331 let new_owner = <RmrkAccountIdOrCollectionNftTuple<T::AccountId>>::CollectionAndNftTuple(332 target_collection_id,333 target_nft_id334 );335336 <Pallet<T>>::send(337 RawOrigin::Signed(sender.clone()).into(),338 src_collection_id,339 src_root_nft_id,340 new_owner,341 )?;342 }: _(343 RawOrigin::Signed(caller),344 src_collection_id,345 src_root_nft_id346 )347348 set_property {349 let caller: T::AccountId = account("caller", 0, SEED);350 create_max_collection::<T>(&caller)?;351 let collection_id = 0;352353 let mut nft_builder = NftBuilder::new(collection_id);354 let (_, nft_id) = nft_builder.build_tower::<T>(&caller, NESTING_BUDGET - 1)?;355356 let key = create_data();357 let value = create_data();358 }: _(359 RawOrigin::Signed(caller),360 collection_id,361 Some(nft_id),362 key,363 value364 )365366 set_priority {367 let caller: T::AccountId = account("caller", 0, SEED);368 create_max_collection::<T>(&caller)?;369 let collection_id = 0;370371 let mut nft_builder = NftBuilder::new(collection_id);372 let (_, nft_id) = nft_builder.build_tower::<T>(&caller, NESTING_BUDGET - 1)?;373 let priorities = create_u32_array();374 }: _(375 RawOrigin::Signed(caller),376 collection_id,377 nft_id,378 priorities379 )380381 add_basic_resource {382 let caller: T::AccountId = account("caller", 0, SEED);383384 create_max_collection::<T>(&caller)?;385 let collection_id = 0;386387 let mut nft_builder = NftBuilder::new(collection_id);388 let (_, nft_id) = nft_builder.build_tower::<T>(&caller, NESTING_BUDGET - 1)?;389 let resource = create_basic_resource();390 }: _(391 RawOrigin::Signed(caller),392 collection_id,393 nft_id,394 resource395 )396397 add_composable_resource {398 let caller: T::AccountId = account("caller", 0, SEED);399400 create_max_collection::<T>(&caller)?;401 let collection_id = 0;402403 let mut nft_builder = NftBuilder::new(collection_id);404 let (_, nft_id) = nft_builder.build_tower::<T>(&caller, NESTING_BUDGET - 1)?;405 let resource = create_composable_resource();406 }: _(407 RawOrigin::Signed(caller),408 collection_id,409 nft_id,410 resource411 )412413 add_slot_resource {414 let caller: T::AccountId = account("caller", 0, SEED);415416 create_max_collection::<T>(&caller)?;417 let collection_id = 0;418419 let mut nft_builder = NftBuilder::new(collection_id);420 let (_, nft_id) = nft_builder.build_tower::<T>(&caller, NESTING_BUDGET - 1)?;421 let resource = create_slot_resource();422 }: _(423 RawOrigin::Signed(caller),424 collection_id,425 nft_id,426 resource427 )428429 remove_resource {430 let caller: T::AccountId = account("caller", 0, SEED);431432 create_max_collection::<T>(&caller)?;433 let collection_id = 0;434435 let mut nft_builder = NftBuilder::new(collection_id);436 let (_, nft_id) = nft_builder.build_tower::<T>(&caller, NESTING_BUDGET - 1)?;437 let resource = create_basic_resource();438439 <Pallet<T>>::add_basic_resource(440 RawOrigin::Signed(caller.clone()).into(),441 collection_id,442 nft_id,443 resource444 )?;445446 let resource_id = 0;447 }: _(448 RawOrigin::Signed(caller),449 collection_id,450 nft_id,451 resource_id452 )453454 accept_resource {455 let caller: T::AccountId = account("caller", 0, SEED);456 let admin: T::AccountId = account("admin", 0, SEED);457458 create_max_collection::<T>(&admin)?;459 let collection_id = 0;460461 let mut nft_builder = NftBuilder::new(collection_id);462 let root_nft_id = 1;463 let (_, nested_nft_id) = nft_builder.build_tower::<T>(&admin, NESTING_BUDGET - 1)?;464 let resource = create_basic_resource();465466 let new_owner = <RmrkAccountIdOrCollectionNftTuple<T::AccountId>>::AccountId(caller.clone());467468 <Pallet<T>>::send(469 RawOrigin::Signed(admin.clone()).into(),470 collection_id,471 root_nft_id,472 new_owner,473 )?;474475 <Pallet<T>>::add_basic_resource(476 RawOrigin::Signed(admin.clone()).into(),477 collection_id,478 nested_nft_id,479 resource480 )?;481482 let resource_id = 0;483 }: _(484 RawOrigin::Signed(caller),485 collection_id,486 nested_nft_id,487 resource_id488 )489490 accept_resource_removal {491 let caller: T::AccountId = account("caller", 0, SEED);492 let admin: T::AccountId = account("admin", 0, SEED);493494 create_max_collection::<T>(&admin)?;495 let collection_id = 0;496497 let mut nft_builder = NftBuilder::new(collection_id);498 let root_nft_id = 1;499 let (_, nested_nft_id) = nft_builder.build_tower::<T>(&admin, NESTING_BUDGET - 1)?;500 let resource = create_basic_resource();501502 <Pallet<T>>::add_basic_resource(503 RawOrigin::Signed(admin.clone()).into(),504 collection_id,505 nested_nft_id,506 resource507 )?;508509 let resource_id = 0;510511 let new_owner = <RmrkAccountIdOrCollectionNftTuple<T::AccountId>>::AccountId(caller.clone());512513 <Pallet<T>>::send(514 RawOrigin::Signed(admin.clone()).into(),515 collection_id,516 root_nft_id,517 new_owner,518 )?;519520 <Pallet<T>>::remove_resource(521 RawOrigin::Signed(admin).into(),522 collection_id,523 nested_nft_id,524 resource_id525 )?;526 }: _(527 RawOrigin::Signed(caller),528 collection_id,529 nested_nft_id,530 resource_id531 )532}1use sp_std::vec;23use frame_benchmarking::{benchmarks, account};4use frame_system::RawOrigin;5use frame_support::{6 traits::{Currency, Get},7 BoundedVec,8};9use sp_runtime::Permill;1011use up_data_structs::*;1213use super::*;1415const SEED: u32 = 1;1617fn create_data<S: Get<u32>>() -> BoundedVec<u8, S> {18 vec![b'A'; S::get() as usize].try_into().expect("size == S")19}2021fn create_u32_array<S: Get<u32>>() -> BoundedVec<u32, S> {22 vec![0; S::get() as usize].try_into().expect("size == S")23}2425fn create_basic_resource() -> RmrkBasicResource {26 RmrkBasicResource {27 src: Some(create_data()),28 metadata: Some(create_data()),29 license: Some(create_data()),30 thumb: Some(create_data()),31 }32}3334fn create_composable_resource() -> RmrkComposableResource {35 RmrkComposableResource {36 parts: create_u32_array(),37 base: 100,38 src: Some(create_data()),39 metadata: Some(create_data()),40 license: Some(create_data()),41 thumb: Some(create_data()),42 }43}4445fn create_slot_resource() -> RmrkSlotResource {46 RmrkSlotResource {47 base: 100,48 slot: 200,49 src: Some(create_data()),50 metadata: Some(create_data()),51 license: Some(create_data()),52 thumb: Some(create_data()),53 }54}5556fn create_max_resource_types_array<S: Get<u32>>(num: usize) -> BoundedVec<RmrkResourceTypes, S> {57 vec![RmrkResourceTypes::Composable(create_composable_resource()); num]58 .try_into()59 .expect("num <= S")60}6162fn create_max_collection<T: Config>(owner: &T::AccountId) -> DispatchResult {63 <T as pallet_common::Config>::Currency::deposit_creating(64 owner,65 T::CollectionCreationPrice::get(),66 );6768 let metadata = create_data();69 let max = None;70 let symbol = create_data();7172 <Pallet<T>>::create_collection(73 RawOrigin::Signed(owner.clone()).into(),74 metadata,75 max,76 symbol,77 )78}7980fn create_nft<T: Config>(owner: &T::AccountId, collection_id: RmrkCollectionId) -> DispatchResult {81 let royalty_recipient = Some(owner.clone());82 let royalty_amount = Some(Permill::from_percent(25));83 let metadata = create_data();84 let transferable = true;8586 <Pallet<T>>::mint_nft(87 RawOrigin::Signed(owner.clone()).into(),88 owner.clone(),89 collection_id,90 royalty_recipient,91 royalty_amount,92 metadata,93 transferable,94 None,95 )96}9798struct NftBuilder {99 collection_id: RmrkCollectionId,100 current_nft_id: RmrkNftId,101}102103impl NftBuilder {104 fn new(collection_id: RmrkCollectionId) -> Self {105 Self {106 collection_id,107 current_nft_id: 0,108 }109 }110111 fn build<T: Config>(&mut self, owner: &T::AccountId) -> Result<RmrkNftId, DispatchError> {112 create_nft::<T>(owner, self.collection_id)?;113 self.current_nft_id += 1;114115 Ok(self.current_nft_id)116 }117118 fn build_tower<T: Config>(119 &mut self,120 owner: &T::AccountId,121 height: u32,122 ) -> Result<(RmrkNftId, RmrkNftId), DispatchError> {123 self.build::<T>(owner)?;124125 let root_nft_id = self.current_nft_id;126 let mut prev_nft_id = root_nft_id;127128 for _ in 0..height {129 self.build::<T>(owner)?;130131 let new_owner =132 <RmrkAccountIdOrCollectionNftTuple<T::AccountId>>::CollectionAndNftTuple(133 self.collection_id,134 prev_nft_id,135 );136137 <Pallet<T>>::send(138 RawOrigin::Signed(owner.clone()).into(),139 self.collection_id,140 self.current_nft_id,141 new_owner,142 )?;143144 prev_nft_id = self.current_nft_id;145 }146147 let deepest_nft_id = self.current_nft_id;148149 Ok((root_nft_id, deepest_nft_id))150 }151152 fn build_wide_tree<T: Config>(153 &mut self,154 owner: &T::AccountId,155 width: u32,156 ) -> Result<RmrkNftId, DispatchError> {157 self.build::<T>(owner)?;158159 let root_nft_id = self.current_nft_id;160161 let root_owner = <RmrkAccountIdOrCollectionNftTuple<T::AccountId>>::CollectionAndNftTuple(162 self.collection_id,163 root_nft_id,164 );165166 for _ in 0..width {167 self.build::<T>(owner)?;168169 <Pallet<T>>::send(170 RawOrigin::Signed(owner.clone()).into(),171 self.collection_id,172 self.current_nft_id,173 root_owner.clone(),174 )?;175 }176177 Ok(root_nft_id)178 }179}180181benchmarks! {182 create_collection {183 let caller = account("caller", 0, SEED);184 <T as pallet_common::Config>::Currency::deposit_creating(&caller, T::CollectionCreationPrice::get());185 let metadata = create_data();186 let max = None;187 let symbol = create_data();188 }: _(RawOrigin::Signed(caller), metadata, max, symbol)189190 destroy_collection {191 let caller = account("caller", 0, SEED);192193 create_max_collection::<T>(&caller)?;194 let collection_id = 0;195 }: _(RawOrigin::Signed(caller), collection_id)196197 change_collection_issuer {198 let caller: T::AccountId = account("caller", 0, SEED);199200 create_max_collection::<T>(&caller)?;201 let collection_id = 0;202203 let new_owner: T::AccountId = account("new_owner", 0, SEED);204205 let new_owner_source = T::Lookup::unlookup(new_owner);206 }: _(RawOrigin::Signed(caller), collection_id, new_owner_source)207208 lock_collection {209 let caller: T::AccountId = account("caller", 0, SEED);210211 create_max_collection::<T>(&caller)?;212 let collection_id = 0;213 }: _(RawOrigin::Signed(caller), collection_id)214215 mint_nft {216 let b in 0..100;217218 let caller: T::AccountId = account("caller", 0, SEED);219220 create_max_collection::<T>(&caller)?;221 let collection_id = 0;222 let owner = caller.clone();223224 let royalty_recipient = Some(caller.clone());225 let royalty_amount = Some(Permill::from_percent(25));226 let metadata = create_data();227 let transferable = true;228 }: _(229 RawOrigin::Signed(caller),230 owner,231 collection_id,232 royalty_recipient,233 royalty_amount,234 metadata,235 transferable,236 Some(create_max_resource_types_array(b as usize))237 )238239 burn_nft {240 let b in 0..200;241242 let caller: T::AccountId = account("caller", 0, SEED);243 create_max_collection::<T>(&caller)?;244 let collection_id = 0;245246 let mut nft_builder = NftBuilder::new(collection_id);247 let root_nft_id = nft_builder.build_wide_tree::<T>(&caller, b)?;248 let max_burns = b + 1;249 }: _(250 RawOrigin::Signed(caller),251 collection_id,252 root_nft_id,253 max_burns254 )255256 send {257 let caller: T::AccountId = account("caller", 0, SEED);258 create_max_collection::<T>(&caller)?;259 let collection_id = 0;260261 let mut nft_builder = NftBuilder::new(collection_id);262 let src_nft_id = nft_builder.build::<T>(&caller)?;263 let (_, target_nft_id) = nft_builder.build_tower::<T>(&caller, NESTING_BUDGET - 2)?;264 }: _(265 RawOrigin::Signed(caller),266 collection_id,267 src_nft_id,268 <RmrkAccountIdOrCollectionNftTuple<T::AccountId>>::CollectionAndNftTuple(collection_id, target_nft_id)269 )270271 accept_nft {272 let caller: T::AccountId = account("caller", 0, SEED);273 let sender: T::AccountId = account("sender", 0, SEED);274275 create_max_collection::<T>(&sender)?;276 let src_collection_id = 0;277278 create_max_collection::<T>(&caller)?;279 let target_collection_id = 1;280281 let mut src_nft_builder = NftBuilder::new(src_collection_id);282 let src_nft_id = src_nft_builder.build::<T>(&sender)?;283284 let mut target_nft_builder = NftBuilder::new(target_collection_id);285 let fake_target_nft_id = target_nft_builder.build::<T>(&caller)?;286 let (_, target_nft_id) = target_nft_builder.build_tower::<T>(&caller, NESTING_BUDGET - 1)?;287288 let new_owner = <RmrkAccountIdOrCollectionNftTuple<T::AccountId>>::CollectionAndNftTuple(289 target_collection_id,290 fake_target_nft_id291 );292293 let actual_new_owner = <RmrkAccountIdOrCollectionNftTuple<T::AccountId>>::CollectionAndNftTuple(294 target_collection_id,295 target_nft_id296 );297298 <Pallet<T>>::send(299 RawOrigin::Signed(sender.clone()).into(),300 src_collection_id,301 src_nft_id,302 new_owner,303 )?;304 }: _(305 RawOrigin::Signed(caller),306 src_collection_id,307 src_nft_id,308 actual_new_owner309 )310311 reject_nft {312 let caller: T::AccountId = account("caller", 0, SEED);313 let sender: T::AccountId = account("sender", 0, SEED);314315 create_max_collection::<T>(&sender)?;316 let src_collection_id = 0;317318 create_max_collection::<T>(&caller)?;319 let target_collection_id = 1;320321 let mut src_nft_builder = NftBuilder::new(src_collection_id);322 let (src_root_nft_id, _) = src_nft_builder.build_tower::<T>(&sender, NESTING_BUDGET - 1)?;323324 let mut target_nft_builder = NftBuilder::new(target_collection_id);325 let target_nft_id = target_nft_builder.build::<T>(&caller)?;326327 let new_owner = <RmrkAccountIdOrCollectionNftTuple<T::AccountId>>::CollectionAndNftTuple(328 target_collection_id,329 target_nft_id330 );331332 <Pallet<T>>::send(333 RawOrigin::Signed(sender.clone()).into(),334 src_collection_id,335 src_root_nft_id,336 new_owner,337 )?;338 }: _(339 RawOrigin::Signed(caller),340 src_collection_id,341 src_root_nft_id342 )343344 set_property {345 let caller: T::AccountId = account("caller", 0, SEED);346 create_max_collection::<T>(&caller)?;347 let collection_id = 0;348349 let mut nft_builder = NftBuilder::new(collection_id);350 let (_, nft_id) = nft_builder.build_tower::<T>(&caller, NESTING_BUDGET - 1)?;351352 let key = create_data();353 let value = create_data();354 }: _(355 RawOrigin::Signed(caller),356 collection_id,357 Some(nft_id),358 key,359 value360 )361362 set_priority {363 let caller: T::AccountId = account("caller", 0, SEED);364 create_max_collection::<T>(&caller)?;365 let collection_id = 0;366367 let mut nft_builder = NftBuilder::new(collection_id);368 let (_, nft_id) = nft_builder.build_tower::<T>(&caller, NESTING_BUDGET - 1)?;369 let priorities = create_u32_array();370 }: _(371 RawOrigin::Signed(caller),372 collection_id,373 nft_id,374 priorities375 )376377 add_basic_resource {378 let caller: T::AccountId = account("caller", 0, SEED);379380 create_max_collection::<T>(&caller)?;381 let collection_id = 0;382383 let mut nft_builder = NftBuilder::new(collection_id);384 let (_, nft_id) = nft_builder.build_tower::<T>(&caller, NESTING_BUDGET - 1)?;385 let resource = create_basic_resource();386 }: _(387 RawOrigin::Signed(caller),388 collection_id,389 nft_id,390 resource391 )392393 add_composable_resource {394 let caller: T::AccountId = account("caller", 0, SEED);395396 create_max_collection::<T>(&caller)?;397 let collection_id = 0;398399 let mut nft_builder = NftBuilder::new(collection_id);400 let (_, nft_id) = nft_builder.build_tower::<T>(&caller, NESTING_BUDGET - 1)?;401 let resource = create_composable_resource();402 }: _(403 RawOrigin::Signed(caller),404 collection_id,405 nft_id,406 resource407 )408409 add_slot_resource {410 let caller: T::AccountId = account("caller", 0, SEED);411412 create_max_collection::<T>(&caller)?;413 let collection_id = 0;414415 let mut nft_builder = NftBuilder::new(collection_id);416 let (_, nft_id) = nft_builder.build_tower::<T>(&caller, NESTING_BUDGET - 1)?;417 let resource = create_slot_resource();418 }: _(419 RawOrigin::Signed(caller),420 collection_id,421 nft_id,422 resource423 )424425 remove_resource {426 let caller: T::AccountId = account("caller", 0, SEED);427428 create_max_collection::<T>(&caller)?;429 let collection_id = 0;430431 let mut nft_builder = NftBuilder::new(collection_id);432 let (_, nft_id) = nft_builder.build_tower::<T>(&caller, NESTING_BUDGET - 1)?;433 let resource = create_basic_resource();434435 <Pallet<T>>::add_basic_resource(436 RawOrigin::Signed(caller.clone()).into(),437 collection_id,438 nft_id,439 resource440 )?;441442 let resource_id = 0;443 }: _(444 RawOrigin::Signed(caller),445 collection_id,446 nft_id,447 resource_id448 )449450 accept_resource {451 let caller: T::AccountId = account("caller", 0, SEED);452 let admin: T::AccountId = account("admin", 0, SEED);453454 create_max_collection::<T>(&admin)?;455 let collection_id = 0;456457 let mut nft_builder = NftBuilder::new(collection_id);458 let root_nft_id = 1;459 let (_, nested_nft_id) = nft_builder.build_tower::<T>(&admin, NESTING_BUDGET - 1)?;460 let resource = create_basic_resource();461462 let new_owner = <RmrkAccountIdOrCollectionNftTuple<T::AccountId>>::AccountId(caller.clone());463464 <Pallet<T>>::send(465 RawOrigin::Signed(admin.clone()).into(),466 collection_id,467 root_nft_id,468 new_owner,469 )?;470471 <Pallet<T>>::add_basic_resource(472 RawOrigin::Signed(admin.clone()).into(),473 collection_id,474 nested_nft_id,475 resource476 )?;477478 let resource_id = 0;479 }: _(480 RawOrigin::Signed(caller),481 collection_id,482 nested_nft_id,483 resource_id484 )485486 accept_resource_removal {487 let caller: T::AccountId = account("caller", 0, SEED);488 let admin: T::AccountId = account("admin", 0, SEED);489490 create_max_collection::<T>(&admin)?;491 let collection_id = 0;492493 let mut nft_builder = NftBuilder::new(collection_id);494 let root_nft_id = 1;495 let (_, nested_nft_id) = nft_builder.build_tower::<T>(&admin, NESTING_BUDGET - 1)?;496 let resource = create_basic_resource();497498 <Pallet<T>>::add_basic_resource(499 RawOrigin::Signed(admin.clone()).into(),500 collection_id,501 nested_nft_id,502 resource503 )?;504505 let resource_id = 0;506507 let new_owner = <RmrkAccountIdOrCollectionNftTuple<T::AccountId>>::AccountId(caller.clone());508509 <Pallet<T>>::send(510 RawOrigin::Signed(admin.clone()).into(),511 collection_id,512 root_nft_id,513 new_owner,514 )?;515516 <Pallet<T>>::remove_resource(517 RawOrigin::Signed(admin).into(),518 collection_id,519 nested_nft_id,520 resource_id521 )?;522 }: _(523 RawOrigin::Signed(caller),524 collection_id,525 nested_nft_id,526 resource_id527 )528}