ERC1155BurnableUpgradeable.sol 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // SPDX-License-Identifier: MIT
  2. // OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/ERC1155Burnable.sol)
  3. pragma solidity ^0.8.0;
  4. import "../ERC1155Upgradeable.sol";
  5. import "../../../proxy/utils/Initializable.sol";
  6. /**
  7. * @dev Extension of {ERC1155} that allows token holders to destroy both their
  8. * own tokens and those that they have been approved to use.
  9. *
  10. * _Available since v3.1._
  11. */
  12. abstract contract ERC1155BurnableUpgradeable is Initializable, ERC1155Upgradeable {
  13. function __ERC1155Burnable_init() internal onlyInitializing {
  14. }
  15. function __ERC1155Burnable_init_unchained() internal onlyInitializing {
  16. }
  17. function burn(
  18. address account,
  19. uint256 id,
  20. uint256 value
  21. ) public virtual {
  22. require(
  23. account == _msgSender() || isApprovedForAll(account, _msgSender()),
  24. "ERC1155: caller is not owner nor approved"
  25. );
  26. _burn(account, id, value);
  27. }
  28. function burnBatch(
  29. address account,
  30. uint256[] memory ids,
  31. uint256[] memory values
  32. ) public virtual {
  33. require(
  34. account == _msgSender() || isApprovedForAll(account, _msgSender()),
  35. "ERC1155: caller is not owner nor approved"
  36. );
  37. _burnBatch(account, ids, values);
  38. }
  39. /**
  40. * This empty reserved space is put in place to allow future versions to add new
  41. * variables without shifting down storage in the inheritance chain.
  42. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
  43. */
  44. uint256[50] private __gap;
  45. }