ERC1155Pausable.sol 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // SPDX-License-Identifier: MIT
  2. // OpenZeppelin Contracts (last updated v4.8.2) (token/ERC1155/extensions/ERC1155Pausable.sol)
  3. pragma solidity ^0.8.19;
  4. import {ERC1155} from "../ERC1155.sol";
  5. import {Pausable} from "../../../security/Pausable.sol";
  6. /**
  7. * @dev ERC1155 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. * _Available since v3.1._
  20. */
  21. abstract contract ERC1155Pausable is ERC1155, Pausable {
  22. /**
  23. * @dev See {ERC1155-_update}.
  24. *
  25. * Requirements:
  26. *
  27. * - the contract must not be paused.
  28. */
  29. function _update(
  30. address from,
  31. address to,
  32. uint256[] memory ids,
  33. uint256[] memory values
  34. ) internal virtual override whenNotPaused {
  35. super._update(from, to, ids, values);
  36. }
  37. }