Skip to content

Commit

Permalink
update fastbreakv1
Browse files Browse the repository at this point in the history
  • Loading branch information
judezhu committed Aug 7, 2024
1 parent 1c1dd7c commit 2bb483d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
flow.json
/imports
.vscode
.env
.env
**/vendor/
29 changes: 25 additions & 4 deletions contracts/FastBreakV1.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
*/

import NonFungibleToken from 0xNFTADDRESS
import TopShot from 0xTOPSHOTADDRESS
import MetadataViews from 0xMETADATAVIEWSADDRESS
import NonFungibleToken from "NonFungibleToken"
import TopShot from "TopShot"
import MetadataViews from "MetadataViews"

/// Game & Oracle Contract for Fast Break V1
///
Expand Down Expand Up @@ -383,7 +383,7 @@ access(all) contract FastBreakV1: NonFungibleToken {
/// Resource for playing Fast Break
/// The Fast Break Player plays the game & mints game tokens
///
access(all) resource Player: FastBreakPlayer {
access(all) resource Player: FastBreakPlayer, NonFungibleToken.NFT {

access(all) let id: UInt64
access(all) let playerName: String /// username
Expand Down Expand Up @@ -521,6 +521,27 @@ access(all) contract FastBreakV1: NonFungibleToken {
topShots: updatedSubmission.topShots,
)
}

access(all) fun createEmptyCollection(): @{NonFungibleToken.Collection} {
return <- FastBreakV1.createEmptyCollection(nftType: Type<@FastBreakV1.Player>())
}

access(all) view fun getViews(): [Type] {
return [
Type<MetadataViews.NFTCollectionData>(),
Type<MetadataViews.NFTCollectionDisplay>()
]
}

access(all) fun resolveView(_ view: Type): AnyStruct? {
switch view {
case Type<MetadataViews.NFTCollectionData>():
return FastBreakV1.resolveContractView(resourceType: nil, viewType: Type<MetadataViews.NFTCollectionData>())
case Type<MetadataViews.NFTCollectionDisplay>():
return FastBreakV1.resolveContractView(resourceType: nil, viewType: Type<MetadataViews.NFTCollectionDisplay>())
}
return nil
}
}

access(all) struct PlayerData {
Expand Down

0 comments on commit 2bb483d

Please sign in to comment.