@@ -92,6 +92,54 @@ contract ERC1155Drop is
9292 interfaceId == type (IERC2981 ).interfaceId; // ERC165 ID for ERC2981
9393 }
9494
95+ /*//////////////////////////////////////////////////////////////
96+ Minting/burning logic
97+ //////////////////////////////////////////////////////////////*/
98+
99+ /**
100+ * @notice Lets an owner or approved operator burn NFTs of the given tokenId.
101+ *
102+ * @param _owner The owner of the NFT to burn.
103+ * @param _tokenId The tokenId of the NFT to burn.
104+ * @param _amount The amount of the NFT to burn.
105+ */
106+ function burn (
107+ address _owner ,
108+ uint256 _tokenId ,
109+ uint256 _amount
110+ ) external virtual {
111+ address caller = msg .sender ;
112+
113+ require (caller == _owner || isApprovedForAll[_owner][caller], "Unapproved caller " );
114+ require (balanceOf[_owner][_tokenId] >= _amount, "Not enough tokens owned " );
115+
116+ _burn (_owner, _tokenId, _amount);
117+ }
118+
119+ /**
120+ * @notice Lets an owner or approved operator burn NFTs of the given tokenIds.
121+ *
122+ * @param _owner The owner of the NFTs to burn.
123+ * @param _tokenIds The tokenIds of the NFTs to burn.
124+ * @param _amounts The amounts of the NFTs to burn.
125+ */
126+ function burnBatch (
127+ address _owner ,
128+ uint256 [] memory _tokenIds ,
129+ uint256 [] memory _amounts
130+ ) external virtual {
131+ address caller = msg .sender ;
132+
133+ require (caller == _owner || isApprovedForAll[_owner][caller], "Unapproved caller " );
134+ require (_tokenIds.length == _amounts.length , "Length mismatch " );
135+
136+ for (uint256 i = 0 ; i < _tokenIds.length ; i += 1 ) {
137+ require (balanceOf[_owner][_tokenIds[i]] >= _amounts[i], "Not enough tokens owned " );
138+ }
139+
140+ _burnBatch (_owner, _tokenIds, _amounts);
141+ }
142+
95143 /*///////////////////////////////////////////////////////////////
96144 Overriden metadata logic
97145 //////////////////////////////////////////////////////////////*/
0 commit comments