Skip to main content
Version: Next

Contract ExampleNFT

contract ExampleNFT {

totalSupply: UInt64

CollectionStoragePath: StoragePath

CollectionPublicPath: PublicPath

MinterStoragePath: StoragePath
}

Implemented Interfaces:

  • NonFungibleToken

Interfaces

resource interface ExampleNFTCollectionPublic

resource interface ExampleNFTCollectionPublic {
}

Defines the methods that are particular to this NFT contract collection

More...


Structs & Resources

resource NFT

resource NFT {

id: UInt64

name: String

description: String

thumbnail: String

royalties: [MetadataViews.Royalty]

metadata: {String: AnyStruct}
}

The core resource that represents a Non Fungible Token. New instances will be created using the NFTMinter resource and stored in the Collection resource

More...


resource Collection

resource Collection {

ownedNFTs: {UInt64: NonFungibleToken.NFT}
}

The resource that will be holding the NFTs inside any account. In order to be able to manage NFTs any account will need to create an empty collection first

More...


resource NFTMinter

resource NFTMinter {
}

Resource that an admin or something similar would own to be able to mint new NFTs

More...


Functions

fun createEmptyCollection()

func createEmptyCollection(): NonFungibleToken.Collection

Allows anyone to create a new empty collection

Returns: The new Collection resource


Events

event ContractInitialized

event ContractInitialized()

The event that is emitted when the contract is created


event Withdraw

event Withdraw(id UInt64, from Address?)

The event that is emitted when an NFT is withdrawn from a Collection


event Deposit

event Deposit(id UInt64, to Address?)

The event that is emitted when an NFT is deposited to a Collection