NFT Drop Collection

A contract to batch mint a collection of NFTs.

A 10% royalty to the creator is included which may be split with collaborators.

A collection can have up to 4,294,967,295 (2^32-1) tokens

function DEFAULT_ADMIN_ROLE() external view returns (bytes32)

Returns

NameTypeDescription
_0bytes32
function MINTER_ROLE() external view returns (bytes32)

The role type used for approve minters.

Returns

NameTypeDescription
_0bytes32
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)

The base URI used for all NFTs in this collection.

The <tokenId>.json is appended to this to obtain an NFT's tokenURI. e.g. The URI for tokenId: "1" with baseURI: "ipfs://foo/" is "ipfs://foo/1.json".

Returns

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

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

The function here asserts onlyAdmin 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 getRoleAdmin(bytes32 role) external view returns (bytes32)

Returns the admin role that controls role. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.

Parameters

NameTypeDescription
rolebytes32

Returns

NameTypeDescription
_0bytes32
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) external view returns (address payable creatorPaymentAddress)

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

Parameters

NameTypeDescription
_0uint256

Returns

NameTypeDescription
creatorPaymentAddressaddress payableThe address to which royalties should be paid.
function grantAdmin(address account) external nonpayable

Adds an account as an approved admin.

Only callable by existing admins, as enforced by grantRole.

Parameters

NameTypeDescription
accountaddressThe address to be approved.
function grantMinter(address account) external nonpayable

Adds an account as an approved minter.

Only callable by admins, as enforced by grantRole.

Parameters

NameTypeDescription
accountaddressThe address to be approved.
function grantRole(bytes32 role, address account) external nonpayable

Grants role to account. If account had not been already granted role, emits a {RoleGranted} event. Requirements: - the caller must have role's admin role. May emit a {RoleGranted} event.

Parameters

NameTypeDescription
rolebytes32
accountaddress
function hasRole(bytes32 role, address account) external view returns (bool)

Returns true if account has been granted role.

Parameters

NameTypeDescription
rolebytes32
accountaddress

Returns

NameTypeDescription
_0bool
function initialize(address payable _creator, string _name, string _symbol, string baseURI_, bool _isRevealed, uint32 _maxTokenId, address _approvedMinter, address payable _paymentAddress) external nonpayable

Called by the contract factory on creation.

Parameters

NameTypeDescription
_creatoraddress payableThe creator of this collection. This account is the default admin for this collection.
_namestringThe collection's name.
_symbolstringThe collection's symbol.
baseURI_stringThe base URI for the collection.
_isRevealedboolWhether the collection is revealed or not.
_maxTokenIduint32The max token id for this collection.
_approvedMinteraddressAn optional address to grant the MINTER_ROLE. Set to address(0) if only admins should be granted permission to mint.
_paymentAddressaddress payableThe address that will receive royalties and mint payments.
function isAdmin(address account) external view returns (bool approved)

Checks if the account provided is an admin.

This call is used by the royalty registry contract.

Parameters

NameTypeDescription
accountaddressThe address to check.

Returns

NameTypeDescription
approvedboolTrue if the account is an admin.
function isApprovedForAll(address owner, address operator) external view returns (bool)

See {IERC721-isApprovedForAll}.

Parameters

NameTypeDescription
owneraddress
operatoraddress

Returns

NameTypeDescription
_0bool
function isMinter(address account) external view returns (bool approved)

Checks if the account provided is an minter.

Parameters

NameTypeDescription
accountaddressThe address to check.

Returns

NameTypeDescription
approvedboolTrue if the account is an minter.
function isRevealed() external view returns (bool)

Whether the collection is revealed or not.

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 mintCountTo(uint16 count, address to) external nonpayable returns (uint256 firstTokenId)

Mint count number of NFTs for the to address.

This is only callable by an address with either the MINTER_ROLE or the DEFAULT_ADMIN_ROLE.

Parameters

NameTypeDescription
countuint16The number of NFTs to mint.
toaddressThe address to mint the NFTs for.

Returns

NameTypeDescription
firstTokenIduint256The tokenId for the first NFT minted. The other minted tokens are assigned sequentially, so firstTokenId - firstTokenId + count - 1 were minted.
function name() external view returns (string)

See {IERC721Metadata-name}.

Returns

NameTypeDescription
_0string
function numberOfTokensAvailableToMint() external view returns (uint256 count)

Get the number of tokens which can still be minted.

Returns

NameTypeDescription
countuint256The max number of additional NFTs that can be minted by this collection.
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 renounceRole(bytes32 role, address account) external nonpayable

Revokes role from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked role, emits a {RoleRevoked} event. Requirements: - the caller must be account. May emit a {RoleRevoked} event.

Parameters

NameTypeDescription
rolebytes32
accountaddress
function reveal(string baseURI_) external nonpayable

Allows a collection admin to reveal the collection's final content.

Once revealed, the collection's content is immutable. Use updatePreRevealContent to update content while unrevealed.

Parameters

NameTypeDescription
baseURI_stringThe base URI of the final content for this collection.
function revokeAdmin(address account) external nonpayable

Removes an account from the set of approved admins.

Only callable by existing admins, as enforced by revokeRole.

Parameters

NameTypeDescription
accountaddressThe address to be removed.
function revokeMinter(address account) external nonpayable

Removes an account from the set of approved minters.

Only callable by admins, as enforced by revokeRole.

Parameters

NameTypeDescription
accountaddressThe address to be removed.
function revokeRole(bytes32 role, address account) external nonpayable

Revokes role from account. If account had been granted role, emits a {RoleRevoked} event. Requirements: - the caller must have role's admin role. May emit a {RoleRevoked} event.

Parameters

NameTypeDescription
rolebytes32
accountaddress
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 a collection admin 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 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.

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.
function updatePreRevealContent(string baseURI_) external nonpayable

Allows a collection admin to update the pre-reveal content.

Use reveal to reveal the final content for this collection.

Parameters

NameTypeDescription
baseURI_stringThe base URI of the pre-reveal content.
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 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 RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole)

Parameters

NameTypeDescription
role indexedbytes32
previousAdminRole indexedbytes32
newAdminRole indexedbytes32
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender)

Parameters

NameTypeDescription
role indexedbytes32
account indexedaddress
sender indexedaddress
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender)

Parameters

NameTypeDescription
role indexedbytes32
account indexedaddress
sender indexedaddress
event SelfDestruct(address indexed admin)

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

Parameters

NameTypeDescription
admin indexedaddress
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)

Parameters

NameTypeDescription
from indexedaddress
to indexedaddress
tokenId indexeduint256
event URIUpdated(string baseURI, bool isRevealed)

Emitted when the collection is revealed.

Parameters

NameTypeDescription
baseURIstringThe base URI for the collection.
isRevealedboolWhether the collection is revealed.