You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
1.0 KiB
30 lines
1.0 KiB
// SPDX-License-Identifier: MIT
|
|
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/extensions/ERC1155Burnable.sol)
|
|
|
|
pragma solidity ^0.8.19;
|
|
|
|
import {ERC1155} from "../ERC1155.sol";
|
|
|
|
/**
|
|
* @dev Extension of {ERC1155} that allows token holders to destroy both their
|
|
* own tokens and those that they have been approved to use.
|
|
*
|
|
* _Available since v3.1._
|
|
*/
|
|
abstract contract ERC1155Burnable is ERC1155 {
|
|
function burn(address account, uint256 id, uint256 value) public virtual {
|
|
if (account != _msgSender() && !isApprovedForAll(account, _msgSender())) {
|
|
revert ERC1155MissingApprovalForAll(_msgSender(), account);
|
|
}
|
|
|
|
_burn(account, id, value);
|
|
}
|
|
|
|
function burnBatch(address account, uint256[] memory ids, uint256[] memory values) public virtual {
|
|
if (account != _msgSender() && !isApprovedForAll(account, _msgSender())) {
|
|
revert ERC1155MissingApprovalForAll(_msgSender(), account);
|
|
}
|
|
|
|
_burnBatch(account, ids, values);
|
|
}
|
|
}
|
|
|