1
1
/*
2
- Description: Central Collection for a large number of Genies NFTs
2
+ Description: Central Collection for a large number of Moment NFTs
3
3
4
- Adapted from: TopShotShardedCollection .cdc
4
+ Adapted from: GeniesShardedCollection .cdc
5
5
Authors: Joshua Hannan [email protected]
6
6
7
+
7
8
8
9
[...]
9
10
12
13
*/
13
14
14
15
import NonFungibleToken from " ./NonFungibleToken.cdc"
15
- import Genies from " ./Genies .cdc"
16
+ import AllDay from " ./AllDay .cdc"
16
17
17
- pub contract GeniesShardedCollection {
18
+ pub contract AllDayShardedCollection {
18
19
// Named Paths
19
20
//
20
21
pub let CollectionStoragePath : StoragePath
21
22
22
- // ShardedCollection stores a dictionary of Genies Collections
23
- // A Genies NFT is stored in the field that corresponds to its id % numBuckets
23
+ // ShardedCollection stores a dictionary of AllDay Collections
24
+ // A AllDay NFT is stored in the field that corresponds to its id % numBuckets
24
25
pub resource ShardedCollection :
25
- Genies . GeniesNFTCollectionPublic ,
26
+ AllDay . MomentNFTCollectionPublic ,
26
27
NonFungibleToken.Provider,
27
28
NonFungibleToken.Receiver,
28
29
NonFungibleToken.CollectionPublic
29
30
{
30
- // Dictionary of Genies collections
31
- pub var collections : @{UInt64 : Genies .Collection }
31
+ // Dictionary of AllDay collections
32
+ pub var collections : @{UInt64 : AllDay .Collection }
32
33
33
- // The number of buckets to split Genies NFTs into
34
+ // The number of buckets to split AllDay NFTs into
34
35
// This makes storage more efficient and performant
35
36
pub let numBuckets : UInt64
36
37
@@ -42,13 +43,13 @@ pub contract GeniesShardedCollection {
42
43
var i : UInt64 = 0
43
44
while i < numBuckets {
44
45
45
- self .collections[i] <- ! Genies .createEmptyCollection () as! @Genies .Collection
46
+ self .collections[i] <- ! AllDay .createEmptyCollection () as! @AllDay .Collection
46
47
47
48
i = i + (1 as UInt64)
48
49
}
49
50
}
50
51
51
- // withdraw removes a Genies NFT from one of the Collections
52
+ // withdraw removes a AllDay NFT from one of the Collections
52
53
// and moves it to the caller
53
54
pub fun withdraw (withdrawID : UInt64 ): @NonFungibleToken .NFT {
54
55
post {
@@ -57,7 +58,7 @@ pub contract GeniesShardedCollection {
57
58
// Find the bucket it should be withdrawn from
58
59
let bucket = withdrawID % self .numBuckets
59
60
60
- // Withdraw the Genies NFT
61
+ // Withdraw the AllDay NFT
61
62
let token <- self .collections[bucket]? .withdraw (withdrawID : withdrawID)!
62
63
63
64
return <- token
@@ -67,10 +68,10 @@ pub contract GeniesShardedCollection {
67
68
//
68
69
// Parameters: ids: an array of the IDs to be withdrawn from the Collection
69
70
//
70
- // Returns: @NonFungibleToken.Collection a Collection containing the Genies NFTs
71
+ // Returns: @NonFungibleToken.Collection a Collection containing the AllDay NFTs
71
72
// that were withdrawn
72
73
pub fun batchWithdraw (ids : [UInt64 ]): @NonFungibleToken .Collection {
73
- var batchCollection <- Genies .createEmptyCollection ()
74
+ var batchCollection <- AllDay .createEmptyCollection ()
74
75
75
76
// Iterate through the ids and withdraw them from the Collection
76
77
for id in ids {
@@ -79,7 +80,7 @@ pub contract GeniesShardedCollection {
79
80
return <- batchCollection
80
81
}
81
82
82
- // deposit takes a Genies NFT and adds it to the Collections dictionary
83
+ // deposit takes a AllDay NFT and adds it to the Collections dictionary
83
84
pub fun deposit (token : @NonFungibleToken .NFT ) {
84
85
85
86
// Find the bucket this corresponds to
@@ -120,7 +121,7 @@ pub contract GeniesShardedCollection {
120
121
return ids
121
122
}
122
123
123
- // borrowNFT Returns a borrowed reference to a Genies NFT in the Collection
124
+ // borrowNFT Returns a borrowed reference to a AllDay NFT in the Collection
124
125
// so that the caller can read data and call methods from it
125
126
pub fun borrowNFT (id : UInt64 ): &NonFungibleToken .NFT {
126
127
post {
@@ -134,7 +135,7 @@ pub contract GeniesShardedCollection {
134
135
return self .collections[bucket]? .borrowNFT (id : id)!
135
136
}
136
137
137
- // borrowGeniesNFT Returns a borrowed reference to a Genies NFT in the Collection
138
+ // borrowMomentNFT Returns a borrowed reference to a AllDay NFT in the Collection
138
139
// so that the caller can read data and call methods from it
139
140
// They can use this to read its setID, playID, serialNumber,
140
141
// or any of the setData or Play Data associated with it by
@@ -144,12 +145,12 @@ pub contract GeniesShardedCollection {
144
145
// Parameters: id: The ID of the NFT to get the reference for
145
146
//
146
147
// Returns: A reference to the NFT
147
- pub fun borrowGeniesNFT (id : UInt64 ): &Genies .NFT ? {
148
+ pub fun borrowMomentNFT (id : UInt64 ): &AllDay .NFT ? {
148
149
149
150
// Get the bucket of the nft to be borrowed
150
151
let bucket = id % self .numBuckets
151
152
152
- return self .collections[bucket]? .borrowGeniesNFT (id : id) ?? nil
153
+ return self .collections[bucket]? .borrowMomentNFT (id : id) ?? nil
153
154
}
154
155
155
156
// If a transaction destroys the Collection object,
@@ -166,7 +167,7 @@ pub contract GeniesShardedCollection {
166
167
167
168
init () {
168
169
// Set the named paths
169
- self .CollectionStoragePath = / storage/ GeniesShardedNFTCollection
170
+ self .CollectionStoragePath = / storage/ AllDayShardedNFTCollection
170
171
}
171
172
}
172
173
0 commit comments