Skip to content
Verified contractPartialMIT

BatchBurner

Address0x684a5cf280c59c42f9d92cc2a37f38ec956693e8
Balance

0 ETH

 

Transactions

2

 

Compiler

solc 0.8.35

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.35+commit.47b9dedd
Language
solidity
Optimization
Yes, 200 runs
EVM version
cancun
License
MIT
Match
Partialcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
26,228,202
Creation transaction
0xb2ba8b6e9c…5f93cf8d70

src/BatchBurner.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

interface IBurnable {
    function burn(uint256 tokenId) external;
    function ownerOf(uint256 tokenId) external view returns (address);
}

/**
 * @title  BatchBurner
 * @notice Burns a range of tokens in one transaction, so a rehearsal collection can be emptied
 *         without sending one transaction per token.
 *
 * @dev    Holds nothing and owns nothing. It only works on tokens whose holder has called
 *         `setApprovalForAll(thisContract, true)` — ERC721SeaDrop's `burn` requires the caller to
 *         own the token or be an approved operator — so revoking that approval fully disarms it.
 *         Each burn is wrapped in try/catch so an already-burned or non-existent id cannot strand
 *         the rest of the range.
 *
 *         Burning is the closest thing to deleting a collection that exists. Contract code and
 *         SSTORE2 chunks cannot be removed from Ethereum; what this does is leave the collection
 *         with zero supply, which is what marketplaces and collectors actually see.
 */
contract BatchBurner {
    event Burned(address indexed nft, uint256 from, uint256 to, uint256 count);

    function burnRange(address nft, uint256 from, uint256 to) external returns (uint256 count) {
        for (uint256 i = from; i <= to; ++i) {
            try IBurnable(nft).burn(i) {
                unchecked { ++count; }
            } catch {}
        }
        emit Burned(nft, from, to, count);
    }
}
Compiler settingsShow
{
  "viaIR": false,
  "metadata": {
    "appendCBOR": true,
    "bytecodeHash": "none",
    "useLiteralContent": false
  },
  "optimizer": {
    "runs": 200,
    "enabled": true
  },
  "evmVersion": "cancun",
  "remappings": [
    "seadrop/=lib/seadrop/src/",
    "ERC721A/=lib/seadrop/lib/ERC721A/contracts/",
    "openzeppelin-contracts/=lib/seadrop/lib/openzeppelin-contracts/contracts/",
    "operator-filter-registry/=lib/seadrop/lib/operator-filter-registry/src/",
    "solmate/=lib/seadrop/lib/solmate/src/",
    "utility-contracts/=lib/seadrop/lib/utility-contracts/src/",
    "solady/=lib/solady/src/",
    "forge-std/=lib/forge-std/src/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "ERC721A-Upgradeable/=lib/seadrop/lib/ERC721A-Upgradeable/contracts/",
    "create2-helpers/=lib/seadrop/lib/create2-helpers/",
    "create2-scripts/=lib/seadrop/lib/create2-helpers/script/",
    "murky/=lib/seadrop/lib/murky/src/",
    "openzeppelin-contracts-upgradeable/=lib/seadrop/lib/openzeppelin-contracts-upgradeable/"
  ]
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.