ERC1155Burnable.sol 913 B

12345678910111213141516171819202122232425262728293031
  1. // SPDX-License-Identifier: MIT
  2. pragma solidity ^0.7.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(address account, uint256 id, uint256 value) public virtual {
  12. require(
  13. account == _msgSender() || isApprovedForAll(account, _msgSender()),
  14. "ERC1155: caller is not owner nor approved"
  15. );
  16. _burn(account, id, value);
  17. }
  18. function burnBatch(address account, uint256[] memory ids, uint256[] memory values) public virtual {
  19. require(
  20. account == _msgSender() || isApprovedForAll(account, _msgSender()),
  21. "ERC1155: caller is not owner nor approved"
  22. );
  23. _burnBatch(account, ids, values);
  24. }
  25. }