* Make holder fns public * Add context, remove msg.sender from check * Fix location of Holder arguments * Add beforeTransfer hook * Minor test improvements * Add ERC1155Burnable and tests * Add ERC1155Pausable * Add ERC1155PresetMinterPauser.sol * Add uri constructors * Improved revert reasons * Initial docs improvements * Add missing docs * Improve acceptance checks revert reasons * Apply suggestions from code review Co-authored-by: Francisco Giordano <frangio.1@gmail.com> * Remove note about 1155 preset uri in mint * Add rquirements to balanceOfBatch * Add note about URI and uri * Fix list in docs * Fix lint errors * Use natural sorting for API titles * Fix doc references * Escape {id} references to remove docgen warnings * Added intro docs, fixed links * Apply suggestions from code review Co-authored-by: Francisco Giordano <frangio.1@gmail.com> * Add changelog entry Co-authored-by: Francisco Giordano <frangio.1@gmail.com>
30 lines
883 B
Solidity
30 lines
883 B
Solidity
// SPDX-License-Identifier: MIT
|
|
|
|
pragma solidity ^0.6.0;
|
|
|
|
import "./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.
|
|
*/
|
|
abstract contract ERC1155Burnable is ERC1155 {
|
|
function burn(address account, uint256 id, uint256 value) public virtual {
|
|
require(
|
|
account == _msgSender() || isApprovedForAll(account, _msgSender()),
|
|
"ERC1155: caller is not owner nor approved"
|
|
);
|
|
|
|
_burn(account, id, value);
|
|
}
|
|
|
|
function burnBatch(address account, uint256[] memory ids, uint256[] memory values) public virtual {
|
|
require(
|
|
account == _msgSender() || isApprovedForAll(account, _msgSender()),
|
|
"ERC1155: caller is not owner nor approved"
|
|
);
|
|
|
|
_burnBatch(account, ids, values);
|
|
}
|
|
}
|