ERC1155Burnable.sol 883 B

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