@@ -155,6 +155,54 @@ contract ERC1155Drop is
155155 return nextTokenIdToLazyMint;
156156 }
157157
158+ /*//////////////////////////////////////////////////////////////
159+ Minting/burning logic
160+ //////////////////////////////////////////////////////////////*/
161+
162+ /**
163+ * @notice Lets an owner or approved operator burn NFTs of the given tokenId.
164+ *
165+ * @param _owner The owner of the NFT to burn.
166+ * @param _tokenId The tokenId of the NFT to burn.
167+ * @param _amount The amount of the NFT to burn.
168+ */
169+ function burn (
170+ address _owner ,
171+ uint256 _tokenId ,
172+ uint256 _amount
173+ ) external virtual {
174+ address caller = msg .sender ;
175+
176+ require (caller == _owner || isApprovedForAll[_owner][caller], "Unapproved caller " );
177+ require (balanceOf[_owner][_tokenId] >= _amount, "Not enough tokens owned " );
178+
179+ _burn (_owner, _tokenId, _amount);
180+ }
181+
182+ /**
183+ * @notice Lets an owner or approved operator burn NFTs of the given tokenIds.
184+ *
185+ * @param _owner The owner of the NFTs to burn.
186+ * @param _tokenIds The tokenIds of the NFTs to burn.
187+ * @param _amounts The amounts of the NFTs to burn.
188+ */
189+ function burnBatch (
190+ address _owner ,
191+ uint256 [] memory _tokenIds ,
192+ uint256 [] memory _amounts
193+ ) external virtual {
194+ address caller = msg .sender ;
195+
196+ require (caller == _owner || isApprovedForAll[_owner][caller], "Unapproved caller " );
197+ require (_tokenIds.length == _amounts.length , "Length mismatch " );
198+
199+ for (uint256 i = 0 ; i < _tokenIds.length ; i += 1 ) {
200+ require (balanceOf[_owner][_tokenIds[i]] >= _amounts[i], "Not enough tokens owned " );
201+ }
202+
203+ _burnBatch (_owner, _tokenIds, _amounts);
204+ }
205+
158206 /*//////////////////////////////////////////////////////////////
159207 ERC165 Logic
160208 //////////////////////////////////////////////////////////////*/
0 commit comments