ERC721Pausable.sol 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. // SPDX-License-Identifier: MIT
  2. // OpenZeppelin Contracts (last updated v5.1.0-rc.1) (token/ERC721/extensions/ERC721Pausable.sol)
  3. pragma solidity ^0.8.20;
  4. import {ERC721} from "../ERC721.sol";
  5. import {Pausable} from "../../../utils/Pausable.sol";
  6. /**
  7. * @dev ERC-721 token with pausable token transfers, minting and burning.
  8. *
  9. * Useful for scenarios such as preventing trades until the end of an evaluation
  10. * period, or having an emergency switch for freezing all token transfers in the
  11. * event of a large bug.
  12. *
  13. * IMPORTANT: This contract does not include public pause and unpause functions. In
  14. * addition to inheriting this contract, you must define both functions, invoking the
  15. * {Pausable-_pause} and {Pausable-_unpause} internal functions, with appropriate
  16. * access control, e.g. using {AccessControl} or {Ownable}. Not doing so will
  17. * make the contract pause mechanism of the contract unreachable, and thus unusable.
  18. */
  19. abstract contract ERC721Pausable is ERC721, Pausable {
  20. /**
  21. * @dev See {ERC721-_update}.
  22. *
  23. * Requirements:
  24. *
  25. * - the contract must not be paused.
  26. */
  27. function _update(
  28. address to,
  29. uint256 tokenId,
  30. address auth
  31. ) internal virtual override whenNotPaused returns (address) {
  32. return super._update(to, tokenId, auth);
  33. }
  34. }