ERC721Burnable.sol 750 B

123456789101112131415161718192021222324252627
  1. // SPDX-License-Identifier: MIT
  2. // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/extensions/ERC721Burnable.sol)
  3. pragma solidity ^0.8.19;
  4. import "../ERC721.sol";
  5. import "../../../utils/Context.sol";
  6. /**
  7. * @title ERC721 Burnable Token
  8. * @dev ERC721 Token that can be burned (destroyed).
  9. */
  10. abstract contract ERC721Burnable is Context, ERC721 {
  11. /**
  12. * @dev Burns `tokenId`. See {ERC721-_burn}.
  13. *
  14. * Requirements:
  15. *
  16. * - The caller must own `tokenId` or be an approved operator.
  17. */
  18. function burn(uint256 tokenId) public virtual {
  19. if (!_isApprovedOrOwner(_msgSender(), tokenId)) {
  20. revert ERC721InsufficientApproval(_msgSender(), tokenId);
  21. }
  22. _burn(tokenId);
  23. }
  24. }