ERC721Pausable.sol 864 B

1234567891011121314151617181920212223242526272829303132
  1. // SPDX-License-Identifier: MIT
  2. pragma solidity ^0.8.0;
  3. import "../ERC721.sol";
  4. import "../../../security/Pausable.sol";
  5. /**
  6. * @dev ERC721 token with pausable token transfers, minting and burning.
  7. *
  8. * Useful for scenarios such as preventing trades until the end of an evaluation
  9. * period, or having an emergency switch for freezing all token transfers in the
  10. * event of a large bug.
  11. */
  12. abstract contract ERC721Pausable is ERC721, Pausable {
  13. /**
  14. * @dev See {ERC721-_beforeTokenTransfer}.
  15. *
  16. * Requirements:
  17. *
  18. * - the contract must not be paused.
  19. */
  20. function _beforeTokenTransfer(
  21. address from,
  22. address to,
  23. uint256 tokenId
  24. ) internal virtual override {
  25. super._beforeTokenTransfer(from, to, tokenId);
  26. require(!paused(), "ERC721Pausable: token transfer while paused");
  27. }
  28. }