Skip to content

Commit

Permalink
Working on repo structure
Browse files Browse the repository at this point in the history
  • Loading branch information
lealobanov committed Dec 11, 2024
1 parent c68c96c commit b470d09
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions cadence/contracts/Recipe.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ access(all) contract ExampleNFT: NonFungibleToken {
/// Withdraws an NFT from the Collection
access(NonFungibleToken.Withdraw) fun withdraw(withdrawID: UInt64): @{NonFungibleToken.NFT} {
let token <- self.ownedNFTs.remove(key: withdrawID)
?? panic("CustomNFT.Collection: Cannot withdraw NFT. ID not found.")
?? panic("ExampleNFT.Collection: Cannot withdraw NFT. ID not found.")
return <-token
}

/// Deposits an NFT into the Collection
access(all) fun deposit(token: @{NonFungibleToken.NFT}) {
let token <- token as! @CustomNFT.NFT
let token <- token as! @ExampleNFT.NFT
let id = token.id
let oldToken <- self.ownedNFTs[id] <- token
destroy oldToken
Expand All @@ -107,7 +107,7 @@ access(all) contract ExampleNFT: NonFungibleToken {

/// Creates an empty Collection and returns it
access(all) fun createEmptyCollection(): @{NonFungibleToken.Collection} {
return <-CustomNFT.createEmptyCollection()
return <-ExampleNFT.createEmptyCollection()
}
}

Expand All @@ -121,7 +121,7 @@ access(all) contract ExampleNFT: NonFungibleToken {
thumbnail: String,
traits: {String: String},
royalties: [MetadataViews.Royalty]
): @CustomNFT.NFT {
): @ExampleNFT.NFT {
return <-create NFT(
name: name,
description: description,
Expand All @@ -138,16 +138,16 @@ access(all) contract ExampleNFT: NonFungibleToken {
}

init() {
self.CollectionStoragePath = /storage/customNFTCollection
self.CollectionPublicPath = /public/customNFTCollection
self.MinterStoragePath = /storage/customNFTMinter
self.CollectionStoragePath = /storage/ExampleNFTCollection
self.CollectionPublicPath = /public/ExampleNFTCollection
self.MinterStoragePath = /storage/ExampleNFTMinter

// Create and save a Collection
let collection <- create Collection()
self.account.storage.save(<-collection, to: self.CollectionStoragePath)

// Publish the Collection's capability
let collectionCap = self.account.capabilities.storage.issue<&CustomNFT.Collection>(self.CollectionStoragePath)
let collectionCap = self.account.capabilities.storage.issue<&ExampleNFT.Collection>(self.CollectionStoragePath)
self.account.capabilities.publish(collectionCap, at: self.CollectionPublicPath)

// Create and save a Minter
Expand Down

0 comments on commit b470d09

Please sign in to comment.