ERC1155Burnable.sol 1022 B

123456789101112131415161718192021222324252627282930
  1. // SPDX-License-Identifier: MIT
  2. // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/extensions/ERC1155Burnable.sol)
  3. pragma solidity ^0.8.19;
  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. if (account != _msgSender() && !isApprovedForAll(account, _msgSender())) {
  14. revert ERC1155InsufficientApprovalForAll(_msgSender(), account);
  15. }
  16. _burn(account, id, value);
  17. }
  18. function burnBatch(address account, uint256[] memory ids, uint256[] memory values) public virtual {
  19. if (account != _msgSender() && !isApprovedForAll(account, _msgSender())) {
  20. revert ERC1155InsufficientApprovalForAll(_msgSender(), account);
  21. }
  22. _burnBatch(account, ids, values);
  23. }
  24. }