Skip to main content

Contract ExampleNFT


_10
contract ExampleNFT {
_10
_10
totalSupply: UInt64
_10
_10
CollectionStoragePath: StoragePath
_10
_10
CollectionPublicPath: PublicPath
_10
_10
MinterStoragePath: StoragePath
_10
}

Implemented Interfaces:

  • NonFungibleToken

Interfaces

resource interface ExampleNFTCollectionPublic


_10
resource interface ExampleNFTCollectionPublic {
_10
}

Defines the methods that are particular to this NFT contract collection

More...


Structs & Resources

resource NFT


_14
resource NFT {
_14
_14
id: UInt64
_14
_14
name: String
_14
_14
description: String
_14
_14
thumbnail: String
_14
_14
royalties: [MetadataViews.Royalty]
_14
_14
metadata: {String: AnyStruct}
_14
}

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


_10
resource Collection {
_10
_10
ownedNFTs: {UInt64: NonFungibleToken.NFT}
_10
}

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


_10
resource NFTMinter {
_10
}

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

More...


Functions

fun createEmptyCollection()


_10
func createEmptyCollection(): NonFungibleToken.Collection

Allows anyone to create a new empty collection

Returns: The new Collection resource


Events

event ContractInitialized


_10
event ContractInitialized()

The event that is emitted when the contract is created


event Withdraw


_10
event Withdraw(id UInt64, from Address?)

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


event Deposit


_10
event Deposit(id UInt64, to Address?)

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