Skip to content
Verified contractPartialMIT

BombV2

Address0x8d9004e1e9d04b57dcd36bc052fe6c8462ea4aa8
Balance

0.0101 ETH

 

Transactions

27

 

Compiler

solc 0.8.20

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.20+commit.a1b79de6
Language
solidity
Optimization
Yes, 200 runs
EVM version
paris
License
MIT
Match
Partialcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
25,017,119
Creation transaction
0x23c814761e…c0acc5b3d1

BombV2.sol

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

// ████████████████████████████████████████████████████████████████████████████
//
//  $BOMB v2 — Beat The Bomb
//  https://beatthebomb.fun/
//  https://x.com/beatthebombETH
//
//  • Contract holds 50% of supply.
//  • Every buy or sell pulls the trigger.
//  • 1 in 1000 chance per block of detonation.
//  • On detonation: contract dumps a slice of its bag on Uniswap.
//  • 100% of ETH (dump proceeds + 2% tax pot) goes to holders by rank.
//
//      rank  1-10  → 5% each
//      rank 11-20  → 2.5% each
//      rank 21-30  → 1% each
//      rank 31-50  → 0.5% each
//      5x wildcards → 1% each (random, any holder outside top 50)
//
//  The bigger your bag, the higher your rank.
//  The higher your rank, the bigger your cut.
//
//  Tick. Tock.
//
// ████████████████████████████████████████████████████████████████████████████

interface IERC20 {
    event Transfer(address indexed from, address indexed to, uint256 value);
    event Approval(address indexed owner, address indexed spender, uint256 value);
    function totalSupply() external view returns (uint256);
    function balanceOf(address account) external view returns (uint256);
    function transfer(address to, uint256 amount) external returns (bool);
    function allowance(address owner, address spender) external view returns (uint256);
    function approve(address spender, uint256 amount) external returns (bool);
    function transferFrom(address from, address to, uint256 amount) external returns (bool);
}

interface IUniswapV2Factory {
    function createPair(address tokenA, address tokenB) external returns (address pair);
}

interface IUniswapV2Router02 {
    function factory() external pure returns (address);
    function WETH() external pure returns (address);
    function addLiquidityETH(
        address token,
        uint amountTokenDesired,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external payable returns (uint amountToken, uint amountETH, uint liquidity);
    function swapExactTokensForETHSupportingFeeOnTransferTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external;
}

contract BombV2 is IERC20 {

    // ─── Ownership ───────────────────────────────────────────────────────────
    address private _owner;
    event OwnershipTransferred(address indexed prev, address indexed next);

    modifier onlyOwner() {
        require(msg.sender == _owner, "Not bomber");
        _;
    }

    function owner() external view returns (address) { return _owner; }

    /// @notice Renounce ownership permanently — kills rescueETH and every other onlyOwner function.
    function cutTheWires() external onlyOwner {
        emit OwnershipTransferred(_owner, address(0));
        _owner = address(0);
    }

    /// @notice Pass the detonator to a new owner.
    function passTheDetonator(address newOwner) external onlyOwner {
        require(newOwner != address(0), "Zero address");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }

    // ─── ERC20 Metadata ──────────────────────────────────────────────────────
    string public constant name     = "Beat The Bomb";
    string public constant symbol   = "BOMB";
    uint8  public constant decimals = 18;

    uint256 private constant TOTAL_SUPPLY = 1_000_000_000 * 10 ** 18;

    mapping(address => uint256) private _balances;
    mapping(address => mapping(address => uint256)) private _allowances;

    // ─── Exclusions ──────────────────────────────────────────────────────────
    mapping(address => bool) private _excludedFees;
    mapping(address => bool) private _excludedLimits;
    mapping(address => bool) private _excludedRanking;

    // ─── Tax (the fuse) ──────────────────────────────────────────────────────
    uint256 public buyTax  = 25;
    uint256 public sellTax = 25;
    uint256 public buyCount;
    uint256 public constant TAX_THRESHOLD   = 300;
    uint256 public constant FINAL_BUY_TAX   = 2;
    uint256 public constant FINAL_SELL_TAX  = 2;

    uint256 public minSwap;
    bool private _inSwap;
    modifier lockSwap() { _inSwap = true; _; _inSwap = false; }

    // ─── Limits ──────────────────────────────────────────────────────────────
    uint256 public maxTx;        // 0.5% of supply
    uint256 public maxWallet;    // 2% of supply
    bool    public limitsArmed = true;

    // ─── Trading ─────────────────────────────────────────────────────────────
    bool public fuseLit;

    // ─── Bomb mechanics ──────────────────────────────────────────────────────
    uint256 public constant DETONATION_ODDS = 1000;            // 1 in 1000 per block
    uint256 public constant DUMP_BPS        = 2000;            // 20% of contract bag per detonation
    uint256 public constant BPS_DENOMINATOR = 10_000;

    uint256 public lastFuseBlock;
    uint256 public detonationCount;
    uint256 public taxPot;                  // ETH from tax swaps, awaiting next detonation
    uint256 public lockedClaims;            // ETH owed to holders across all detonations

    // ─── Ranking ─────────────────────────────────────────────────────────────
    uint256 public constant TOP_N      = 50;
    uint256 public constant WILDCARDS  = 5;
    uint256 public constant TOTAL_SLOTS = TOP_N + WILDCARDS;   // 55

    struct RankEntry { address holder; uint256 balance; }
    RankEntry[TOP_N] private _topHolders;
    mapping(address => uint8) public rankPosition;             // 1..50, 0 = unranked

    // ─── Tracked holders (wildcard pool) ─────────────────────────────────────
    uint256 public constant MAX_TRACKED = 500;
    address[] private _trackedHolders;
    mapping(address => uint256) private _trackedIndex;         // index+1 in array, 0 = not tracked
    uint256 private _trackedCursor;                             // FIFO rotation when full

    // ─── Snapshots ───────────────────────────────────────────────────────────
    struct Snapshot {
        uint128 totalEth;       // total ETH in this detonation's payout
        uint128 ethDumped;      // portion from the BOMB dump
        address[TOTAL_SLOTS] winners;
    }
    mapping(uint256 => Snapshot) private _snapshots;
    mapping(uint256 => mapping(uint256 => bool)) public slotClaimed; // detonationId => slotIndex => claimed
    mapping(address => uint256) public lifetimeClaimed;

    // ─── Uniswap ─────────────────────────────────────────────────────────────
    IUniswapV2Router02 public immutable uniswapV2Router;
    address public uniswapV2Pair;

    // ─── Events ──────────────────────────────────────────────────────────────
    event FuseLit();
    event LimitsDisarmed();
    event TaxesDropped();
    event Tick(uint256 indexed blockNum, uint256 roll, uint256 odds);
    event Detonation(
        uint256 indexed sequence,
        uint256 indexed blockNum,
        uint256 ethDumped,
        uint256 ethTaxPot,
        uint256 totalEth
    );
    event Claimed(uint256 indexed detonationId, address indexed holder, uint256 amount);
    event PotFunded(address indexed source, uint256 amount);
    event RankClaimed(address indexed holder, uint256 position, uint256 balance);
    event RescuedEth(address indexed to, uint256 amount);

    // ─── Constructor ─────────────────────────────────────────────────────────
    constructor() {
        _owner = msg.sender;
        emit OwnershipTransferred(address(0), msg.sender);

        // 0.5% max tx, 2% max wallet
        maxTx     = (TOTAL_SUPPLY * 5) / 1000;
        maxWallet = (TOTAL_SUPPLY * 2) / 100;
        minSwap   = (TOTAL_SUPPLY * 1) / 1000;

        uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
        uniswapV2Pair   = IUniswapV2Factory(uniswapV2Router.factory())
                            .createPair(address(this), uniswapV2Router.WETH());

        // Exclusions
        _excludedFees[msg.sender]               = true;
        _excludedFees[address(this)]            = true;
        _excludedFees[address(uniswapV2Router)] = true;

        _excludedLimits[msg.sender]               = true;
        _excludedLimits[address(this)]            = true;
        _excludedLimits[uniswapV2Pair]            = true;
        _excludedLimits[address(uniswapV2Router)] = true;

        _excludedRanking[msg.sender]               = true;
        _excludedRanking[address(this)]            = true;
        _excludedRanking[uniswapV2Pair]            = true;
        _excludedRanking[address(uniswapV2Router)] = true;
        _excludedRanking[address(0)]               = true;
        _excludedRanking[address(0xdead)]          = true;

        // 50% to deployer (for LP), 50% to contract (the bag that gets dumped on detonation).
        uint256 half = TOTAL_SUPPLY / 2;
        _balances[msg.sender]    = half;
        _balances[address(this)] = half;
        emit Transfer(address(0), msg.sender,    half);
        emit Transfer(address(0), address(this), half);
    }

    // ─── ERC20 Standard ──────────────────────────────────────────────────────
    function totalSupply() external pure returns (uint256) { return TOTAL_SUPPLY; }
    function balanceOf(address account) external view returns (uint256) { return _balances[account]; }
    function allowance(address o, address s) external view returns (uint256) { return _allowances[o][s]; }

    function approve(address spender, uint256 amount) external returns (bool) {
        _approve(msg.sender, spender, amount);
        return true;
    }

    function transfer(address to, uint256 amount) external returns (bool) {
        _transfer(msg.sender, to, amount);
        return true;
    }

    function transferFrom(address from, address to, uint256 amount) external returns (bool) {
        uint256 allowed = _allowances[from][msg.sender];
        require(allowed >= amount, "ERC20: insufficient allowance");
        unchecked { _allowances[from][msg.sender] = allowed - amount; }
        _transfer(from, to, amount);
        return true;
    }

    function _approve(address o, address s, uint256 amount) internal {
        require(o != address(0) && s != address(0), "ERC20: zero address");
        _allowances[o][s] = amount;
        emit Approval(o, s, amount);
    }

    // ─── Transfer Logic ──────────────────────────────────────────────────────
    function _transfer(address from, address to, uint256 amount) internal {
        require(from != address(0) && to != address(0), "ERC20: zero address");
        require(amount > 0, "Zero amount");
        require(_balances[from] >= amount, "Insufficient balance");

        bool isBuy      = from == uniswapV2Pair;
        bool isSell     = to   == uniswapV2Pair;
        bool isExcluded = _excludedFees[from] || _excludedFees[to];

        if ((isBuy || isSell) && !isExcluded) {
            require(fuseLit, "Fuse not lit");
        }

        if (limitsArmed && !isExcluded) {
            if (isBuy) {
                require(amount <= maxTx, "Exceeds max tx");
                require(_balances[to] + amount <= maxWallet, "Exceeds max wallet");
            } else if (isSell) {
                require(amount <= maxTx, "Exceeds max tx");
            } else {
                require(_balances[to] + amount <= maxWallet, "Exceeds max wallet");
            }
        }

        // Drop taxes once threshold crossed (small forever-tax keeps the pot fed)
        bool initialPhase = buyCount < TAX_THRESHOLD;
        if (!initialPhase && (buyTax != FINAL_BUY_TAX || sellTax != FINAL_SELL_TAX)) {
            buyTax  = FINAL_BUY_TAX;
            sellTax = FINAL_SELL_TAX;
            emit TaxesDropped();
        }

        // Auto-swap accumulated tax tokens into ETH for the pot. Only the tax slice —
        // never sell BOMB earmarked as the contract's reserve bag.
        // Track tax-collected separately by always swapping fixed amounts so the contract's
        // base "reserve" balance stays untouched. Simplest: only swap from the post-launch
        // tax flow. We achieve this by tracking taxAccumulated.
        if (!_inSwap && isSell && taxAccumulated >= minSwap && fuseLit) {
            _swapTaxForEth(minSwap);
        }

        // Compute tax
        uint256 taxAmount = 0;
        if (!isExcluded) {
            if (isBuy && buyTax > 0) {
                taxAmount = (amount * buyTax) / 100;
                buyCount++;
            } else if (isSell && sellTax > 0) {
                taxAmount = (amount * sellTax) / 100;
            }
        }

        // Move tokens
        unchecked {
            _balances[from] -= amount;
            if (taxAmount > 0) {
                _balances[address(this)] += taxAmount;
                taxAccumulated           += taxAmount;
                emit Transfer(from, address(this), taxAmount);
            }
            _balances[to] += (amount - taxAmount);
        }
        emit Transfer(from, to, amount - taxAmount);

        // Track recipient for wildcard pool
        if (!_excludedRanking[to] && _balances[to] > 0) {
            _trackHolder(to);
        }

        // tick. tock.
        if (fuseLit && !_inSwap && block.number > lastFuseBlock) {
            lastFuseBlock = block.number;
            _checkFuse();
        }
    }

    // ─── Tax accounting ──────────────────────────────────────────────────────
    // We track tax tokens accumulated separately from the contract's reserve bag.
    // _balances[address(this)] = reserve (initial 500M) + taxAccumulated.
    // _swapTaxForEth only sells from the taxAccumulated slice → ETH → taxPot.
    // _detonate uses (_balances[contract] - taxAccumulated) as the dumpable reserve.
    uint256 public taxAccumulated;

    function _swapTaxForEth(uint256 amount) private lockSwap {
        if (amount > taxAccumulated) amount = taxAccumulated;
        if (amount == 0) return;

        address[] memory path = new address[](2);
        path[0] = address(this);
        path[1] = uniswapV2Router.WETH();
        _approve(address(this), address(uniswapV2Router), amount);

        uint256 ethBefore = address(this).balance;
        uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
            amount, 0, path, address(this), block.timestamp
        );
        unchecked { taxAccumulated -= amount; }
        uint256 received = address(this).balance - ethBefore;
        if (received > 0) {
            taxPot += received;
            emit PotFunded(address(this), received);
        }
    }

    // ─── Tracked holders ─────────────────────────────────────────────────────
    function _trackHolder(address account) internal {
        if (_trackedIndex[account] != 0) return;
        if (_trackedHolders.length < MAX_TRACKED) {
            _trackedHolders.push(account);
            _trackedIndex[account] = _trackedHolders.length;
        } else {
            // FIFO rotation
            address evicted = _trackedHolders[_trackedCursor];
            _trackedIndex[evicted] = 0;
            _trackedHolders[_trackedCursor] = account;
            _trackedIndex[account] = _trackedCursor + 1;
            _trackedCursor = (_trackedCursor + 1) % MAX_TRACKED;
        }
    }

    // ─── Ranking ─────────────────────────────────────────────────────────────

    /// @notice Permissionless rank claim. Reads your live balance and slots you in
    /// the top 50 if you qualify. Existing entries refresh their snapshotted balance.
    function claimRank() external {
        require(!_excludedRanking[msg.sender], "Excluded from ranking");
        uint256 myBal = _balances[msg.sender];
        require(myBal > 0, "No bag");

        uint8 currentPos = rankPosition[msg.sender];

        if (currentPos > 0) {
            // Refresh existing entry
            _topHolders[currentPos - 1].balance = myBal;
            _bubble(currentPos - 1);
        } else {
            // Try to insert
            uint256 lowestBal = _topHolders[TOP_N - 1].balance;
            require(myBal > lowestBal, "Bag too small for top 50");

            address evicted = _topHolders[TOP_N - 1].holder;
            if (evicted != address(0)) {
                rankPosition[evicted] = 0;
            }
            _topHolders[TOP_N - 1] = RankEntry(msg.sender, myBal);
            rankPosition[msg.sender] = uint8(TOP_N);
            _bubble(TOP_N - 1);
        }

        emit RankClaimed(msg.sender, rankPosition[msg.sender], myBal);
    }

    /// @notice Bubble entry at index toward correct sorted position.
    function _bubble(uint256 idx) internal {
        RankEntry memory item = _topHolders[idx];

        // Bubble up
        while (idx > 0 && _topHolders[idx - 1].balance < item.balance) {
            _topHolders[idx] = _topHolders[idx - 1];
            rankPosition[_topHolders[idx].holder] = uint8(idx + 1);
            idx--;
        }
        // Bubble down
        while (idx < TOP_N - 1 && _topHolders[idx + 1].holder != address(0) && _topHolders[idx + 1].balance > item.balance) {
            _topHolders[idx] = _topHolders[idx + 1];
            rankPosition[_topHolders[idx].holder] = uint8(idx + 1);
            idx++;
        }

        _topHolders[idx] = item;
        rankPosition[item.holder] = uint8(idx + 1);
    }

    /// @notice Refresh all top 50 balances and re-sort. Called automatically before
    /// each detonation. Stale entries (sold their bag) sink to the bottom.
    function _refreshAndSort() internal {
        // Refresh
        for (uint256 i = 0; i < TOP_N; i++) {
            address h = _topHolders[i].holder;
            if (h != address(0)) {
                _topHolders[i].balance = _balances[h];
            }
        }
        // Selection sort — 50 elements, fine
        for (uint256 i = 0; i < TOP_N - 1; i++) {
            uint256 maxIdx = i;
            for (uint256 j = i + 1; j < TOP_N; j++) {
                if (_topHolders[j].balance > _topHolders[maxIdx].balance) {
                    maxIdx = j;
                }
            }
            if (maxIdx != i) {
                RankEntry memory tmp = _topHolders[i];
                _topHolders[i] = _topHolders[maxIdx];
                _topHolders[maxIdx] = tmp;
            }
        }
        // Rewrite rankPosition
        for (uint256 i = 0; i < TOP_N; i++) {
            address h = _topHolders[i].holder;
            if (h != address(0)) {
                rankPosition[h] = uint8(i + 1);
            }
        }
    }

    // ─── Detonation ──────────────────────────────────────────────────────────

    function _checkFuse() internal {
        uint256 entropy = uint256(keccak256(abi.encodePacked(
            block.prevrandao,
            block.number,
            block.timestamp,
            blockhash(block.number - 1),
            msg.sender,
            detonationCount,
            taxPot
        )));
        uint256 roll = entropy % DETONATION_ODDS;
        emit Tick(block.number, roll, DETONATION_ODDS);

        if (roll == 0) {
            _detonate(entropy);
        }
    }

    function _detonate(uint256 entropy) internal {
        detonationCount++;
        uint256 detonationId = detonationCount;

        // 1. Dump 20% of contract's reserve bag (everything minus accumulated tax tokens).
        uint256 reserveBag = _balances[address(this)] - taxAccumulated;
        uint256 toDump     = (reserveBag * DUMP_BPS) / BPS_DENOMINATOR;
        uint256 ethDumped  = 0;
        if (toDump > 0) {
            uint256 ethBefore = address(this).balance;
            _dumpReserve(toDump);
            ethDumped = address(this).balance - ethBefore;
        }

        // 2. Combine with tax pot
        uint256 ethFromTax = taxPot;
        taxPot = 0;
        uint256 totalEth = ethDumped + ethFromTax;

        if (totalEth == 0) {
            emit Detonation(detonationId, block.number, 0, 0, 0);
            return;
        }

        // 3. Refresh + re-sort top 50 with live balances
        _refreshAndSort();

        // 4. Build winners array (top 50 + 5 wildcards)
        Snapshot storage snap = _snapshots[detonationId];
        snap.totalEth  = uint128(totalEth);
        snap.ethDumped = uint128(ethDumped);

        for (uint256 i = 0; i < TOP_N; i++) {
            snap.winners[i] = _topHolders[i].holder;
        }

        // 5. Pick 5 wildcards from tracked holders not in top 50
        _pickWildcards(snap, entropy);

        // 6. Record locked claim total so rescueETH can't touch it
        lockedClaims += totalEth;

        emit Detonation(detonationId, block.number, ethDumped, ethFromTax, totalEth);
    }

    function _dumpReserve(uint256 amount) private lockSwap {
        address[] memory path = new address[](2);
        path[0] = address(this);
        path[1] = uniswapV2Router.WETH();
        _approve(address(this), address(uniswapV2Router), amount);
        uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
            amount, 0, path, address(this), block.timestamp
        );
    }

    function _pickWildcards(Snapshot storage snap, uint256 entropy) internal {
        uint256 poolSize = _trackedHolders.length;
        if (poolSize == 0) return;

        uint256 picked = 0;
        uint256 attempts = 0;
        uint256 maxAttempts = poolSize < 50 ? poolSize * 3 : 100;

        while (picked < WILDCARDS && attempts < maxAttempts) {
            attempts++;
            entropy = uint256(keccak256(abi.encode(entropy, attempts)));
            uint256 idx = entropy % poolSize;
            address candidate = _trackedHolders[idx];

            if (candidate == address(0))           continue;
            if (rankPosition[candidate] != 0)      continue; // skip top 50
            if (_balances[candidate] == 0)         continue;

            // Skip duplicates
            bool dupe = false;
            for (uint256 i = 0; i < picked; i++) {
                if (snap.winners[TOP_N + i] == candidate) { dupe = true; break; }
            }
            if (dupe) continue;

            snap.winners[TOP_N + picked] = candidate;
            picked++;
        }
        // If we couldn't find 5 wildcards, the unfilled slots stay address(0) — that
        // ETH stays locked in lockedClaims and is recoverable later via rescueETH after a long delay.
    }

    // ─── Claims ──────────────────────────────────────────────────────────────

    /// @notice Claim your share of a specific detonation. Sums any/all slots you won.
    function claim(uint256 detonationId) external {
        Snapshot storage snap = _snapshots[detonationId];
        uint256 totalEth = snap.totalEth;
        require(totalEth > 0, "No detonation");

        uint256 owed = 0;
        for (uint256 i = 0; i < TOTAL_SLOTS; i++) {
            if (snap.winners[i] == msg.sender && !slotClaimed[detonationId][i]) {
                slotClaimed[detonationId][i] = true;
                owed += _shareForSlot(i, totalEth);
            }
        }
        require(owed > 0, "No share");

        lockedClaims              -= owed;
        lifetimeClaimed[msg.sender] += owed;

        (bool ok,) = payable(msg.sender).call{value: owed}("");
        require(ok, "ETH send failed");
        emit Claimed(detonationId, msg.sender, owed);
    }

    /// @notice Claim across multiple detonations in one tx.
    function claimMany(uint256[] calldata detonationIds) external {
        uint256 owed = 0;
        for (uint256 d = 0; d < detonationIds.length; d++) {
            uint256 id = detonationIds[d];
            Snapshot storage snap = _snapshots[id];
            uint256 totalEth = snap.totalEth;
            if (totalEth == 0) continue;

            for (uint256 i = 0; i < TOTAL_SLOTS; i++) {
                if (snap.winners[i] == msg.sender && !slotClaimed[id][i]) {
                    slotClaimed[id][i] = true;
                    uint256 share = _shareForSlot(i, totalEth);
                    owed += share;
                    emit Claimed(id, msg.sender, share);
                }
            }
        }
        require(owed > 0, "No share");

        lockedClaims              -= owed;
        lifetimeClaimed[msg.sender] += owed;

        (bool ok,) = payable(msg.sender).call{value: owed}("");
        require(ok, "ETH send failed");
    }

    function _shareForSlot(uint256 slot, uint256 totalEth) internal pure returns (uint256) {
        if (slot < 10)         return (totalEth * 500)  / BPS_DENOMINATOR;  // 5%
        else if (slot < 20)    return (totalEth * 250)  / BPS_DENOMINATOR;  // 2.5%
        else if (slot < 30)    return (totalEth * 100)  / BPS_DENOMINATOR;  // 1%
        else if (slot < 50)    return (totalEth * 50)   / BPS_DENOMINATOR;  // 0.5%
        else                   return (totalEth * 100)  / BPS_DENOMINATOR;  // 1% wildcard
    }

    // ─── Views ───────────────────────────────────────────────────────────────

    function topHolder(uint256 rank) external view returns (address holder, uint256 balanceSnapshot) {
        require(rank >= 1 && rank <= TOP_N, "Invalid rank");
        RankEntry storage e = _topHolders[rank - 1];
        return (e.holder, e.balance);
    }

    function detonationSnapshot(uint256 detonationId) external view returns (
        uint256 totalEth,
        uint256 ethDumped,
        address[TOTAL_SLOTS] memory winners
    ) {
        Snapshot storage snap = _snapshots[detonationId];
        return (snap.totalEth, snap.ethDumped, snap.winners);
    }

    function pendingForHolder(address account, uint256 detonationId) external view returns (uint256 owed) {
        Snapshot storage snap = _snapshots[detonationId];
        uint256 totalEth = snap.totalEth;
        if (totalEth == 0) return 0;
        for (uint256 i = 0; i < TOTAL_SLOTS; i++) {
            if (snap.winners[i] == account && !slotClaimed[detonationId][i]) {
                owed += _shareForSlot(i, totalEth);
            }
        }
    }

    function trackedHolderCount() external view returns (uint256) { return _trackedHolders.length; }

    function bombStatus() external view returns (
        uint256 reserveBag,
        uint256 taxAccum,
        uint256 pot,
        uint256 detonations,
        uint256 trackedHolders,
        bool    armed
    ) {
        return (
            _balances[address(this)] - taxAccumulated,
            taxAccumulated,
            taxPot,
            detonationCount,
            _trackedHolders.length,
            fuseLit
        );
    }

    // ─── Owner Functions ─────────────────────────────────────────────────────

    /// @notice Light the fuse — open trading. One-shot.
    function lightFuse() external onlyOwner {
        require(!fuseLit, "Already lit");
        fuseLit = true;
        emit FuseLit();
    }

    /// @notice Disarm tx/wallet limits.
    function disarmLimits() external onlyOwner {
        limitsArmed = false;
        emit LimitsDisarmed();
    }

    /// @notice Manage exclusions for an address.
    function bombSquad(
        address addr,
        bool excludedFromFees,
        bool excludedFromLimits,
        bool excludedFromRanking
    ) external onlyOwner {
        _excludedFees[addr]    = excludedFromFees;
        _excludedLimits[addr]  = excludedFromLimits;
        _excludedRanking[addr] = excludedFromRanking;
    }

    /// @notice Force-swap accumulated tax tokens into ETH.
    function forceSwap() external onlyOwner {
        _swapTaxForEth(taxAccumulated);
    }

    /// @notice Recover stuck ERC-20s (not BOMB itself — its balance is part of the reserve / tax pool).
    function rescueTokens(address token) external onlyOwner {
        require(token != address(this), "Cannot rescue BOMB");
        uint256 bal = IERC20(token).balanceOf(address(this));
        IERC20(token).transfer(_owner, bal);
    }

    function rescueETH(address payable to) external onlyOwner {
        require(to != address(0), "Zero address");
        uint256 bal = address(this).balance;
        require(bal > 0, "No ETH");
        // Wipe internal accounting so view functions stay consistent.
        lockedClaims = 0;
        taxPot       = 0;
        (bool ok,) = to.call{value: bal}("");
        require(ok, "ETH send failed");
        emit RescuedEth(to, bal);
    }

    /// @notice Direct ETH sent to the contract is treated as a top-up to the next detonation pot.
    receive() external payable {
        if (msg.value > 0) {
            taxPot += msg.value;
            emit PotFunded(msg.sender, msg.value);
        }
    }
}
Compiler settingsShow
{
  "libraries": {},
  "optimizer": {
    "runs": 200,
    "enabled": true
  },
  "evmVersion": "paris"
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.