Skip to content

Commit 0bb113a

Browse files
authored
Merge pull request #1 from dapperlabs/sadie/feat/update-nft-contract
NFL NFT contract
2 parents d1181ef + 7e08cad commit 0bb113a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+2290
-2160
lines changed

contracts/AllDay.cdc

Lines changed: 837 additions & 0 deletions
Large diffs are not rendered by default.

contracts/GeniesShardedCollection.cdc renamed to contracts/AllDayShardedCollection.cdc

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
/*
2-
Description: Central Collection for a large number of Genies NFTs
2+
Description: Central Collection for a large number of Moment NFTs
33
4-
Adapted from: TopShotShardedCollection.cdc
4+
Adapted from: GeniesShardedCollection.cdc
55
Authors: Joshua Hannan [email protected]
66
Bastian Muller [email protected]
7+
Rhea Myers [email protected]
78
89
[...]
910
@@ -12,25 +13,25 @@
1213
*/
1314

1415
import NonFungibleToken from "./NonFungibleToken.cdc"
15-
import Genies from "./Genies.cdc"
16+
import AllDay from "./AllDay.cdc"
1617

17-
pub contract GeniesShardedCollection {
18+
pub contract AllDayShardedCollection {
1819
// Named Paths
1920
//
2021
pub let CollectionStoragePath: StoragePath
2122

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
2425
pub resource ShardedCollection:
25-
Genies.GeniesNFTCollectionPublic,
26+
AllDay.MomentNFTCollectionPublic,
2627
NonFungibleToken.Provider,
2728
NonFungibleToken.Receiver,
2829
NonFungibleToken.CollectionPublic
2930
{
30-
// Dictionary of Genies collections
31-
pub var collections: @{UInt64: Genies.Collection}
31+
// Dictionary of AllDay collections
32+
pub var collections: @{UInt64: AllDay.Collection}
3233

33-
// The number of buckets to split Genies NFTs into
34+
// The number of buckets to split AllDay NFTs into
3435
// This makes storage more efficient and performant
3536
pub let numBuckets: UInt64
3637

@@ -42,13 +43,13 @@ pub contract GeniesShardedCollection {
4243
var i: UInt64 = 0
4344
while i < numBuckets {
4445

45-
self.collections[i] <-! Genies.createEmptyCollection() as! @Genies.Collection
46+
self.collections[i] <-! AllDay.createEmptyCollection() as! @AllDay.Collection
4647

4748
i = i + (1 as UInt64)
4849
}
4950
}
5051

51-
// withdraw removes a Genies NFT from one of the Collections
52+
// withdraw removes a AllDay NFT from one of the Collections
5253
// and moves it to the caller
5354
pub fun withdraw(withdrawID: UInt64): @NonFungibleToken.NFT {
5455
post {
@@ -57,7 +58,7 @@ pub contract GeniesShardedCollection {
5758
// Find the bucket it should be withdrawn from
5859
let bucket = withdrawID % self.numBuckets
5960

60-
// Withdraw the Genies NFT
61+
// Withdraw the AllDay NFT
6162
let token <- self.collections[bucket]?.withdraw(withdrawID: withdrawID)!
6263

6364
return <-token
@@ -67,10 +68,10 @@ pub contract GeniesShardedCollection {
6768
//
6869
// Parameters: ids: an array of the IDs to be withdrawn from the Collection
6970
//
70-
// Returns: @NonFungibleToken.Collection a Collection containing the Genies NFTs
71+
// Returns: @NonFungibleToken.Collection a Collection containing the AllDay NFTs
7172
// that were withdrawn
7273
pub fun batchWithdraw(ids: [UInt64]): @NonFungibleToken.Collection {
73-
var batchCollection <- Genies.createEmptyCollection()
74+
var batchCollection <- AllDay.createEmptyCollection()
7475

7576
// Iterate through the ids and withdraw them from the Collection
7677
for id in ids {
@@ -79,7 +80,7 @@ pub contract GeniesShardedCollection {
7980
return <-batchCollection
8081
}
8182

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
8384
pub fun deposit(token: @NonFungibleToken.NFT) {
8485

8586
// Find the bucket this corresponds to
@@ -120,7 +121,7 @@ pub contract GeniesShardedCollection {
120121
return ids
121122
}
122123

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
124125
// so that the caller can read data and call methods from it
125126
pub fun borrowNFT(id: UInt64): &NonFungibleToken.NFT {
126127
post {
@@ -134,7 +135,7 @@ pub contract GeniesShardedCollection {
134135
return self.collections[bucket]?.borrowNFT(id: id)!
135136
}
136137

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
138139
// so that the caller can read data and call methods from it
139140
// They can use this to read its setID, playID, serialNumber,
140141
// or any of the setData or Play Data associated with it by
@@ -144,12 +145,12 @@ pub contract GeniesShardedCollection {
144145
// Parameters: id: The ID of the NFT to get the reference for
145146
//
146147
// Returns: A reference to the NFT
147-
pub fun borrowGeniesNFT(id: UInt64): &Genies.NFT? {
148+
pub fun borrowMomentNFT(id: UInt64): &AllDay.NFT? {
148149

149150
// Get the bucket of the nft to be borrowed
150151
let bucket = id % self.numBuckets
151152

152-
return self.collections[bucket]?.borrowGeniesNFT(id: id) ?? nil
153+
return self.collections[bucket]?.borrowMomentNFT(id: id) ?? nil
153154
}
154155

155156
// If a transaction destroys the Collection object,
@@ -166,7 +167,7 @@ pub contract GeniesShardedCollection {
166167

167168
init() {
168169
// Set the named paths
169-
self.CollectionStoragePath = /storage/GeniesShardedNFTCollection
170+
self.CollectionStoragePath = /storage/AllDayShardedNFTCollection
170171
}
171172
}
172173

0 commit comments

Comments
 (0)