1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
// This file is part of galacticcouncil/warehouse.

// Copyright (C) 2020-2022  Intergalactic, Limited (GIB).
// SPDX-License-Identifier: Apache-2.0

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#![cfg_attr(not(feature = "std"), no_std)]
#![allow(clippy::unused_unit)]
#![allow(clippy::upper_case_acronyms)]

use codec::HasCompact;
use frame_support::{
    dispatch::DispatchResult,
    ensure,
    traits::{tokens::nonfungibles::*, Get},
    BoundedVec,
};
use frame_system::ensure_signed;
use pallet_uniques::DestroyWitness;

use hydradx_traits::nft::{CreateTypedCollection, ReserveCollectionId};
use sp_runtime::{
    traits::{AtLeast32BitUnsigned, StaticLookup, Zero},
    DispatchError,
};
use sp_std::boxed::Box;
pub use types::*;
use weights::WeightInfo;

mod benchmarking;
pub mod migration;
pub mod types;
pub mod weights;

#[cfg(test)]
pub mod mock;

#[cfg(test)]
mod tests;

pub type BoundedVecOfUnq<T> = BoundedVec<u8, <T as pallet_uniques::Config>::StringLimit>;
type CollectionInfoOf<T> = CollectionInfo<<T as Config>::CollectionType, BoundedVecOfUnq<T>>;
pub type ItemInfoOf<T> = ItemInfo<BoundedVec<u8, <T as pallet_uniques::Config>::StringLimit>>;

// Re-export pallet items so that they can be accessed from the crate namespace.
pub use pallet::*;

#[frame_support::pallet]
pub mod pallet {

    use super::*;
    use frame_support::pallet_prelude::*;
    use frame_system::pallet_prelude::OriginFor;

    const STORAGE_VERSION: StorageVersion = StorageVersion::new(1);

    #[pallet::pallet]
    #[pallet::storage_version(STORAGE_VERSION)]
    #[pallet::generate_store(pub(super) trait Store)]
    pub struct Pallet<T>(_);

    #[pallet::config]
    pub trait Config: frame_system::Config + pallet_uniques::Config {
        type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;
        type WeightInfo: WeightInfo;
        type NftCollectionId: Member
            + Parameter
            + Default
            + Copy
            + HasCompact
            + AtLeast32BitUnsigned
            + Into<Self::CollectionId>
            + From<Self::CollectionId>
            + MaxEncodedLen;
        type NftItemId: Member
            + Parameter
            + Default
            + Copy
            + HasCompact
            + AtLeast32BitUnsigned
            + Into<Self::ItemId>
            + From<Self::ItemId>
            + MaxEncodedLen;
        type CollectionType: Member + Parameter + Default + Copy + MaxEncodedLen;
        type Permissions: NftPermission<Self::CollectionType>;
        /// Collection IDs reserved for runtime up to the following constant
        #[pallet::constant]
        type ReserveCollectionIdUpTo: Get<Self::NftCollectionId>;
    }

    #[pallet::storage]
    #[pallet::getter(fn collections)]
    /// Stores collection info
    pub type Collections<T: Config> = StorageMap<_, Twox64Concat, T::NftCollectionId, CollectionInfoOf<T>>;

    #[pallet::storage]
    #[pallet::getter(fn items)]
    /// Stores item info
    pub type Items<T: Config> =
        StorageDoubleMap<_, Twox64Concat, T::NftCollectionId, Twox64Concat, T::NftItemId, ItemInfoOf<T>>;

    #[pallet::call]
    impl<T: Config> Pallet<T> {
        /// Creates an NFT collection of the given collection type and sets its metadata.
        /// The collection ID needs to be outside of the range of reserved IDs.
        /// The creation of a collection needs to be enabled in the permissions
        /// for the given collection type.
        ///
        /// Parameters:
        /// - `origin`: The owner of the newly created collection.
        /// - `collection_id`: Identifier of a collection.
        /// - `collection_type`: The collection type determines its purpose and usage.
        /// - `metadata`: Arbitrary data about a collection, e.g. IPFS hash or name.
        ///
        /// Emits CollectionCreated event
        #[pallet::weight(<T as Config>::WeightInfo::create_collection())]
        pub fn create_collection(
            origin: OriginFor<T>,
            collection_id: T::NftCollectionId,
            collection_type: T::CollectionType,
            metadata: BoundedVecOfUnq<T>,
        ) -> DispatchResult {
            let sender = ensure_signed(origin)?;

            ensure!(!Self::is_id_reserved(collection_id), Error::<T>::IdReserved);
            ensure!(T::Permissions::can_create(&collection_type), Error::<T>::NotPermitted);

            Self::do_create_collection(sender, collection_id, collection_type, metadata)?;

            Ok(())
        }

        /// Mints an NFT in the specified collection and sets its metadata.
        /// Minting of new items needs to be enabled in the permissions
        /// for the given collection type.
        ///
        /// Parameters:
        /// - `origin`: The owner of the newly minted NFT.
        /// - `collection_id`: The collection of the asset to be minted.
        /// - `item_id`: The item of the asset to be minted.
        /// - `metadata`: Arbitrary data about an item, e.g. IPFS hash or symbol.
        #[pallet::weight(<T as Config>::WeightInfo::mint())]
        pub fn mint(
            origin: OriginFor<T>,
            collection_id: T::NftCollectionId,
            item_id: T::NftItemId,
            metadata: BoundedVecOfUnq<T>,
        ) -> DispatchResult {
            let sender = ensure_signed(origin)?;

            let collection_type = Self::collections(collection_id)
                .map(|c| c.collection_type)
                .ok_or(Error::<T>::CollectionUnknown)?;

            ensure!(T::Permissions::can_mint(&collection_type), Error::<T>::NotPermitted);

            let collection_owner = Self::collection_owner(&collection_id).ok_or(Error::<T>::CollectionUnknown)?;
            ensure!(collection_owner == sender, Error::<T>::NotPermitted);

            Self::do_mint(sender, collection_id, item_id, metadata)?;

            Ok(())
        }

        /// Transfers NFT from account A to account B.
        /// Transfers need to be enabled in the permissions for the given collection type.
        ///
        /// Parameters:
        /// - `origin`: The NFT owner
        /// - `collection_id`: The collection of the asset to be transferred.
        /// - `item_id`: The instance of the asset to be transferred.
        /// - `dest`: The account to receive ownership of the asset.
        #[pallet::weight(<T as Config>::WeightInfo::transfer())]
        pub fn transfer(
            origin: OriginFor<T>,
            collection_id: T::NftCollectionId,
            item_id: T::NftItemId,
            dest: <T::Lookup as StaticLookup>::Source,
        ) -> DispatchResult {
            let sender = ensure_signed(origin)?;

            let dest = T::Lookup::lookup(dest)?;

            let collection_type = Self::collections(collection_id)
                .map(|c| c.collection_type)
                .ok_or(Error::<T>::CollectionUnknown)?;

            ensure!(T::Permissions::can_transfer(&collection_type), Error::<T>::NotPermitted);

            Self::do_transfer(collection_id, item_id, sender, dest)?;

            Ok(())
        }

        /// Removes a token from existence.
        /// Burning needs to be enabled in the permissions for the given collection type.
        ///
        /// Parameters:
        /// - `origin`: The NFT owner.
        /// - `collection_id`: The collection of the asset to be burned.
        /// - `item_id`: The instance of the asset to be burned.
        #[pallet::weight(<T as Config>::WeightInfo::burn())]
        pub fn burn(origin: OriginFor<T>, collection_id: T::NftCollectionId, item_id: T::NftItemId) -> DispatchResult {
            let sender = ensure_signed(origin)?;

            let collection_type = Self::collections(collection_id)
                .map(|c| c.collection_type)
                .ok_or(Error::<T>::CollectionUnknown)?;

            ensure!(T::Permissions::can_burn(&collection_type), Error::<T>::NotPermitted);

            Self::do_burn(sender, collection_id, item_id)?;

            Ok(())
        }

        /// Removes a collection from existence.
        /// Destroying of collections need to be enabled in the permissions
        /// for the given collection type.
        /// Fails if the collection is not empty.
        ///
        /// Parameters:
        /// - `origin`: The collection owner.
        /// - `collection_id`: The identifier of the asset collection to be destroyed.
        #[pallet::weight(<T as Config>::WeightInfo::destroy_collection())]
        pub fn destroy_collection(origin: OriginFor<T>, collection_id: T::NftCollectionId) -> DispatchResult {
            let sender = ensure_signed(origin)?;

            let collection_type = Self::collections(collection_id)
                .map(|c| c.collection_type)
                .ok_or(Error::<T>::CollectionUnknown)?;

            ensure!(T::Permissions::can_destroy(&collection_type), Error::<T>::NotPermitted);

            Self::do_destroy_collection(sender, collection_id)?;

            Ok(())
        }
    }

    #[pallet::hooks]
    impl<T: Config> Hooks<T::BlockNumber> for Pallet<T> {}

    #[pallet::event]
    #[pallet::generate_deposit(pub(crate) fn deposit_event)]
    pub enum Event<T: Config> {
        /// A collection was created
        CollectionCreated {
            owner: T::AccountId,
            collection_id: T::NftCollectionId,
            collection_type: T::CollectionType,
            metadata: BoundedVecOfUnq<T>,
        },
        /// An item was minted
        ItemMinted {
            owner: T::AccountId,
            collection_id: T::NftCollectionId,
            item_id: T::NftItemId,
            metadata: BoundedVecOfUnq<T>,
        },
        /// An item was transferred
        ItemTransferred {
            from: T::AccountId,
            to: T::AccountId,
            collection_id: T::NftCollectionId,
            item_id: T::NftItemId,
        },
        /// An item was burned
        ItemBurned {
            owner: T::AccountId,
            collection_id: T::NftCollectionId,
            item_id: T::NftItemId,
        },
        /// A collection was destroyed
        CollectionDestroyed {
            owner: T::AccountId,
            collection_id: T::NftCollectionId,
        },
    }

    #[pallet::error]
    pub enum Error<T> {
        /// Count of items overflown
        NoAvailableItemId,
        /// Count of collections overflown
        NoAvailableCollectionId,
        /// Collection still contains minted tokens
        TokenCollectionNotEmpty,
        /// Collection does not exist
        CollectionUnknown,
        /// Item does not exist
        ItemUnknown,
        /// Operation not permitted
        NotPermitted,
        /// ID reserved for runtime
        IdReserved,
    }
}

impl<T: Config> Pallet<T> {
    fn do_create_collection(
        owner: T::AccountId,
        collection_id: T::NftCollectionId,
        collection_type: T::CollectionType,
        metadata: BoundedVecOfUnq<T>,
    ) -> DispatchResult {
        let deposit_info = match T::Permissions::has_deposit(&collection_type) {
            false => (Zero::zero(), true),
            true => (T::CollectionDeposit::get(), false),
        };

        pallet_uniques::Pallet::<T>::do_create_collection(
            collection_id.into(),
            owner.clone(),
            owner.clone(),
            deposit_info.0,
            deposit_info.1,
            pallet_uniques::Event::Created {
                collection: collection_id.into(),
                creator: owner.clone(),
                owner: owner.clone(),
            },
        )?;

        Collections::<T>::insert(
            collection_id,
            CollectionInfo {
                collection_type,
                metadata: metadata.clone(),
            },
        );

        Self::deposit_event(Event::CollectionCreated {
            owner,
            collection_id,
            collection_type,
            metadata,
        });

        Ok(())
    }

    fn do_mint(
        owner: T::AccountId,
        collection_id: T::NftCollectionId,
        item_id: T::NftItemId,
        metadata: BoundedVecOfUnq<T>,
    ) -> DispatchResult {
        ensure!(
            Collections::<T>::contains_key(collection_id),
            Error::<T>::CollectionUnknown
        );

        pallet_uniques::Pallet::<T>::do_mint(collection_id.into(), item_id.into(), owner.clone(), |_details| Ok(()))?;

        Items::<T>::insert(
            collection_id,
            item_id,
            ItemInfo {
                metadata: metadata.clone(),
            },
        );

        Self::deposit_event(Event::ItemMinted {
            owner,
            collection_id,
            item_id,
            metadata,
        });

        Ok(())
    }

    /// Transfer NFT from account `from` to `to`.
    /// Fails if `from` is not the NFT owner.
    ///
    /// Is a no-op if `from` is the same as `to`.
    fn do_transfer(
        collection_id: T::NftCollectionId,
        item_id: T::NftItemId,
        from: T::AccountId,
        to: T::AccountId,
    ) -> DispatchResult {
        if from == to {
            return Ok(());
        }

        let owner = Self::owner(&collection_id, &item_id).ok_or(Error::<T>::ItemUnknown)?;
        ensure!(owner == from, Error::<T>::NotPermitted);

        pallet_uniques::Pallet::<T>::do_transfer(
            collection_id.into(),
            item_id.into(),
            to.clone(),
            |_collection_details, _item_details| {
                Self::deposit_event(Event::ItemTransferred {
                    from,
                    to,
                    collection_id,
                    item_id,
                });
                Ok(())
            },
        )
    }

    fn do_burn(owner: T::AccountId, collection_id: T::NftCollectionId, item_id: T::NftItemId) -> DispatchResult {
        let item_owner = Self::owner(&collection_id, &item_id).ok_or(Error::<T>::ItemUnknown)?;
        ensure!(owner == item_owner, Error::<T>::NotPermitted);

        pallet_uniques::Pallet::<T>::do_burn(
            collection_id.into(),
            item_id.into(),
            |_collection_details, _item_details| Ok(()),
        )?;

        Items::<T>::remove(collection_id, item_id);

        Self::deposit_event(Event::ItemBurned {
            owner,
            collection_id,
            item_id,
        });

        Ok(())
    }

    fn do_destroy_collection(
        owner: T::AccountId,
        collection_id: T::NftCollectionId,
    ) -> Result<DestroyWitness, DispatchError> {
        let witness = Self::get_destroy_witness(&collection_id).ok_or(Error::<T>::CollectionUnknown)?;

        // witness struct is empty because we don't allow destroying a collection with existing items
        ensure!(witness.items == 0u32, Error::<T>::TokenCollectionNotEmpty);

        let witness =
            pallet_uniques::Pallet::<T>::do_destroy_collection(collection_id.into(), witness, Some(owner.clone()))?;
        Collections::<T>::remove(collection_id);

        Self::deposit_event(Event::CollectionDestroyed { owner, collection_id });
        Ok(witness)
    }
}

impl<T: Config> Inspect<T::AccountId> for Pallet<T> {
    type ItemId = T::NftItemId;
    type CollectionId = T::NftCollectionId;

    /// Returns the owner of `item` of `collection`, or `None` if the item doesn't exist.
    fn owner(collection: &Self::CollectionId, item: &Self::ItemId) -> Option<T::AccountId> {
        pallet_uniques::Pallet::<T>::owner((*collection).into(), (*item).into())
    }

    /// Returns the owner of the `collection`, or `None` if the collection doesn't exist.
    fn collection_owner(collection: &Self::CollectionId) -> Option<T::AccountId> {
        pallet_uniques::Pallet::<T>::collection_owner((*collection).into())
    }

    /// Returns `true` if the `item` of `collection` may be transferred.
    fn can_transfer(collection: &Self::CollectionId, _item: &Self::ItemId) -> bool {
        let maybe_collection_type = Self::collections(collection).map(|c| c.collection_type);

        match maybe_collection_type {
            Some(collection_type) => T::Permissions::can_transfer(&collection_type),
            _ => false,
        }
    }
}

impl<T: Config> InspectEnumerable<T::AccountId> for Pallet<T> {
    /// Returns an iterator of the collections in existence.
    fn collections() -> Box<dyn Iterator<Item = Self::CollectionId>> {
        Box::new(Collections::<T>::iter_keys())
    }

    /// Returns an iterator of the items of a `collection` in existence.
    fn items(collection: &Self::CollectionId) -> Box<dyn Iterator<Item = Self::ItemId>> {
        Box::new(Items::<T>::iter_key_prefix(collection))
    }

    /// Returns an iterator of the items of all collections owned by `who`.
    fn owned(who: &T::AccountId) -> Box<dyn Iterator<Item = (Self::CollectionId, Self::ItemId)>> {
        Box::new(
            pallet_uniques::Pallet::<T>::owned(who)
                .map(|(collection_id, item_id)| (collection_id.into(), item_id.into())),
        )
    }

    /// Returns an iterator of the items of `collection` owned by `who`.
    fn owned_in_collection(
        collection: &Self::CollectionId,
        who: &T::AccountId,
    ) -> Box<dyn Iterator<Item = Self::ItemId>> {
        Box::new(
            pallet_uniques::Pallet::<T>::owned_in_collection(
                &(Into::<<T as pallet_uniques::Config>::CollectionId>::into(*collection)),
                who,
            )
            .map(|i| i.into()),
        )
    }
}

impl<T: Config> Destroy<T::AccountId> for Pallet<T> {
    type DestroyWitness = DestroyWitness;

    /// The witness data needed to destroy an item.
    fn get_destroy_witness(collection: &Self::CollectionId) -> Option<Self::DestroyWitness> {
        pallet_uniques::Pallet::<T>::get_destroy_witness(
            &(Into::<<T as pallet_uniques::Config>::CollectionId>::into(*collection)),
        )
    }

    /// Removes a collection from existence.
    /// Destroying of collections is not enforced by the permissions
    /// for the given collection type.
    /// Fails if the collection is not empty and contains items.
    ///
    /// Parameters:
    /// - `collection`: The `CollectionId` to be destroyed.
    /// - `witness`: Empty witness data that needs to be provided to complete the operation
    ///   successfully.
    /// - `maybe_check_owner`: An optional account id that can be used to authorize the destroy
    ///   command. If not provided, we will not do any authorization checks before destroying the
    ///   item.
    ///
    /// If successful, this function will return empty witness data from the destroyed item.
    fn destroy(
        collection: Self::CollectionId,
        _witness: Self::DestroyWitness,
        maybe_check_owner: Option<T::AccountId>,
    ) -> Result<Self::DestroyWitness, DispatchError> {
        let owner = if let Some(check_owner) = maybe_check_owner {
            check_owner
        } else {
            Self::collection_owner(&collection).ok_or(Error::<T>::CollectionUnknown)?
        };

        Self::do_destroy_collection(owner, collection)
    }
}

impl<T: Config> Mutate<T::AccountId> for Pallet<T> {
    /// Mints an NFT in the specified collection and sets its metadata.
    /// The minting permissions are not enforced.
    /// Metadata is set to the default value.
    ///
    /// Parameters:
    /// - `collection`: The collection of the asset to be minted.
    /// - `item`: The item of the asset to be minted.
    /// - `who`: The owner of the newly minted NFT.
    fn mint_into(collection: &Self::CollectionId, item: &Self::ItemId, who: &T::AccountId) -> DispatchResult {
        Self::do_mint(who.clone(), *collection, *item, BoundedVec::default())?;

        Ok(())
    }

    /// Removes an item from existence.
    /// The burning permissions are not enforced.
    ///
    /// Parameters:
    /// - `collection`: The collection of the asset to be burned.
    /// - `item`: The instance of the asset to be burned.
    /// - `maybe_check_owner`: Optional value.
    fn burn(
        collection: &Self::CollectionId,
        item: &Self::ItemId,
        maybe_check_owner: Option<&T::AccountId>,
    ) -> DispatchResult {
        let owner = if let Some(check_owner) = maybe_check_owner {
            check_owner.clone()
        } else {
            Self::owner(collection, item).ok_or(Error::<T>::ItemUnknown)?
        };

        Self::do_burn(owner, *collection, *item)?;

        Ok(())
    }
}

impl<T: Config> Transfer<T::AccountId> for Pallet<T> {
    /// Transfer `item` of `collection` into `destination` account.
    fn transfer(collection: &Self::CollectionId, item: &Self::ItemId, destination: &T::AccountId) -> DispatchResult {
        let owner = Self::owner(collection, item).ok_or(Error::<T>::ItemUnknown)?;

        Self::do_transfer(*collection, *item, owner, destination.clone())
    }
}

impl<T: Config> CreateTypedCollection<T::AccountId, T::NftCollectionId, T::CollectionType, BoundedVecOfUnq<T>>
    for Pallet<T>
{
    /// Creates an NFT collection of the given collection type and sets its metadata.
    /// The collection ID does not need to be outside of the range of reserved IDs.
    /// The permissions for the creation of a collection are not enforced.
    /// Metadata is set to the default value if not provided.
    ///
    /// Parameters:
    /// - `owner`: The collection owner.
    /// - `collection_id`: Identifier of a collection.
    /// - `collection_type`: The collection type.
    /// - `metadata`: Optional arbitrary data about a collection, e.g. IPFS hash or name.
    ///
    /// Emits CollectionCreated event
    fn create_typed_collection(
        owner: T::AccountId,
        collection_id: T::NftCollectionId,
        collection_type: T::CollectionType,
        metadata: Option<BoundedVecOfUnq<T>>,
    ) -> DispatchResult {
        Self::do_create_collection(owner, collection_id, collection_type, metadata.unwrap_or_default())
    }
}

impl<T: Config> ReserveCollectionId<T::NftCollectionId> for Pallet<T> {
    /// Checks if the provided collection ID is within the range of reserved IDs.
    fn is_id_reserved(id: T::NftCollectionId) -> bool {
        id <= T::ReserveCollectionIdUpTo::get()
    }
}