From 09cdb96c1443d5ca044f8428699b83deb578e801 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 31 Jan 2023 00:02:21 +0000 Subject: [PATCH] Update docs --- .changeset/new-ways-own.md | 5 +++++ contracts/token/ERC1155/extensions/ERC1155Pausable.sol | 6 ++++++ contracts/token/ERC20/extensions/ERC20Pausable.sol | 6 ++++++ contracts/token/ERC721/extensions/ERC721Pausable.sol | 6 ++++++ docs/modules/ROOT/pages/extending-contracts.adoc | 2 -- docs/modules/api/pages/token/ERC1155.adoc | 10 ++++++++++ docs/modules/api/pages/token/ERC20.adoc | 10 ++++++++++ docs/modules/api/pages/token/ERC721.adoc | 10 ++++++++++ 8 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 .changeset/new-ways-own.md diff --git a/.changeset/new-ways-own.md b/.changeset/new-ways-own.md new file mode 100644 index 000000000..f940bfeb7 --- /dev/null +++ b/.changeset/new-ways-own.md @@ -0,0 +1,5 @@ +--- +'openzeppelin-solidity': patch +--- + +`ERC20Pausable`, `ERC721Pausable`, `ERC1155Pausable`: Add note regarding missing public pausing functionality diff --git a/contracts/token/ERC1155/extensions/ERC1155Pausable.sol b/contracts/token/ERC1155/extensions/ERC1155Pausable.sol index 64790e2aa..66ad55e7d 100644 --- a/contracts/token/ERC1155/extensions/ERC1155Pausable.sol +++ b/contracts/token/ERC1155/extensions/ERC1155Pausable.sol @@ -13,6 +13,12 @@ import "../../../security/Pausable.sol"; * period, or having an emergency switch for freezing all token transfers in the * event of a large bug. * + * IMPORTANT: This contract does not include public pause and unpause functions. In + * addition to inheriting this contract, you must define both functions, invoking the + * {Pausable-_pause} and {Pausable-_unpause} internal functions, with appropriate + * access control, e.g. using {AccessControl} or {Ownable}. Not doing so will + * make the contract unpausable. + * * _Available since v3.1._ */ abstract contract ERC1155Pausable is ERC1155, Pausable { diff --git a/contracts/token/ERC20/extensions/ERC20Pausable.sol b/contracts/token/ERC20/extensions/ERC20Pausable.sol index e448e96a6..db2937135 100644 --- a/contracts/token/ERC20/extensions/ERC20Pausable.sol +++ b/contracts/token/ERC20/extensions/ERC20Pausable.sol @@ -12,6 +12,12 @@ import "../../../security/Pausable.sol"; * 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 * event of a large bug. + * + * IMPORTANT: This contract does not include public pause and unpause functions. In + * addition to inheriting this contract, you must define both functions, invoking the + * {Pausable-_pause} and {Pausable-_unpause} internal functions, with appropriate + * access control, e.g. using {AccessControl} or {Ownable}. Not doing so will + * make the contract unpausable. */ abstract contract ERC20Pausable is ERC20, Pausable { /** diff --git a/contracts/token/ERC721/extensions/ERC721Pausable.sol b/contracts/token/ERC721/extensions/ERC721Pausable.sol index 4726540f4..cdd729b26 100644 --- a/contracts/token/ERC721/extensions/ERC721Pausable.sol +++ b/contracts/token/ERC721/extensions/ERC721Pausable.sol @@ -12,6 +12,12 @@ import "../../../security/Pausable.sol"; * 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 * event of a large bug. + * + * IMPORTANT: This contract does not include public pause and unpause functions. In + * addition to inheriting this contract, you must define both functions, invoking the + * {Pausable-_pause} and {Pausable-_unpause} internal functions, with appropriate + * access control, e.g. using {AccessControl} or {Ownable}. Not doing so will + * make the contract unpausable. */ abstract contract ERC721Pausable is ERC721, Pausable { /** diff --git a/docs/modules/ROOT/pages/extending-contracts.adoc b/docs/modules/ROOT/pages/extending-contracts.adoc index 7330fc997..a440f4067 100644 --- a/docs/modules/ROOT/pages/extending-contracts.adoc +++ b/docs/modules/ROOT/pages/extending-contracts.adoc @@ -66,8 +66,6 @@ contract ModifiedAccessControl is AccessControl { The `super.revokeRole` statement at the end will invoke ``AccessControl``'s original version of `revokeRole`, the same code that would've run if there were no overrides in place. -NOTE: As of v3.0.0, `view` functions are not `virtual` in OpenZeppelin, and therefore cannot be overridden. We're considering https://github.com/OpenZeppelin/openzeppelin-contracts/issues/2154[lifting this restriction] in an upcoming release. Let us know if this is something you care about! - [[using-hooks]] == Using Hooks diff --git a/docs/modules/api/pages/token/ERC1155.adoc b/docs/modules/api/pages/token/ERC1155.adoc index 4f9ad3ecc..4fa53ddec 100644 --- a/docs/modules/api/pages/token/ERC1155.adoc +++ b/docs/modules/api/pages/token/ERC1155.adoc @@ -76,6 +76,10 @@ :xref-IERC1155Receiver-onERC1155Received-address-address-uint256-uint256-bytes-: xref:token/ERC1155.adoc#IERC1155Receiver-onERC1155Received-address-address-uint256-uint256-bytes- :xref-IERC1155Receiver-onERC1155BatchReceived-address-address-uint256---uint256---bytes-: xref:token/ERC1155.adoc#IERC1155Receiver-onERC1155BatchReceived-address-address-uint256---uint256---bytes- :IERC165-supportsInterface: pass:normal[xref:utils.adoc#IERC165-supportsInterface-bytes4-[`IERC165.supportsInterface`]] +:Pausable-_pause: pass:normal[xref:security.adoc#Pausable-_pause--[`Pausable._pause`]] +:Pausable-_unpause: pass:normal[xref:security.adoc#Pausable-_unpause--[`Pausable._unpause`]] +:AccessControl: pass:normal[xref:access.adoc#AccessControl[`AccessControl`]] +:Ownable: pass:normal[xref:access.adoc#Ownable[`Ownable`]] :xref-ERC1155Pausable-_beforeTokenTransfer-address-address-address-uint256---uint256---bytes-: xref:token/ERC1155.adoc#ERC1155Pausable-_beforeTokenTransfer-address-address-address-uint256---uint256---bytes- :xref-Pausable-paused--: xref:security.adoc#Pausable-paused-- :xref-Pausable-_requireNotPaused--: xref:security.adoc#Pausable-_requireNotPaused-- @@ -910,6 +914,12 @@ 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 event of a large bug. +IMPORTANT: This contract does not include public pause and unpause functions. In +addition to inheriting this contract, you must define both functions, invoking the +{Pausable-_pause} and {Pausable-_unpause} internal functions, with appropriate +access control, e.g. using {AccessControl} or {Ownable}. Not doing so will +make the contract unpausable. + _Available since v3.1._ [.contract-index] diff --git a/docs/modules/api/pages/token/ERC20.adoc b/docs/modules/api/pages/token/ERC20.adoc index dbf432f42..d41e24eb2 100644 --- a/docs/modules/api/pages/token/ERC20.adoc +++ b/docs/modules/api/pages/token/ERC20.adoc @@ -122,6 +122,10 @@ :xref-IERC20-Transfer-address-address-uint256-: xref:token/ERC20.adoc#IERC20-Transfer-address-address-uint256- :xref-IERC20-Approval-address-address-uint256-: xref:token/ERC20.adoc#IERC20-Approval-address-address-uint256- :ERC20-_mint: pass:normal[xref:token/ERC20.adoc#ERC20-_mint-address-uint256-[`ERC20._mint`]] +:Pausable-_pause: pass:normal[xref:security.adoc#Pausable-_pause--[`Pausable._pause`]] +:Pausable-_unpause: pass:normal[xref:security.adoc#Pausable-_unpause--[`Pausable._unpause`]] +:AccessControl: pass:normal[xref:access.adoc#AccessControl[`AccessControl`]] +:Ownable: pass:normal[xref:access.adoc#Ownable[`Ownable`]] :xref-ERC20Pausable-_beforeTokenTransfer-address-address-uint256-: xref:token/ERC20.adoc#ERC20Pausable-_beforeTokenTransfer-address-address-uint256- :xref-Pausable-paused--: xref:security.adoc#Pausable-paused-- :xref-Pausable-_requireNotPaused--: xref:security.adoc#Pausable-_requireNotPaused-- @@ -1263,6 +1267,12 @@ 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 event of a large bug. +IMPORTANT: This contract does not include public pause and unpause functions. In +addition to inheriting this contract, you must define both functions, invoking the +{Pausable-_pause} and {Pausable-_unpause} internal functions, with appropriate +access control, e.g. using {AccessControl} or {Ownable}. Not doing so will +make the contract unpausable. + [.contract-index] .Functions -- diff --git a/docs/modules/api/pages/token/ERC721.adoc b/docs/modules/api/pages/token/ERC721.adoc index 7d7fe0403..60502c1a6 100644 --- a/docs/modules/api/pages/token/ERC721.adoc +++ b/docs/modules/api/pages/token/ERC721.adoc @@ -155,6 +155,10 @@ :xref-IERC721Receiver-onERC721Received-address-address-uint256-bytes-: xref:token/ERC721.adoc#IERC721Receiver-onERC721Received-address-address-uint256-bytes- :IERC721: pass:normal[xref:token/ERC721.adoc#IERC721[`IERC721`]] :IERC721-safeTransferFrom: pass:normal[xref:token/ERC721.adoc#IERC721-safeTransferFrom-address-address-uint256-[`IERC721.safeTransferFrom`]] +:Pausable-_pause: pass:normal[xref:security.adoc#Pausable-_pause--[`Pausable._pause`]] +:Pausable-_unpause: pass:normal[xref:security.adoc#Pausable-_unpause--[`Pausable._unpause`]] +:AccessControl: pass:normal[xref:access.adoc#AccessControl[`AccessControl`]] +:Ownable: pass:normal[xref:access.adoc#Ownable[`Ownable`]] :xref-ERC721Pausable-_beforeTokenTransfer-address-address-uint256-uint256-: xref:token/ERC721.adoc#ERC721Pausable-_beforeTokenTransfer-address-address-uint256-uint256- :xref-Pausable-paused--: xref:security.adoc#Pausable-paused-- :xref-Pausable-_requireNotPaused--: xref:security.adoc#Pausable-_requireNotPaused-- @@ -1409,6 +1413,12 @@ 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 event of a large bug. +IMPORTANT: This contract does not include public pause and unpause functions. In +addition to inheriting this contract, you must define both functions, invoking the +{Pausable-_pause} and {Pausable-_unpause} internal functions, with appropriate +access control, e.g. using {AccessControl} or {Ownable}. Not doing so will +make the contract unpausable. + [.contract-index] .Functions --