Skip to main content

MintableERC721

MintableERC721#

Functions#

constructor(string _name, string _symbol) (public)
mint(address to, uint256 tokenId) (public)
supportsInterface(bytes4 interfaceId) โ†’ bool (public)

See {IERC165-supportsInterface}.

balanceOf(address owner) โ†’ uint256 (public)

See {IERC721-balanceOf}.

ownerOf(uint256 tokenId) โ†’ address (public)

See {IERC721-ownerOf}.

name() โ†’ string (public)

See {IERC721Metadata-name}.

symbol() โ†’ string (public)

See {IERC721Metadata-symbol}.

tokenURI(uint256 tokenId) โ†’ string (public)

See {IERC721Metadata-tokenURI}.

_baseURI() โ†’ string (internal)

Base URI for computing {tokenURI}. If set, the resulting URI for each token will be the concatenation of the baseURI and the tokenId. Empty by default, can be overriden in child contracts.

approve(address to, uint256 tokenId) (public)

See {IERC721-approve}.

getApproved(uint256 tokenId) โ†’ address (public)

See {IERC721-getApproved}.

setApprovalForAll(address operator, bool approved) (public)

See {IERC721-setApprovalForAll}.

isApprovedForAll(address owner, address operator) โ†’ bool (public)

See {IERC721-isApprovedForAll}.

transferFrom(address from, address to, uint256 tokenId) (public)

See {IERC721-transferFrom}.

safeTransferFrom(address from, address to, uint256 tokenId) (public)

See {IERC721-safeTransferFrom}.

safeTransferFrom(address from, address to, uint256 tokenId, bytes _data) (public)

See {IERC721-safeTransferFrom}.

_safeTransfer(address from, address to, uint256 tokenId, bytes _data) (internal)

Safely transfers tokenId token from from to to, checking first that contract recipients are aware of the ERC721 protocol to prevent tokens from being forever locked. _data is additional data, it has no specified format and it is sent in call to to. This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. implement alternative mechanisms to perform token transfer, such as signature-based. Requirements:

  • from cannot be the zero address.
  • to cannot be the zero address.
  • tokenId token must exist and be owned by from.
  • If to refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. Emits a {Transfer} event.
_exists(uint256 tokenId) โ†’ bool (internal)

Returns whether tokenId exists. Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. Tokens start existing when they are minted (_mint), and stop existing when they are burned (_burn).

_isApprovedOrOwner(address spender, uint256 tokenId) โ†’ bool (internal)

Returns whether spender is allowed to manage tokenId. Requirements:

  • tokenId must exist.
_safeMint(address to, uint256 tokenId) (internal)

Safely mints tokenId and transfers it to to. Requirements:

  • tokenId must not exist.
  • If to refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. Emits a {Transfer} event.
_safeMint(address to, uint256 tokenId, bytes _data) (internal)

Same as {xref-ERC721-_safeMint-address-uint256-}[_safeMint], with an additional data parameter which is forwarded in {IERC721Receiver-onERC721Received} to contract recipients.

_mint(address to, uint256 tokenId) (internal)

Mints tokenId and transfers it to to. WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible Requirements:

  • tokenId must not exist.
  • to cannot be the zero address. Emits a {Transfer} event.
_burn(uint256 tokenId) (internal)

Destroys tokenId. The approval is cleared when the token is burned. Requirements:

  • tokenId must exist. Emits a {Transfer} event.
_transfer(address from, address to, uint256 tokenId) (internal)

Transfers tokenId from from to to. As opposed to {transferFrom}, this imposes no restrictions on msg.sender. Requirements:

  • to cannot be the zero address.
  • tokenId token must be owned by from. Emits a {Transfer} event.
_approve(address to, uint256 tokenId) (internal)

Approve to to operate on tokenId Emits a {Approval} event.

_setApprovalForAll(address owner, address operator, bool approved) (internal)

Approve operator to operate on all of owner tokens Emits a {ApprovalForAll} event.

_beforeTokenTransfer(address from, address to, uint256 tokenId) (internal)

Hook that is called before any token transfer. This includes minting and burning. Calling conditions:

  • When from and to are both non-zero, from's tokenId will be transferred to to.
  • When from is zero, tokenId will be minted for to.
  • When to is zero, from's tokenId will be burned.
  • from and to are never both zero. To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
_msgSender() โ†’ address (internal)
_msgData() โ†’ bytes (internal)

Events#

Transfer(address from, address to, uint256 tokenId)

Emitted when tokenId token is transferred from from to to.

Approval(address owner, address approved, uint256 tokenId)

Emitted when owner enables approved to manage the tokenId token.

ApprovalForAll(address owner, address operator, bool approved)

Emitted when owner enables or disables (approved) operator to manage all of its assets.