ERC721BurnableUpgradeable.sol 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. // SPDX-License-Identifier: MIT
  2. // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Burnable.sol)
  3. pragma solidity ^0.8.0;
  4. import "../ERC721Upgradeable.sol";
  5. import "../../../utils/ContextUpgradeable.sol";
  6. import "../../../proxy/utils/Initializable.sol";
  7. /**
  8. * @title ERC721 Burnable Token
  9. * @dev ERC721 Token that can be irreversibly burned (destroyed).
  10. */
  11. abstract contract ERC721BurnableUpgradeable is Initializable, ContextUpgradeable, ERC721Upgradeable {
  12. function __ERC721Burnable_init() internal onlyInitializing {
  13. }
  14. function __ERC721Burnable_init_unchained() internal onlyInitializing {
  15. }
  16. /**
  17. * @dev Burns `tokenId`. See {ERC721-_burn}.
  18. *
  19. * Requirements:
  20. *
  21. * - The caller must own `tokenId` or be an approved operator.
  22. */
  23. function burn(uint256 tokenId) public virtual {
  24. //solhint-disable-next-line max-line-length
  25. require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721Burnable: caller is not owner nor approved");
  26. _burn(tokenId);
  27. }
  28. /**
  29. * This empty reserved space is put in place to allow future versions to add new
  30. * variables without shifting down storage in the inheritance chain.
  31. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
  32. */
  33. uint256[50] private __gap;
  34. }