ERC721Pausable.sol 942 B

123456789101112131415161718192021222324252627282930313233
  1. // SPDX-License-Identifier: MIT
  2. // OpenZeppelin Contracts v4.4.0 (token/ERC721/extensions/ERC721Pausable.sol)
  3. pragma solidity ^0.8.0;
  4. import "../ERC721.sol";
  5. import "../../../security/Pausable.sol";
  6. /**
  7. * @dev ERC721 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. abstract contract ERC721Pausable is ERC721, Pausable {
  14. /**
  15. * @dev See {ERC721-_beforeTokenTransfer}.
  16. *
  17. * Requirements:
  18. *
  19. * - the contract must not be paused.
  20. */
  21. function _beforeTokenTransfer(
  22. address from,
  23. address to,
  24. uint256 tokenId
  25. ) internal virtual override {
  26. super._beforeTokenTransfer(from, to, tokenId);
  27. require(!paused(), "ERC721Pausable: token transfer while paused");
  28. }
  29. }