NFT Collection

A collection of NFTs by a single creator.

All NFTs from this contract are minted by the same creator. A 10% royalty to the creator is included which may be split with collaborators on a per-NFT basis.

function approve(address to, uint256 tokenId) external nonpayable

See {IERC721-approve}.

Parameters

NameTypeDescription
toaddress
tokenIduint256
function balanceOf(address owner) external view returns (uint256)

See {IERC721-balanceOf}.

Parameters

NameTypeDescription
owneraddress

Returns

NameTypeDescription
_0uint256
function baseURI() external view returns (string uri)

The base URI used for all NFTs in this collection.

The tokenCID is appended to this to obtain an NFT's tokenURI. e.g. The URI for a token with the tokenCID: "foo" and baseURI: "ipfs://" is "ipfs://foo".

Returns

NameTypeDescription
uristringThe base URI used by this collection.
function burn(uint256 tokenId) external nonpayable

Allows the creator to burn a specific token if they currently own the NFT.

The function here asserts onlyOwner while the super confirms ownership.

Parameters

NameTypeDescription
tokenIduint256The ID of the NFT to burn.
function contractFactory() external view returns (address)

The address of the factory which was used to create this contract.

Returns

NameTypeDescription
_0address
function getApproved(uint256 tokenId) external view returns (address)

See {IERC721-getApproved}.

Parameters

NameTypeDescription
tokenIduint256

Returns

NameTypeDescription
_0address
function getFeeBps(uint256) external pure returns (uint256[] royaltiesInBasisPoints)

Get the creator royalty amounts to be sent to each recipient, in basis points.

The tokenId param is ignored since all NFTs return the same value.

Parameters

NameTypeDescription
_0uint256

Returns

NameTypeDescription
royaltiesInBasisPointsuint256[]The array of fees to be sent to each recipient, in basis points.
function getFeeRecipients(uint256 tokenId) external view returns (address payable[] recipients)

Get the recipient addresses to which creator royalties should be sent.

The expected royalty amounts are communicated with getFeeBps.

Parameters

NameTypeDescription
tokenIduint256The ID of the NFT to get royalties for.

Returns

NameTypeDescription
recipientsaddress payable[]An array of addresses to which royalties should be sent.
function getHasMintedCID(string tokenCID) external view returns (bool hasBeenMinted)

Checks if the creator has already minted a given NFT using this collection contract.

Parameters

NameTypeDescription
tokenCIDstringThe CID to check for.

Returns

NameTypeDescription
hasBeenMintedboolTrue if the creator has already minted an NFT with this CID.
function getRoyalties(uint256 tokenId) external view returns (address payable[] recipients, uint256[] royaltiesInBasisPoints)

Get the creator royalties to be sent.

The data is the same as when calling getFeeRecipients and getFeeBps separately.

Parameters

NameTypeDescription
tokenIduint256The ID of the NFT to get royalties for.

Returns

NameTypeDescription
recipientsaddress payable[]An array of addresses to which royalties should be sent.
royaltiesInBasisPointsuint256[]The array of fees to be sent to each recipient, in basis points.
function getTokenCreatorPaymentAddress(uint256 tokenId) external view returns (address payable creatorPaymentAddress)

The address to pay the creator proceeds/royalties for the collection.

Parameters

NameTypeDescription
tokenIduint256The ID of the NFT to get the creator payment address for.

Returns

NameTypeDescription
creatorPaymentAddressaddress payableThe address to which royalties should be paid.
function initialize(address payable _creator, string _name, string _symbol) external nonpayable

Called by the contract factory on creation.

Parameters

NameTypeDescription
_creatoraddress payableThe creator of this collection.
_namestringThe collection's name.
_symbolstringThe collection's symbol.
function isApprovedForAll(address owner, address operator) external view returns (bool)

See {IERC721-isApprovedForAll}.

Parameters

NameTypeDescription
owneraddress
operatoraddress

Returns

NameTypeDescription
_0bool
function latestTokenId() external view returns (uint32)

The tokenId of the most recently created NFT.

Returns

NameTypeDescription
_0uint32
function maxTokenId() external view returns (uint32)

The max tokenId which can be minted.

Returns

NameTypeDescription
_0uint32
function mint(string tokenCID) external nonpayable returns (uint256 tokenId)

Mint an NFT defined by its metadata path.

This is only callable by the collection creator/owner.

Parameters

NameTypeDescription
tokenCIDstringThe CID for the metadata json of the NFT to mint.

Returns

NameTypeDescription
tokenIduint256The tokenId of the newly minted NFT.
function mintAndApprove(string tokenCID, address operator) external nonpayable returns (uint256 tokenId)

Mint an NFT defined by its metadata path and approves the provided operator address.

This is only callable by the collection creator/owner. It can be used the first time they mint to save having to issue a separate approval transaction before listing the NFT for sale.

Parameters

NameTypeDescription
tokenCIDstringThe CID for the metadata json of the NFT to mint.
operatoraddressThe address to set as an approved operator for the creator's account.

Returns

NameTypeDescription
tokenIduint256The tokenId of the newly minted NFT.
function mintWithCreatorPaymentAddress(string tokenCID, address payable tokenCreatorPaymentAddress) external nonpayable returns (uint256 tokenId)

Mint an NFT defined by its metadata path and have creator revenue/royalties sent to an alternate address.

This is only callable by the collection creator/owner.

Parameters

NameTypeDescription
tokenCIDstringThe CID for the metadata json of the NFT to mint.
tokenCreatorPaymentAddressaddress payableThe royalty recipient address to use for this NFT.

Returns

NameTypeDescription
tokenIduint256The tokenId of the newly minted NFT.
function mintWithCreatorPaymentAddressAndApprove(string tokenCID, address payable tokenCreatorPaymentAddress, address operator) external nonpayable returns (uint256 tokenId)

Mint an NFT defined by its metadata path and approves the provided operator address.

This is only callable by the collection creator/owner. It can be used the first time they mint to save having to issue a separate approval transaction before listing the NFT for sale.

Parameters

NameTypeDescription
tokenCIDstringThe CID for the metadata json of the NFT to mint.
tokenCreatorPaymentAddressaddress payableThe royalty recipient address to use for this NFT.
operatoraddressThe address to set as an approved operator for the creator's account.

Returns

NameTypeDescription
tokenIduint256The tokenId of the newly minted NFT.
function mintWithCreatorPaymentFactory(string tokenCID, address paymentAddressFactory, bytes paymentAddressCall) external nonpayable returns (uint256 tokenId)

Mint an NFT defined by its metadata path and have creator revenue/royalties sent to an alternate address which is defined by a contract call, typically a proxy contract address representing the payment terms.

This is only callable by the collection creator/owner.

Parameters

NameTypeDescription
tokenCIDstringThe CID for the metadata json of the NFT to mint.
paymentAddressFactoryaddressThe contract to call which will return the address to use for payments.
paymentAddressCallbytesThe call details to send to the factory provided.

Returns

NameTypeDescription
tokenIduint256The tokenId of the newly minted NFT.
function mintWithCreatorPaymentFactoryAndApprove(string tokenCID, address paymentAddressFactory, bytes paymentAddressCall, address operator) external nonpayable returns (uint256 tokenId)

Mint an NFT defined by its metadata path and have creator revenue/royalties sent to an alternate address which is defined by a contract call, typically a proxy contract address representing the payment terms.

This is only callable by the collection creator/owner. It can be used the first time they mint to save having to issue a separate approval transaction before listing the NFT for sale.

Parameters

NameTypeDescription
tokenCIDstringThe CID for the metadata json of the NFT to mint.
paymentAddressFactoryaddressThe contract to call which will return the address to use for payments.
paymentAddressCallbytesThe call details to send to the factory provided.
operatoraddressThe address to set as an approved operator for the creator's account.

Returns

NameTypeDescription
tokenIduint256The tokenId of the newly minted NFT.
function name() external view returns (string)

See {IERC721Metadata-name}.

Returns

NameTypeDescription
_0string
function owner() external view returns (address payable)

The creator/owner of this NFT collection.

Returns

NameTypeDescription
_0address payable
function ownerOf(uint256 tokenId) external view returns (address)

See {IERC721-ownerOf}.

Parameters

NameTypeDescription
tokenIduint256

Returns

NameTypeDescription
_0address
function royaltyInfo(uint256 tokenId, uint256 salePrice) external view returns (address receiver, uint256 royaltyAmount)

Get the creator royalties to be sent.

Parameters

NameTypeDescription
tokenIduint256The ID of the NFT to get royalties for.
salePriceuint256The total price of the sale.

Returns

NameTypeDescription
receiveraddressThe address to which royalties should be sent.
royaltyAmountuint256The total amount that should be sent to the receiver.
function safeTransferFrom(address from, address to, uint256 tokenId) external nonpayable

See {IERC721-safeTransferFrom}.

Parameters

NameTypeDescription
fromaddress
toaddress
tokenIduint256
function safeTransferFrom(address from, address to, uint256 tokenId, bytes data) external nonpayable

See {IERC721-safeTransferFrom}.

Parameters

NameTypeDescription
fromaddress
toaddress
tokenIduint256
databytes
function selfDestruct() external nonpayable

Allows the collection creator to destroy this contract only if no NFTs have been minted yet or the minted NFTs have been burned.

Once destructed, a new collection could be deployed to this address (although that's discouraged).

function setApprovalForAll(address operator, bool approved) external nonpayable

See {IERC721-setApprovalForAll}.

Parameters

NameTypeDescription
operatoraddress
approvedbool
function supportsInterface(bytes4 interfaceId) external view returns (bool interfaceSupported)

Returns true if this contract implements the interface defined by interfaceId. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.

Parameters

NameTypeDescription
interfaceIdbytes4

Returns

NameTypeDescription
interfaceSupportedbool
function symbol() external view returns (string)

See {IERC721Metadata-symbol}.

Returns

NameTypeDescription
_0string
function tokenCreator(uint256) external view returns (address payable creator)

Returns the creator of this NFT collection.

The tokenId param is ignored since all NFTs return the same value.

Parameters

NameTypeDescription
_0uint256

Returns

NameTypeDescription
creatoraddress payableThe creator of this collection.
function tokenURI(uint256 tokenId) external view returns (string uri)

Returns the Uniform Resource Identifier (URI) for tokenId token.

Parameters

NameTypeDescription
tokenIduint256

Returns

NameTypeDescription
uristring
function totalSupply() external view returns (uint256 supply)

Returns the total amount of tokens stored by the contract.

From the ERC-721 enumerable standard.

Returns

NameTypeDescription
supplyuint256The total number of NFTs tracked by this contract.
function transferFrom(address from, address to, uint256 tokenId) external nonpayable

See {IERC721-transferFrom}.

Parameters

NameTypeDescription
fromaddress
toaddress
tokenIduint256
function updateBaseURI(string baseURIOverride) external nonpayable

Allows the owner to assign a baseURI to use for the tokenURI instead of the default ipfs://.

Parameters

NameTypeDescription
baseURIOverridestringThe new base URI to use for all NFTs in this collection.
function updateMaxTokenId(uint32 _maxTokenId) external nonpayable

Allows the owner to set a max tokenID. This provides a guarantee to collectors about the limit of this collection contract, if applicable.

Once this value has been set, it may be decreased but can never be increased. This max may be more than the final totalSupply if 1 or more tokens were burned.

Parameters

NameTypeDescription
_maxTokenIduint32The max tokenId to set, all NFTs must have a tokenId less than or equal to this value.
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId)

Parameters

NameTypeDescription
owner indexedaddress
approved indexedaddress
tokenId indexeduint256
event ApprovalForAll(address indexed owner, address indexed operator, bool approved)

Parameters

NameTypeDescription
owner indexedaddress
operator indexedaddress
approvedbool
event BaseURIUpdated(string baseURI)

Emitted when the owner changes the base URI to be used for NFTs in this collection.

Parameters

NameTypeDescription
baseURIstringThe new base URI to use.
event Initialized(uint8 version)

Parameters

NameTypeDescription
versionuint8
event MaxTokenIdUpdated(uint256 indexed maxTokenId)

Emitted when the max tokenId supported by this collection is updated.

Parameters

NameTypeDescription
maxTokenId indexeduint256
event Minted(address indexed creator, uint256 indexed tokenId, string indexed indexedTokenCID, string tokenCID)

Emitted when a new NFT is minted.

Parameters

NameTypeDescription
creator indexedaddressThe address of the collection owner at this time this NFT was minted.
tokenId indexeduint256The tokenId of the newly minted NFT.
indexedTokenCID indexedstringThe CID of the newly minted NFT, indexed to enable watching for mint events by the tokenCID.
tokenCIDstringThe actual CID of the newly minted NFT.
event SelfDestruct(address indexed admin)

Emitted when this collection is self destructed by the creator/owner/admin.

Parameters

NameTypeDescription
admin indexedaddress
event TokenCreatorPaymentAddressSet(address indexed fromPaymentAddress, address indexed toPaymentAddress, uint256 indexed tokenId)

Emitted when the payment address for creator royalties is set.

Parameters

NameTypeDescription
fromPaymentAddress indexedaddressThe original address used for royalty payments.
toPaymentAddress indexedaddressThe new address used for royalty payments.
tokenId indexeduint256The NFT which had the royalty payment address updated.
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)

Parameters

NameTypeDescription
from indexedaddress
to indexedaddress
tokenId indexeduint256