ERC1155Burnable.sol 974 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. // SPDX-License-Identifier: MIT
  2. pragma solidity ^0.8.0;
  3. import "../ERC1155.sol";
  4. /**
  5. * @dev Extension of {ERC1155} that allows token holders to destroy both their
  6. * own tokens and those that they have been approved to use.
  7. *
  8. * _Available since v3.1._
  9. */
  10. abstract contract ERC1155Burnable is ERC1155 {
  11. function burn(
  12. address account,
  13. uint256 id,
  14. uint256 value
  15. ) public virtual {
  16. require(
  17. account == _msgSender() || isApprovedForAll(account, _msgSender()),
  18. "ERC1155: caller is not owner nor approved"
  19. );
  20. _burn(account, id, value);
  21. }
  22. function burnBatch(
  23. address account,
  24. uint256[] memory ids,
  25. uint256[] memory values
  26. ) public virtual {
  27. require(
  28. account == _msgSender() || isApprovedForAll(account, _msgSender()),
  29. "ERC1155: caller is not owner nor approved"
  30. );
  31. _burnBatch(account, ids, values);
  32. }
  33. }