ERC721Pausable.sol 827 B

12345678910111213141516171819202122232425262728
  1. // SPDX-License-Identifier: MIT
  2. pragma solidity ^0.6.0;
  3. import "./ERC721.sol";
  4. import "../../utils/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(address from, address to, uint256 tokenId) internal virtual override {
  21. super._beforeTokenTransfer(from, to, tokenId);
  22. require(!paused(), "ERC721Pausable: token transfer while paused");
  23. }
  24. }