Update docs
This commit is contained in:
@ -190,6 +190,7 @@
|
||||
:xref-IERC1155Errors-ERC1155InvalidOperator-address-: xref:interfaces.adoc#IERC1155Errors-ERC1155InvalidOperator-address-
|
||||
:xref-IERC1155Errors-ERC1155InvalidArrayLength-uint256-uint256-: xref:interfaces.adoc#IERC1155Errors-ERC1155InvalidArrayLength-uint256-uint256-
|
||||
:ERC1155-_update: pass:normal[xref:token/ERC1155.adoc#ERC1155-_update-address-address-uint256---uint256---[`ERC1155._update`]]
|
||||
:ERC721URIStorage: pass:normal[xref:token/ERC721.adoc#ERC721URIStorage[`ERC721URIStorage`]]
|
||||
:xref-ERC1155URIStorage-uri-uint256-: xref:token/ERC1155.adoc#ERC1155URIStorage-uri-uint256-
|
||||
:xref-ERC1155URIStorage-_setURI-uint256-string-: xref:token/ERC1155.adoc#ERC1155URIStorage-_setURI-uint256-string-
|
||||
:xref-ERC1155URIStorage-_setBaseURI-string-: xref:token/ERC1155.adoc#ERC1155URIStorage-_setBaseURI-string-
|
||||
@ -226,14 +227,18 @@
|
||||
:xref-ERC1155Holder-onERC1155Received-address-address-uint256-uint256-bytes-: xref:token/ERC1155.adoc#ERC1155Holder-onERC1155Received-address-address-uint256-uint256-bytes-
|
||||
:xref-ERC1155Holder-onERC1155BatchReceived-address-address-uint256---uint256---bytes-: xref:token/ERC1155.adoc#ERC1155Holder-onERC1155BatchReceived-address-address-uint256---uint256---bytes-
|
||||
:IERC165-supportsInterface: pass:normal[xref:utils.adoc#IERC165-supportsInterface-bytes4-[`IERC165.supportsInterface`]]
|
||||
= ERC 1155
|
||||
:xref-ERC1155Utils-checkOnERC1155Received-address-address-address-uint256-uint256-bytes-: xref:token/ERC1155.adoc#ERC1155Utils-checkOnERC1155Received-address-address-address-uint256-uint256-bytes-
|
||||
:xref-ERC1155Utils-checkOnERC1155BatchReceived-address-address-address-uint256---uint256---bytes-: xref:token/ERC1155.adoc#ERC1155Utils-checkOnERC1155BatchReceived-address-address-address-uint256---uint256---bytes-
|
||||
:IERC1155Receiver-onERC1155Received: pass:normal[xref:token/ERC1155.adoc#IERC1155Receiver-onERC1155Received-address-address-uint256-uint256-bytes-[`IERC1155Receiver.onERC1155Received`]]
|
||||
:IERC1155Receiver-onERC1155Received: pass:normal[xref:token/ERC1155.adoc#IERC1155Receiver-onERC1155Received-address-address-uint256-uint256-bytes-[`IERC1155Receiver.onERC1155Received`]]
|
||||
= ERC-1155
|
||||
|
||||
[.readme-notice]
|
||||
NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/api/token/erc1155
|
||||
|
||||
This set of interfaces and contracts are all related to the https://eips.ethereum.org/EIPS/eip-1155[ERC1155 Multi Token Standard].
|
||||
This set of interfaces and contracts are all related to the https://eips.ethereum.org/EIPS/eip-1155[ERC-1155 Multi Token Standard].
|
||||
|
||||
The EIP consists of three interfaces which fulfill different roles, found here as {IERC1155}, {IERC1155MetadataURI} and {IERC1155Receiver}.
|
||||
The ERC consists of three interfaces which fulfill different roles, found here as {IERC1155}, {IERC1155MetadataURI} and {IERC1155Receiver}.
|
||||
|
||||
{ERC1155} implements the mandatory {IERC1155} interface, as well as the optional extension {IERC1155MetadataURI}, by relying on the substitution mechanism to use the same URI for all token types, dramatically reducing gas costs.
|
||||
|
||||
@ -242,7 +247,7 @@ Additionally there are multiple custom extensions, including:
|
||||
* designation of addresses that can pause token transfers for all users ({ERC1155Pausable}).
|
||||
* destruction of own tokens ({ERC1155Burnable}).
|
||||
|
||||
NOTE: This core set of contracts is designed to be unopinionated, allowing developers to access the internal functions in ERC1155 (such as <<ERC1155-_mint-address-uint256-uint256-bytes-,`_mint`>>) and expose them as external functions in the way they prefer.
|
||||
NOTE: This core set of contracts is designed to be unopinionated, allowing developers to access the internal functions in ERC-1155 (such as <<ERC1155-_mint-address-uint256-uint256-bytes-,`_mint`>>) and expose them as external functions in the way they prefer.
|
||||
|
||||
== Core
|
||||
|
||||
@ -259,15 +264,15 @@ NOTE: This core set of contracts is designed to be unopinionated, allowing devel
|
||||
|
||||
[.contract]
|
||||
[[IERC1155]]
|
||||
=== `++IERC1155++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/token/ERC1155/IERC1155.sol[{github-icon},role=heading-link]
|
||||
=== `++IERC1155++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.1.0/contracts/token/ERC1155/IERC1155.sol[{github-icon},role=heading-link]
|
||||
|
||||
[.hljs-theme-light.nopadding]
|
||||
```solidity
|
||||
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
|
||||
```
|
||||
|
||||
Required interface of an ERC1155 compliant contract, as defined in the
|
||||
https://eips.ethereum.org/EIPS/eip-1155[EIP].
|
||||
Required interface of an ERC-1155 compliant contract, as defined in the
|
||||
https://eips.ethereum.org/EIPS/eip-1155[ERC].
|
||||
|
||||
[.contract-index]
|
||||
.Functions
|
||||
@ -304,10 +309,6 @@ https://eips.ethereum.org/EIPS/eip-1155[EIP].
|
||||
|
||||
Returns the value of tokens of token type `id` owned by `account`.
|
||||
|
||||
Requirements:
|
||||
|
||||
- `account` cannot be the zero address.
|
||||
|
||||
[.contract-item]
|
||||
[[IERC1155-balanceOfBatch-address---uint256---]]
|
||||
==== `[.contract-item-name]#++balanceOfBatch++#++(address[] accounts, uint256[] ids) → uint256[]++` [.item-kind]#external#
|
||||
@ -328,7 +329,7 @@ Emits an {ApprovalForAll} event.
|
||||
|
||||
Requirements:
|
||||
|
||||
- `operator` cannot be the caller.
|
||||
- `operator` cannot be the zero address.
|
||||
|
||||
[.contract-item]
|
||||
[[IERC1155-isApprovedForAll-address-address-]]
|
||||
@ -412,7 +413,7 @@ returned by {IERC1155MetadataURI-uri}.
|
||||
|
||||
[.contract]
|
||||
[[IERC1155MetadataURI]]
|
||||
=== `++IERC1155MetadataURI++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol[{github-icon},role=heading-link]
|
||||
=== `++IERC1155MetadataURI++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.1.0/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol[{github-icon},role=heading-link]
|
||||
|
||||
[.hljs-theme-light.nopadding]
|
||||
```solidity
|
||||
@ -420,7 +421,7 @@ import "@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol
|
||||
```
|
||||
|
||||
Interface of the optional ERC1155MetadataExtension interface, as defined
|
||||
in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].
|
||||
in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[ERC].
|
||||
|
||||
[.contract-index]
|
||||
.Functions
|
||||
@ -489,7 +490,7 @@ clients with the actual token type ID.
|
||||
|
||||
[.contract]
|
||||
[[ERC1155]]
|
||||
=== `++ERC1155++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/token/ERC1155/ERC1155.sol[{github-icon},role=heading-link]
|
||||
=== `++ERC1155++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.1.0/contracts/token/ERC1155/ERC1155.sol[{github-icon},role=heading-link]
|
||||
|
||||
[.hljs-theme-light.nopadding]
|
||||
```solidity
|
||||
@ -613,7 +614,7 @@ See {IERC1155MetadataURI-uri}.
|
||||
|
||||
This implementation returns the same URI for *all* token types. It relies
|
||||
on the token type ID substitution mechanism
|
||||
https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
|
||||
https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the ERC].
|
||||
|
||||
Clients calling this function must replace the `\{id\}` substring with the
|
||||
actual token type ID.
|
||||
@ -722,7 +723,7 @@ acceptance magic value.
|
||||
|
||||
Sets a new URI for all token types, by relying on the token type ID
|
||||
substitution mechanism
|
||||
https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
|
||||
https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the ERC].
|
||||
|
||||
By this mechanism, any occurrence of the `\{id\}` substring in either the
|
||||
URI or any of the values in the JSON file at said URI will be replaced by
|
||||
@ -811,7 +812,7 @@ Requirements:
|
||||
|
||||
[.contract]
|
||||
[[IERC1155Receiver]]
|
||||
=== `++IERC1155Receiver++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/token/ERC1155/IERC1155Receiver.sol[{github-icon},role=heading-link]
|
||||
=== `++IERC1155Receiver++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.1.0/contracts/token/ERC1155/IERC1155Receiver.sol[{github-icon},role=heading-link]
|
||||
|
||||
[.hljs-theme-light.nopadding]
|
||||
```solidity
|
||||
@ -837,7 +838,7 @@ ERC-1155 token transfers.
|
||||
[[IERC1155Receiver-onERC1155Received-address-address-uint256-uint256-bytes-]]
|
||||
==== `[.contract-item-name]#++onERC1155Received++#++(address operator, address from, uint256 id, uint256 value, bytes data) → bytes4++` [.item-kind]#external#
|
||||
|
||||
Handles the receipt of a single ERC1155 token type. This function is
|
||||
Handles the receipt of a single ERC-1155 token type. This function is
|
||||
called at the end of a `safeTransferFrom` after the balance has been updated.
|
||||
|
||||
NOTE: To accept the transfer, this must return
|
||||
@ -848,7 +849,7 @@ NOTE: To accept the transfer, this must return
|
||||
[[IERC1155Receiver-onERC1155BatchReceived-address-address-uint256---uint256---bytes-]]
|
||||
==== `[.contract-item-name]#++onERC1155BatchReceived++#++(address operator, address from, uint256[] ids, uint256[] values, bytes data) → bytes4++` [.item-kind]#external#
|
||||
|
||||
Handles the receipt of a multiple ERC1155 token types. This function
|
||||
Handles the receipt of a multiple ERC-1155 token types. This function
|
||||
is called at the end of a `safeBatchTransferFrom` after the balances have
|
||||
been updated.
|
||||
|
||||
@ -862,14 +863,14 @@ NOTE: To accept the transfer(s), this must return
|
||||
|
||||
[.contract]
|
||||
[[ERC1155Pausable]]
|
||||
=== `++ERC1155Pausable++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/token/ERC1155/extensions/ERC1155Pausable.sol[{github-icon},role=heading-link]
|
||||
=== `++ERC1155Pausable++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.1.0/contracts/token/ERC1155/extensions/ERC1155Pausable.sol[{github-icon},role=heading-link]
|
||||
|
||||
[.hljs-theme-light.nopadding]
|
||||
```solidity
|
||||
import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Pausable.sol";
|
||||
```
|
||||
|
||||
ERC1155 token with pausable token transfers, minting and burning.
|
||||
ERC-1155 token with pausable token transfers, minting and burning.
|
||||
|
||||
Useful for scenarios such as preventing trades until the end of an evaluation
|
||||
period, or having an emergency switch for freezing all token transfers in the
|
||||
@ -1015,7 +1016,7 @@ Requirements:
|
||||
|
||||
[.contract]
|
||||
[[ERC1155Burnable]]
|
||||
=== `++ERC1155Burnable++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/token/ERC1155/extensions/ERC1155Burnable.sol[{github-icon},role=heading-link]
|
||||
=== `++ERC1155Burnable++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.1.0/contracts/token/ERC1155/extensions/ERC1155Burnable.sol[{github-icon},role=heading-link]
|
||||
|
||||
[.hljs-theme-light.nopadding]
|
||||
```solidity
|
||||
@ -1143,14 +1144,14 @@ own tokens and those that they have been approved to use.
|
||||
|
||||
[.contract]
|
||||
[[ERC1155Supply]]
|
||||
=== `++ERC1155Supply++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/token/ERC1155/extensions/ERC1155Supply.sol[{github-icon},role=heading-link]
|
||||
=== `++ERC1155Supply++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.1.0/contracts/token/ERC1155/extensions/ERC1155Supply.sol[{github-icon},role=heading-link]
|
||||
|
||||
[.hljs-theme-light.nopadding]
|
||||
```solidity
|
||||
import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Supply.sol";
|
||||
```
|
||||
|
||||
Extension of ERC1155 that adds tracking of total supply per id.
|
||||
Extension of ERC-1155 that adds tracking of total supply per id.
|
||||
|
||||
Useful for scenarios where Fungible and Non-fungible tokens have to be
|
||||
clearly identified. Note: While a totalSupply of 1 might mean the
|
||||
@ -1296,15 +1297,15 @@ See {ERC1155-_update}.
|
||||
|
||||
[.contract]
|
||||
[[ERC1155URIStorage]]
|
||||
=== `++ERC1155URIStorage++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/token/ERC1155/extensions/ERC1155URIStorage.sol[{github-icon},role=heading-link]
|
||||
=== `++ERC1155URIStorage++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.1.0/contracts/token/ERC1155/extensions/ERC1155URIStorage.sol[{github-icon},role=heading-link]
|
||||
|
||||
[.hljs-theme-light.nopadding]
|
||||
```solidity
|
||||
import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155URIStorage.sol";
|
||||
```
|
||||
|
||||
ERC1155 token with storage based token URI management.
|
||||
Inspired by the ERC721URIStorage extension
|
||||
ERC-1155 token with storage based token URI management.
|
||||
Inspired by the {ERC721URIStorage} extension
|
||||
|
||||
[.contract-index]
|
||||
.Functions
|
||||
@ -1450,14 +1451,14 @@ Sets `baseURI` as the `_baseURI` for all tokens
|
||||
|
||||
[.contract]
|
||||
[[ERC1155Holder]]
|
||||
=== `++ERC1155Holder++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/token/ERC1155/utils/ERC1155Holder.sol[{github-icon},role=heading-link]
|
||||
=== `++ERC1155Holder++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.1.0/contracts/token/ERC1155/utils/ERC1155Holder.sol[{github-icon},role=heading-link]
|
||||
|
||||
[.hljs-theme-light.nopadding]
|
||||
```solidity
|
||||
import "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";
|
||||
```
|
||||
|
||||
Simple implementation of `IERC1155Receiver` that will allow a contract to hold ERC1155 tokens.
|
||||
Simple implementation of `IERC1155Receiver` that will allow a contract to hold ERC-1155 tokens.
|
||||
|
||||
IMPORTANT: When inheriting this contract, you must include a way to use the received tokens, otherwise they will be
|
||||
stuck.
|
||||
@ -1494,3 +1495,51 @@ See {IERC165-supportsInterface}.
|
||||
[[ERC1155Holder-onERC1155BatchReceived-address-address-uint256---uint256---bytes-]]
|
||||
==== `[.contract-item-name]#++onERC1155BatchReceived++#++(address, address, uint256[], uint256[], bytes) → bytes4++` [.item-kind]#public#
|
||||
|
||||
:checkOnERC1155Received: pass:normal[xref:#ERC1155Utils-checkOnERC1155Received-address-address-address-uint256-uint256-bytes-[`++checkOnERC1155Received++`]]
|
||||
:checkOnERC1155BatchReceived: pass:normal[xref:#ERC1155Utils-checkOnERC1155BatchReceived-address-address-address-uint256---uint256---bytes-[`++checkOnERC1155BatchReceived++`]]
|
||||
|
||||
[.contract]
|
||||
[[ERC1155Utils]]
|
||||
=== `++ERC1155Utils++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.1.0/contracts/token/ERC1155/utils/ERC1155Utils.sol[{github-icon},role=heading-link]
|
||||
|
||||
[.hljs-theme-light.nopadding]
|
||||
```solidity
|
||||
import "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Utils.sol";
|
||||
```
|
||||
|
||||
Library that provide common ERC-1155 utility functions.
|
||||
|
||||
See https://eips.ethereum.org/EIPS/eip-1155[ERC-1155].
|
||||
|
||||
_Available since v5.1._
|
||||
|
||||
[.contract-index]
|
||||
.Functions
|
||||
--
|
||||
* {xref-ERC1155Utils-checkOnERC1155Received-address-address-address-uint256-uint256-bytes-}[`++checkOnERC1155Received(operator, from, to, id, value, data)++`]
|
||||
* {xref-ERC1155Utils-checkOnERC1155BatchReceived-address-address-address-uint256---uint256---bytes-}[`++checkOnERC1155BatchReceived(operator, from, to, ids, values, data)++`]
|
||||
|
||||
--
|
||||
|
||||
[.contract-item]
|
||||
[[ERC1155Utils-checkOnERC1155Received-address-address-address-uint256-uint256-bytes-]]
|
||||
==== `[.contract-item-name]#++checkOnERC1155Received++#++(address operator, address from, address to, uint256 id, uint256 value, bytes data)++` [.item-kind]#internal#
|
||||
|
||||
Performs an acceptance check for the provided `operator` by calling {IERC1155-onERC1155Received}
|
||||
on the `to` address. The `operator` is generally the address that initiated the token transfer (i.e. `msg.sender`).
|
||||
|
||||
The acceptance call is not executed and treated as a no-op if the target address doesn't contain code (i.e. an EOA).
|
||||
Otherwise, the recipient must implement {IERC1155Receiver-onERC1155Received} and return the acceptance magic value to accept
|
||||
the transfer.
|
||||
|
||||
[.contract-item]
|
||||
[[ERC1155Utils-checkOnERC1155BatchReceived-address-address-address-uint256---uint256---bytes-]]
|
||||
==== `[.contract-item-name]#++checkOnERC1155BatchReceived++#++(address operator, address from, address to, uint256[] ids, uint256[] values, bytes data)++` [.item-kind]#internal#
|
||||
|
||||
Performs a batch acceptance check for the provided `operator` by calling {IERC1155-onERC1155BatchReceived}
|
||||
on the `to` address. The `operator` is generally the address that initiated the token transfer (i.e. `msg.sender`).
|
||||
|
||||
The acceptance call is not executed and treated as a no-op if the target address doesn't contain code (i.e. an EOA).
|
||||
Otherwise, the recipient must implement {IERC1155Receiver-onERC1155Received} and return the acceptance magic value to accept
|
||||
the transfer.
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -126,6 +126,9 @@
|
||||
:xref-ERC721-_safeTransfer-address-address-uint256-: xref:token/ERC721.adoc#ERC721-_safeTransfer-address-address-uint256-
|
||||
:IERC721Receiver-onERC721Received: pass:normal[xref:token/ERC721.adoc#IERC721Receiver-onERC721Received-address-address-uint256-bytes-[`IERC721Receiver.onERC721Received`]]
|
||||
:ERC721: pass:normal[xref:token/ERC721.adoc#ERC721[`ERC721`]]
|
||||
:ERC721: pass:normal[xref:token/ERC721.adoc#ERC721[`ERC721`]]
|
||||
:ERC721Consecutive: pass:normal[xref:token/ERC721.adoc#ERC721Consecutive[`ERC721Consecutive`]]
|
||||
:ERC721Enumerable: pass:normal[xref:token/ERC721.adoc#ERC721Enumerable[`ERC721Enumerable`]]
|
||||
:xref-ERC721Enumerable-supportsInterface-bytes4-: xref:token/ERC721.adoc#ERC721Enumerable-supportsInterface-bytes4-
|
||||
:xref-ERC721Enumerable-tokenOfOwnerByIndex-address-uint256-: xref:token/ERC721.adoc#ERC721Enumerable-tokenOfOwnerByIndex-address-uint256-
|
||||
:xref-ERC721Enumerable-totalSupply--: xref:token/ERC721.adoc#ERC721Enumerable-totalSupply--
|
||||
@ -398,6 +401,7 @@
|
||||
:xref-Votes-delegateBySig-address-uint256-uint256-uint8-bytes32-bytes32-: xref:governance.adoc#Votes-delegateBySig-address-uint256-uint256-uint8-bytes32-bytes32-
|
||||
:xref-Votes-_delegate-address-address-: xref:governance.adoc#Votes-_delegate-address-address-
|
||||
:xref-Votes-_transferVotingUnits-address-address-uint256-: xref:governance.adoc#Votes-_transferVotingUnits-address-address-uint256-
|
||||
:xref-Votes-_moveDelegateVotes-address-address-uint256-: xref:governance.adoc#Votes-_moveDelegateVotes-address-address-uint256-
|
||||
:xref-Votes-_numCheckpoints-address-: xref:governance.adoc#Votes-_numCheckpoints-address-
|
||||
:xref-Votes-_checkpoints-address-uint32-: xref:governance.adoc#Votes-_checkpoints-address-uint32-
|
||||
:xref-Nonces-nonces-address-: xref:utils.adoc#Nonces-nonces-address-
|
||||
@ -572,16 +576,18 @@
|
||||
:IERC721-setApprovalForAll: pass:normal[xref:token/ERC721.adoc#IERC721-setApprovalForAll-address-bool-[`IERC721.setApprovalForAll`]]
|
||||
:xref-ERC721Holder-onERC721Received-address-address-uint256-bytes-: xref:token/ERC721.adoc#ERC721Holder-onERC721Received-address-address-uint256-bytes-
|
||||
:IERC721Receiver-onERC721Received: pass:normal[xref:token/ERC721.adoc#IERC721Receiver-onERC721Received-address-address-uint256-bytes-[`IERC721Receiver.onERC721Received`]]
|
||||
= ERC 721
|
||||
:xref-ERC721Utils-checkOnERC721Received-address-address-address-uint256-bytes-: xref:token/ERC721.adoc#ERC721Utils-checkOnERC721Received-address-address-address-uint256-bytes-
|
||||
:IERC721Receiver-onERC721Received: pass:normal[xref:token/ERC721.adoc#IERC721Receiver-onERC721Received-address-address-uint256-bytes-[`IERC721Receiver.onERC721Received`]]
|
||||
= ERC-721
|
||||
|
||||
[.readme-notice]
|
||||
NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/api/token/erc721
|
||||
|
||||
This set of interfaces, contracts, and utilities are all related to the https://eips.ethereum.org/EIPS/eip-721[ERC721 Non-Fungible Token Standard].
|
||||
This set of interfaces, contracts, and utilities are all related to the https://eips.ethereum.org/EIPS/eip-721[ERC-721 Non-Fungible Token Standard].
|
||||
|
||||
TIP: For a walk through on how to create an ERC721 token read our xref:ROOT:erc721.adoc[ERC721 guide].
|
||||
TIP: For a walk through on how to create an ERC-721 token read our xref:ROOT:erc721.adoc[ERC-721 guide].
|
||||
|
||||
The EIP specifies four interfaces:
|
||||
The ERC specifies four interfaces:
|
||||
|
||||
* {IERC721}: Core functionality required in all compliant implementation.
|
||||
* {IERC721Metadata}: Optional extension that adds name, symbol, and token URI, almost always included.
|
||||
@ -596,15 +602,15 @@ OpenZeppelin Contracts provides implementations of all four interfaces:
|
||||
|
||||
Additionally there are a few of other extensions:
|
||||
|
||||
* {ERC721Consecutive}: An implementation of https://eips.ethereum.org/EIPS/eip-2309[ERC2309] for minting batchs of tokens during construction, in accordance with ERC721.
|
||||
* {ERC721Consecutive}: An implementation of https://eips.ethereum.org/EIPS/eip-2309[ERC-2309] for minting batchs of tokens during construction, in accordance with ERC-721.
|
||||
* {ERC721URIStorage}: A more flexible but more expensive way of storing metadata.
|
||||
* {ERC721Votes}: Support for voting and vote delegation.
|
||||
* {ERC721Royalty}: A way to signal royalty information following ERC2981.
|
||||
* {ERC721Royalty}: A way to signal royalty information following ERC-2981.
|
||||
* {ERC721Pausable}: A primitive to pause contract operation.
|
||||
* {ERC721Burnable}: A way for token holders to burn their own tokens.
|
||||
* {ERC721Wrapper}: Wrapper to create an ERC721 backed by another ERC721, with deposit and withdraw methods. Useful in conjunction with {ERC721Votes}.
|
||||
* {ERC721Wrapper}: Wrapper to create an ERC-721 backed by another ERC-721, with deposit and withdraw methods. Useful in conjunction with {ERC721Votes}.
|
||||
|
||||
NOTE: This core set of contracts is designed to be unopinionated, allowing developers to access the internal functions in ERC721 (such as <<ERC721-_mint-address-uint256-,`_mint`>>) and expose them as external functions in the way they prefer.
|
||||
NOTE: This core set of contracts is designed to be unopinionated, allowing developers to access the internal functions in ERC-721 (such as <<ERC721-_mint-address-uint256-,`_mint`>>) and expose them as external functions in the way they prefer.
|
||||
|
||||
== Core
|
||||
|
||||
@ -623,14 +629,14 @@ NOTE: This core set of contracts is designed to be unopinionated, allowing devel
|
||||
|
||||
[.contract]
|
||||
[[IERC721]]
|
||||
=== `++IERC721++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/token/ERC721/IERC721.sol[{github-icon},role=heading-link]
|
||||
=== `++IERC721++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.1.0/contracts/token/ERC721/IERC721.sol[{github-icon},role=heading-link]
|
||||
|
||||
[.hljs-theme-light.nopadding]
|
||||
```solidity
|
||||
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
|
||||
```
|
||||
|
||||
Required interface of an ERC721 compliant contract.
|
||||
Required interface of an ERC-721 compliant contract.
|
||||
|
||||
[.contract-index]
|
||||
.Functions
|
||||
@ -701,7 +707,7 @@ Emits a {Transfer} event.
|
||||
==== `[.contract-item-name]#++safeTransferFrom++#++(address from, address to, uint256 tokenId)++` [.item-kind]#external#
|
||||
|
||||
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.
|
||||
are aware of the ERC-721 protocol to prevent tokens from being forever locked.
|
||||
|
||||
Requirements:
|
||||
|
||||
@ -721,7 +727,7 @@ Emits a {Transfer} event.
|
||||
|
||||
Transfers `tokenId` token from `from` to `to`.
|
||||
|
||||
WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
|
||||
WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC-721
|
||||
or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
|
||||
understand this adds an external call which potentially creates a reentrancy vulnerability.
|
||||
|
||||
@ -805,7 +811,7 @@ Emitted when `owner` enables or disables (`approved`) `operator` to manage all o
|
||||
|
||||
[.contract]
|
||||
[[IERC721Metadata]]
|
||||
=== `++IERC721Metadata++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/token/ERC721/extensions/IERC721Metadata.sol[{github-icon},role=heading-link]
|
||||
=== `++IERC721Metadata++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.1.0/contracts/token/ERC721/extensions/IERC721Metadata.sol[{github-icon},role=heading-link]
|
||||
|
||||
[.hljs-theme-light.nopadding]
|
||||
```solidity
|
||||
@ -878,7 +884,7 @@ Returns the Uniform Resource Identifier (URI) for `tokenId` token.
|
||||
|
||||
[.contract]
|
||||
[[IERC721Enumerable]]
|
||||
=== `++IERC721Enumerable++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/token/ERC721/extensions/IERC721Enumerable.sol[{github-icon},role=heading-link]
|
||||
=== `++IERC721Enumerable++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.1.0/contracts/token/ERC721/extensions/IERC721Enumerable.sol[{github-icon},role=heading-link]
|
||||
|
||||
[.hljs-theme-light.nopadding]
|
||||
```solidity
|
||||
@ -982,14 +988,14 @@ Use along with {totalSupply} to enumerate all tokens.
|
||||
|
||||
[.contract]
|
||||
[[ERC721]]
|
||||
=== `++ERC721++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/token/ERC721/ERC721.sol[{github-icon},role=heading-link]
|
||||
=== `++ERC721++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.1.0/contracts/token/ERC721/ERC721.sol[{github-icon},role=heading-link]
|
||||
|
||||
[.hljs-theme-light.nopadding]
|
||||
```solidity
|
||||
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
|
||||
```
|
||||
|
||||
Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
|
||||
Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC-721] Non-Fungible Token Standard, including
|
||||
the Metadata extension, but not including the Enumerable extension, which is available separately as
|
||||
{ERC721Enumerable}.
|
||||
|
||||
@ -1198,7 +1204,7 @@ See {IERC721-safeTransferFrom}.
|
||||
Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist
|
||||
|
||||
IMPORTANT: Any overrides to this function that add ownership of tokens not tracked by the
|
||||
core ERC721 logic MUST be matched with the use of {_increaseBalance} to keep balances
|
||||
core ERC-721 logic MUST be matched with the use of {_increaseBalance} to keep balances
|
||||
consistent with ownership. The invariant to preserve is that for any address `a` the value returned by
|
||||
`balanceOf(a)` must be equal to the number of tokens such that `_ownerOf(tokenId)` is `a`.
|
||||
|
||||
@ -1223,8 +1229,9 @@ assumption.
|
||||
==== `[.contract-item-name]#++_checkAuthorized++#++(address owner, address spender, uint256 tokenId)++` [.item-kind]#internal#
|
||||
|
||||
Checks if `spender` can operate on `tokenId`, assuming the provided `owner` is the actual owner.
|
||||
Reverts if `spender` does not have approval from the provided `owner` for the given token or for all its assets
|
||||
the `spender` for the specific `tokenId`.
|
||||
Reverts if:
|
||||
- `spender` does not have approval from `owner` for `tokenId`.
|
||||
- `spender` does not have approval to manage all of `owner`'s assets.
|
||||
|
||||
WARNING: This function assumes that `owner` is the actual owner of `tokenId` and does not verify this
|
||||
assumption.
|
||||
@ -1324,7 +1331,7 @@ Emits a {Transfer} event.
|
||||
==== `[.contract-item-name]#++_safeTransfer++#++(address from, address to, uint256 tokenId)++` [.item-kind]#internal#
|
||||
|
||||
Safely transfers `tokenId` token from `from` to `to`, checking that contract recipients
|
||||
are aware of the ERC721 standard to prevent tokens from being forever locked.
|
||||
are aware of the ERC-721 standard to prevent tokens from being forever locked.
|
||||
|
||||
`data` is additional data, it has no specified format and it is sent in call to `to`.
|
||||
|
||||
@ -1399,18 +1406,18 @@ Overrides to ownership logic should be done to {_ownerOf}.
|
||||
|
||||
[.contract]
|
||||
[[ERC721Enumerable]]
|
||||
=== `++ERC721Enumerable++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/token/ERC721/extensions/ERC721Enumerable.sol[{github-icon},role=heading-link]
|
||||
=== `++ERC721Enumerable++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.1.0/contracts/token/ERC721/extensions/ERC721Enumerable.sol[{github-icon},role=heading-link]
|
||||
|
||||
[.hljs-theme-light.nopadding]
|
||||
```solidity
|
||||
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
|
||||
```
|
||||
|
||||
This implements an optional extension of {ERC721} defined in the EIP that adds enumerability
|
||||
This implements an optional extension of {ERC721} defined in the ERC that adds enumerability
|
||||
of all the token ids in the contract as well as all token ids owned by each account.
|
||||
|
||||
CAUTION: `ERC721` extensions that implement custom `balanceOf` logic, such as `ERC721Consecutive`,
|
||||
interfere with enumerability and should not be used together with `ERC721Enumerable`.
|
||||
CAUTION: {ERC721} extensions that implement custom `balanceOf` logic, such as {ERC721Consecutive},
|
||||
interfere with enumerability and should not be used together with {ERC721Enumerable}.
|
||||
|
||||
[.contract-index]
|
||||
.Functions
|
||||
@ -1592,7 +1599,7 @@ Batch mint is not allowed.
|
||||
|
||||
[.contract]
|
||||
[[IERC721Receiver]]
|
||||
=== `++IERC721Receiver++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/token/ERC721/IERC721Receiver.sol[{github-icon},role=heading-link]
|
||||
=== `++IERC721Receiver++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.1.0/contracts/token/ERC721/IERC721Receiver.sol[{github-icon},role=heading-link]
|
||||
|
||||
[.hljs-theme-light.nopadding]
|
||||
```solidity
|
||||
@ -1600,7 +1607,7 @@ import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
|
||||
```
|
||||
|
||||
Interface for any contract that wants to support safeTransfers
|
||||
from ERC721 asset contracts.
|
||||
from ERC-721 asset contracts.
|
||||
|
||||
[.contract-index]
|
||||
.Functions
|
||||
@ -1628,14 +1635,14 @@ The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.
|
||||
|
||||
[.contract]
|
||||
[[ERC721Pausable]]
|
||||
=== `++ERC721Pausable++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/token/ERC721/extensions/ERC721Pausable.sol[{github-icon},role=heading-link]
|
||||
=== `++ERC721Pausable++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.1.0/contracts/token/ERC721/extensions/ERC721Pausable.sol[{github-icon},role=heading-link]
|
||||
|
||||
[.hljs-theme-light.nopadding]
|
||||
```solidity
|
||||
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Pausable.sol";
|
||||
```
|
||||
|
||||
ERC721 token with pausable token transfers, minting and burning.
|
||||
ERC-721 token with pausable token transfers, minting and burning.
|
||||
|
||||
Useful for scenarios such as preventing trades until the end of an evaluation
|
||||
period, or having an emergency switch for freezing all token transfers in the
|
||||
@ -1793,14 +1800,14 @@ Requirements:
|
||||
|
||||
[.contract]
|
||||
[[ERC721Burnable]]
|
||||
=== `++ERC721Burnable++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/token/ERC721/extensions/ERC721Burnable.sol[{github-icon},role=heading-link]
|
||||
=== `++ERC721Burnable++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.1.0/contracts/token/ERC721/extensions/ERC721Burnable.sol[{github-icon},role=heading-link]
|
||||
|
||||
[.hljs-theme-light.nopadding]
|
||||
```solidity
|
||||
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol";
|
||||
```
|
||||
|
||||
ERC721 Token that can be burned (destroyed).
|
||||
ERC-721 Token that can be burned (destroyed).
|
||||
|
||||
[.contract-index]
|
||||
.Functions
|
||||
@ -1939,15 +1946,15 @@ Requirements:
|
||||
|
||||
[.contract]
|
||||
[[ERC721Consecutive]]
|
||||
=== `++ERC721Consecutive++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/token/ERC721/extensions/ERC721Consecutive.sol[{github-icon},role=heading-link]
|
||||
=== `++ERC721Consecutive++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.1.0/contracts/token/ERC721/extensions/ERC721Consecutive.sol[{github-icon},role=heading-link]
|
||||
|
||||
[.hljs-theme-light.nopadding]
|
||||
```solidity
|
||||
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Consecutive.sol";
|
||||
```
|
||||
|
||||
Implementation of the ERC2309 "Consecutive Transfer Extension" as defined in
|
||||
https://eips.ethereum.org/EIPS/eip-2309[EIP-2309].
|
||||
Implementation of the ERC-2309 "Consecutive Transfer Extension" as defined in
|
||||
https://eips.ethereum.org/EIPS/eip-2309[ERC-2309].
|
||||
|
||||
This extension allows the minting of large batches of tokens, during contract construction only. For upgradeable
|
||||
contracts this implies that batch minting is only available during proxy deployment, and not in subsequent upgrades.
|
||||
@ -2125,7 +2132,7 @@ Requirements:
|
||||
- `batchSize` must not be greater than {_maxBatchSize}.
|
||||
- The function is called in the constructor of the contract (directly or indirectly).
|
||||
|
||||
CAUTION: Does not emit a `Transfer` event. This is ERC721 compliant as long as it is done inside of the
|
||||
CAUTION: Does not emit a `Transfer` event. This is ERC-721 compliant as long as it is done inside of the
|
||||
constructor, which is enforced by this function.
|
||||
|
||||
CAUTION: Does not invoke `onERC721Received` on the receiver.
|
||||
@ -2153,7 +2160,7 @@ Used to offset the first token id in {_nextConsecutiveId}
|
||||
|
||||
Batch mint is restricted to the constructor.
|
||||
Any batch mint not emitting the {IERC721-Transfer} event outside of the constructor
|
||||
is non-ERC721 compliant.
|
||||
is non ERC-721 compliant.
|
||||
|
||||
[.contract-item]
|
||||
[[ERC721Consecutive-ERC721ExceededMaxBatchMint-uint256-uint256-]]
|
||||
@ -2179,14 +2186,14 @@ Batch burn is not supported.
|
||||
|
||||
[.contract]
|
||||
[[ERC721URIStorage]]
|
||||
=== `++ERC721URIStorage++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/token/ERC721/extensions/ERC721URIStorage.sol[{github-icon},role=heading-link]
|
||||
=== `++ERC721URIStorage++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.1.0/contracts/token/ERC721/extensions/ERC721URIStorage.sol[{github-icon},role=heading-link]
|
||||
|
||||
[.hljs-theme-light.nopadding]
|
||||
```solidity
|
||||
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
|
||||
```
|
||||
|
||||
ERC721 token with storage based token URI management.
|
||||
ERC-721 token with storage based token URI management.
|
||||
|
||||
[.contract-index]
|
||||
.Functions
|
||||
@ -2340,14 +2347,14 @@ Emits {MetadataUpdate}.
|
||||
|
||||
[.contract]
|
||||
[[ERC721Votes]]
|
||||
=== `++ERC721Votes++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/token/ERC721/extensions/ERC721Votes.sol[{github-icon},role=heading-link]
|
||||
=== `++ERC721Votes++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.1.0/contracts/token/ERC721/extensions/ERC721Votes.sol[{github-icon},role=heading-link]
|
||||
|
||||
[.hljs-theme-light.nopadding]
|
||||
```solidity
|
||||
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Votes.sol";
|
||||
```
|
||||
|
||||
Extension of ERC721 to support voting and delegation as implemented by {Votes}, where each individual NFT counts
|
||||
Extension of ERC-721 to support voting and delegation as implemented by {Votes}, where each individual NFT counts
|
||||
as 1 vote unit.
|
||||
|
||||
Tokens do not count as votes until they are delegated, because votes must be tracked which incurs an additional cost
|
||||
@ -2374,6 +2381,7 @@ the votes in governance decisions, or they can delegate to themselves to be thei
|
||||
* {xref-Votes-delegateBySig-address-uint256-uint256-uint8-bytes32-bytes32-}[`++delegateBySig(delegatee, nonce, expiry, v, r, s)++`]
|
||||
* {xref-Votes-_delegate-address-address-}[`++_delegate(account, delegatee)++`]
|
||||
* {xref-Votes-_transferVotingUnits-address-address-uint256-}[`++_transferVotingUnits(from, to, amount)++`]
|
||||
* {xref-Votes-_moveDelegateVotes-address-address-uint256-}[`++_moveDelegateVotes(from, to, amount)++`]
|
||||
* {xref-Votes-_numCheckpoints-address-}[`++_numCheckpoints(account)++`]
|
||||
* {xref-Votes-_checkpoints-address-uint32-}[`++_checkpoints(account, pos)++`]
|
||||
|
||||
@ -2586,21 +2594,21 @@ See {ERC721-_increaseBalance}. We need that to account tokens that were minted i
|
||||
|
||||
[.contract]
|
||||
[[ERC721Royalty]]
|
||||
=== `++ERC721Royalty++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/token/ERC721/extensions/ERC721Royalty.sol[{github-icon},role=heading-link]
|
||||
=== `++ERC721Royalty++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.1.0/contracts/token/ERC721/extensions/ERC721Royalty.sol[{github-icon},role=heading-link]
|
||||
|
||||
[.hljs-theme-light.nopadding]
|
||||
```solidity
|
||||
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Royalty.sol";
|
||||
```
|
||||
|
||||
Extension of ERC721 with the ERC2981 NFT Royalty Standard, a standardized way to retrieve royalty payment
|
||||
Extension of ERC-721 with the ERC-2981 NFT Royalty Standard, a standardized way to retrieve royalty payment
|
||||
information.
|
||||
|
||||
Royalty information can be specified globally for all token ids via {ERC2981-_setDefaultRoyalty}, and/or individually
|
||||
for specific token ids via {ERC2981-_setTokenRoyalty}. The latter takes precedence over the first.
|
||||
|
||||
IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See
|
||||
https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to
|
||||
https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the ERC. Marketplaces are expected to
|
||||
voluntarily pay royalties together with sales, but note that this standard is not yet widely supported.
|
||||
|
||||
[.contract-index]
|
||||
@ -2761,18 +2769,18 @@ See {IERC165-supportsInterface}.
|
||||
|
||||
[.contract]
|
||||
[[ERC721Wrapper]]
|
||||
=== `++ERC721Wrapper++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/token/ERC721/extensions/ERC721Wrapper.sol[{github-icon},role=heading-link]
|
||||
=== `++ERC721Wrapper++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.1.0/contracts/token/ERC721/extensions/ERC721Wrapper.sol[{github-icon},role=heading-link]
|
||||
|
||||
[.hljs-theme-light.nopadding]
|
||||
```solidity
|
||||
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Wrapper.sol";
|
||||
```
|
||||
|
||||
Extension of the ERC721 token contract to support token wrapping.
|
||||
Extension of the ERC-721 token contract to support token wrapping.
|
||||
|
||||
Users can deposit and withdraw an "underlying token" and receive a "wrapped token" with a matching tokenId. This is
|
||||
useful in conjunction with other modules. For example, combining this wrapping mechanism with {ERC721Votes} will allow
|
||||
the wrapping of an existing "basic" ERC721 into a governance token.
|
||||
the wrapping of an existing "basic" ERC-721 into a governance token.
|
||||
|
||||
[.contract-index]
|
||||
.Functions
|
||||
@ -2924,7 +2932,7 @@ Allow a user to burn wrapped tokens and withdraw the corresponding tokenIds of t
|
||||
[[ERC721Wrapper-onERC721Received-address-address-uint256-bytes-]]
|
||||
==== `[.contract-item-name]#++onERC721Received++#++(address, address from, uint256 tokenId, bytes) → bytes4++` [.item-kind]#public#
|
||||
|
||||
Overrides {IERC721Receiver-onERC721Received} to allow minting on direct ERC721 transfers to
|
||||
Overrides {IERC721Receiver-onERC721Received} to allow minting on direct ERC-721 transfers to
|
||||
this contract.
|
||||
|
||||
In case there's data attached, it validates that the operator is this contract, so only trusted data
|
||||
@ -2950,7 +2958,7 @@ Returns the underlying token.
|
||||
[[ERC721Wrapper-ERC721UnsupportedToken-address-]]
|
||||
==== `[.contract-item-name]#++ERC721UnsupportedToken++#++(address token)++` [.item-kind]#error#
|
||||
|
||||
The received ERC721 token couldn't be wrapped.
|
||||
The received ERC-721 token couldn't be wrapped.
|
||||
|
||||
== Utilities
|
||||
|
||||
@ -2958,7 +2966,7 @@ The received ERC721 token couldn't be wrapped.
|
||||
|
||||
[.contract]
|
||||
[[ERC721Holder]]
|
||||
=== `++ERC721Holder++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/token/ERC721/utils/ERC721Holder.sol[{github-icon},role=heading-link]
|
||||
=== `++ERC721Holder++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.1.0/contracts/token/ERC721/utils/ERC721Holder.sol[{github-icon},role=heading-link]
|
||||
|
||||
[.hljs-theme-light.nopadding]
|
||||
```solidity
|
||||
@ -2989,3 +2997,38 @@ See {IERC721Receiver-onERC721Received}.
|
||||
|
||||
Always returns `IERC721Receiver.onERC721Received.selector`.
|
||||
|
||||
:checkOnERC721Received: pass:normal[xref:#ERC721Utils-checkOnERC721Received-address-address-address-uint256-bytes-[`++checkOnERC721Received++`]]
|
||||
|
||||
[.contract]
|
||||
[[ERC721Utils]]
|
||||
=== `++ERC721Utils++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.1.0/contracts/token/ERC721/utils/ERC721Utils.sol[{github-icon},role=heading-link]
|
||||
|
||||
[.hljs-theme-light.nopadding]
|
||||
```solidity
|
||||
import "@openzeppelin/contracts/token/ERC721/utils/ERC721Utils.sol";
|
||||
```
|
||||
|
||||
Library that provide common ERC-721 utility functions.
|
||||
|
||||
See https://eips.ethereum.org/EIPS/eip-721[ERC-721].
|
||||
|
||||
_Available since v5.1._
|
||||
|
||||
[.contract-index]
|
||||
.Functions
|
||||
--
|
||||
* {xref-ERC721Utils-checkOnERC721Received-address-address-address-uint256-bytes-}[`++checkOnERC721Received(operator, from, to, tokenId, data)++`]
|
||||
|
||||
--
|
||||
|
||||
[.contract-item]
|
||||
[[ERC721Utils-checkOnERC721Received-address-address-address-uint256-bytes-]]
|
||||
==== `[.contract-item-name]#++checkOnERC721Received++#++(address operator, address from, address to, uint256 tokenId, bytes data)++` [.item-kind]#internal#
|
||||
|
||||
Performs an acceptance check for the provided `operator` by calling {IERC721-onERC721Received}
|
||||
on the `to` address. The `operator` is generally the address that initiated the token transfer (i.e. `msg.sender`).
|
||||
|
||||
The acceptance call is not executed and treated as a no-op if the target address doesn't contain code (i.e. an EOA).
|
||||
Otherwise, the recipient must implement {IERC721Receiver-onERC721Received} and return the acceptance magic value to accept
|
||||
the transfer.
|
||||
|
||||
|
||||
@ -17,8 +17,8 @@
|
||||
|
||||
Functionality that is common to multiple token standards.
|
||||
|
||||
* {ERC2981}: NFT Royalties compatible with both ERC721 and ERC1155.
|
||||
** For ERC721 consider {ERC721Royalty} which clears the royalty information from storage on burn.
|
||||
* {ERC2981}: NFT Royalties compatible with both ERC-721 and ERC-1155.
|
||||
** For ERC-721 consider {ERC721Royalty} which clears the royalty information from storage on burn.
|
||||
|
||||
== Contracts
|
||||
|
||||
@ -37,7 +37,7 @@ Functionality that is common to multiple token standards.
|
||||
|
||||
[.contract]
|
||||
[[ERC2981]]
|
||||
=== `++ERC2981++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.1/contracts/token/common/ERC2981.sol[{github-icon},role=heading-link]
|
||||
=== `++ERC2981++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.1.0/contracts/token/common/ERC2981.sol[{github-icon},role=heading-link]
|
||||
|
||||
[.hljs-theme-light.nopadding]
|
||||
```solidity
|
||||
@ -53,7 +53,7 @@ Royalty is specified as a fraction of sale price. {_feeDenominator} is overridab
|
||||
fee is specified in basis points by default.
|
||||
|
||||
IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See
|
||||
https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to
|
||||
https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the ERC. Marketplaces are expected to
|
||||
voluntarily pay royalties together with sales, but note that this standard is not yet widely supported.
|
||||
|
||||
[.contract-index]
|
||||
@ -105,11 +105,14 @@ See {IERC165-supportsInterface}.
|
||||
|
||||
[.contract-item]
|
||||
[[ERC2981-royaltyInfo-uint256-uint256-]]
|
||||
==== `[.contract-item-name]#++royaltyInfo++#++(uint256 tokenId, uint256 salePrice) → address, uint256++` [.item-kind]#public#
|
||||
==== `[.contract-item-name]#++royaltyInfo++#++(uint256 tokenId, uint256 salePrice) → address receiver, uint256 amount++` [.item-kind]#public#
|
||||
|
||||
Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of
|
||||
exchange. The royalty amount is denominated and should be paid in that same unit of exchange.
|
||||
|
||||
NOTE: ERC-2981 allows setting the royalty to 100% of the price. In that case all the price would be sent to the
|
||||
royalty receiver and 0 tokens to the seller. Contracts dealing with royalty should consider empty transfers.
|
||||
|
||||
[.contract-item]
|
||||
[[ERC2981-_feeDenominator--]]
|
||||
==== `[.contract-item-name]#++_feeDenominator++#++() → uint96++` [.item-kind]#internal#
|
||||
|
||||
Reference in New Issue
Block a user