ERC1155Burnable.sol 1019 B

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