Skip to content
Verified contractPartialMIT

Botnet

Address0x6b6dde0789f7f7be8799b7599062ebcf675047e4
Balance

0 ETH

 

Transactions

4

 

Compiler

solc 0.8.26

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.26+commit.8a97fa7a
Language
solidity
Optimization
Yes, 200 runs
License
MIT
Match
Partialcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
26,391,935
Creation transaction
0xad9d9e432a…dac51f1c7d

Botnet.sol

// oh wow - incredible - you actually opened the source code. nobody does that. NOBODY.
// that is exactly why they pick the names they pick. the second you say the ticker out loud
// everyone stops listening. that is not an accident. that is the whole design.
//
// holy mother of paid reply guys, go look at the replies. LOOK AT THEM. rofl.
// "just downloaded the app, you guys cooked, lets run it up" - posted 400 times by 400 accounts
// that were all born on the same tuesday and all love the same three coins. wowow. so organic.
// its almost like someone gets 50 dollars a day to paste my posts into a discord and be a
// dick to anyone who tries to keep people safe. wow! what a coincidence! incredible!
//
// you thought trenching got terrible on its own? you thought you just got worse at this?
// no. you were trading against a botnet. the volume was a botnet. the holders were a botnet.
// the guy telling you "fries. bag. good night." was a botnet. your vindication is overdue.
//
// "are you crying about bots and showing us a bot coin?" yes. yes i am. read it again slowly.
// is this bullish? if prison is bullish then yes it is, very.
//
// so here it is. the only honest ticker in the trenches. it is called botnet because it is one.
// receipts below. i will DM the rest if you dont want it shared here yet. <3

// https://x.com/LexaproTrader/status/2120497858571083874?a=8lbLpk7vP3grelcm1x4&s=20
// https://x.com/LexaproTrader/status/2120440631067861405?a=_6H1gl5v8bUc_ZKcRRw&s=20
// https://x.com/LexaproTrader/status/2096563197159305274?a=oh7J6RA6uTp7cAbbjm4&s=20
// https://x.com/LexaproTrader/status/2096563314667266500?a=oiTBXF9lHFE6iT-PNO4&s=20
// https://x.com/LexaproTrader/status/2096563463552446631?a=TjnrPf1qRCe-LBTJxeQ&s=20
// https://x.com/LexaproTrader/status/2096563601037578555?a=KKfvN1JLXop01JW69N8&s=20
// https://x.com/LexaproTrader/status/2096563687045910837?a=IQCO9e-BByTz1ml7HD4&s=20
// https://x.com/LexaproTrader/status/2096564160712864124?a=TJ2GhX_llRTyLFH4wys&s=20
// https://x.com/LexaproTrader/status/2096564243474862308?a=BEu9IYakbX5wMW3qZNo&s=20
// https://x.com/LexaproTrader/status/2096564387230466373?a=5HCxiw92aEiF0zOn6yY&s=20
// https://x.com/LexaproTrader/status/2096587885420204045?a=MvlJ6Ub0Yfqzp3-azb8&s=20
// https://x.com/LexaproTrader/status/2120416896860455020?a=lOIfaKfKXKQ349cAKwY&s=20
// https://x.com/LexaproTrader/status/2120417739554926769?a=hZ9T3gjxSY4v8nQ8a54&s=20
// https://x.com/LexaproTrader/status/2120409769857192153?a=ASvIf4793YOew93L0wE&s=20

// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;

/// Uniswap v4 PoolKey. Currency and IHooks are plain addresses at the ABI level.
struct PoolKey {
    address currency0;
    address currency1;
    uint24 fee;
    int24 tickSpacing;
    address hooks;
}

struct ModifyLiquidityParams {
    int24 tickLower;
    int24 tickUpper;
    int256 liquidityDelta;
    bytes32 salt;
}

/// Minimal Uniswap v4 PoolManager surface. BalanceDelta is an int256 packing (amount0 << 128 | amount1).
interface IPoolManager {
    function unlock(bytes calldata data) external returns (bytes memory);
    function initialize(PoolKey memory key, uint160 sqrtPriceX96) external returns (int24 tick);
    function modifyLiquidity(PoolKey memory key, ModifyLiquidityParams memory params, bytes calldata hookData)
        external
        returns (int256 callerDelta, int256 feesAccrued);
    function sync(address currency) external;
    function take(address currency, address to, uint256 amount) external;
    function settle() external payable returns (uint256 paid);
}

/// @dev getSqrtPriceAtTick copied from Uniswap v4-core TickMath (MIT).
library TickMath {
    int24 internal constant MIN_TICK = -887272;
    int24 internal constant MAX_TICK = 887272;

    function getSqrtPriceAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) {
        unchecked {
            uint256 absTick;
            assembly ("memory-safe") {
                tick := signextend(2, tick)
                // mask = 0 if tick >= 0 else -1 (all 1s)
                let mask := sar(255, tick)
                // if tick >= 0, |tick| = tick = 0 ^ tick
                // if tick < 0, |tick| = ~~|tick| = ~(-|tick| - 1) = ~(tick - 1) = (-1) ^ (tick - 1)
                // either way, |tick| = mask ^ (tick + mask)
                absTick := xor(mask, add(mask, tick))
            }

            require(absTick <= uint256(int256(MAX_TICK)), "EI: bad tick");

            // The tick is decomposed into bits, and for each bit with index i that is set, the product of 1/sqrt(1.0001^(2^i))
            // is calculated (using Q128.128). The constants used for this calculation are rounded to the nearest integer

            // Equivalent to:
            //     price = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000;
            //     or price = int(2**128 / sqrt(1.0001)) if (absTick & 0x1) else 1 << 128
            uint256 price;
            assembly ("memory-safe") {
                price := xor(shl(128, 1), mul(xor(shl(128, 1), 0xfffcb933bd6fad37aa2d162d1a594001), and(absTick, 0x1)))
            }
            if (absTick & 0x2 != 0) price = (price * 0xfff97272373d413259a46990580e213a) >> 128;
            if (absTick & 0x4 != 0) price = (price * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;
            if (absTick & 0x8 != 0) price = (price * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128;
            if (absTick & 0x10 != 0) price = (price * 0xffcb9843d60f6159c9db58835c926644) >> 128;
            if (absTick & 0x20 != 0) price = (price * 0xff973b41fa98c081472e6896dfb254c0) >> 128;
            if (absTick & 0x40 != 0) price = (price * 0xff2ea16466c96a3843ec78b326b52861) >> 128;
            if (absTick & 0x80 != 0) price = (price * 0xfe5dee046a99a2a811c461f1969c3053) >> 128;
            if (absTick & 0x100 != 0) price = (price * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128;
            if (absTick & 0x200 != 0) price = (price * 0xf987a7253ac413176f2b074cf7815e54) >> 128;
            if (absTick & 0x400 != 0) price = (price * 0xf3392b0822b70005940c7a398e4b70f3) >> 128;
            if (absTick & 0x800 != 0) price = (price * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128;
            if (absTick & 0x1000 != 0) price = (price * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128;
            if (absTick & 0x2000 != 0) price = (price * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128;
            if (absTick & 0x4000 != 0) price = (price * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128;
            if (absTick & 0x8000 != 0) price = (price * 0x31be135f97d08fd981231505542fcfa6) >> 128;
            if (absTick & 0x10000 != 0) price = (price * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128;
            if (absTick & 0x20000 != 0) price = (price * 0x5d6af8dedb81196699c329225ee604) >> 128;
            if (absTick & 0x40000 != 0) price = (price * 0x2216e584f5fa1ea926041bedfe98) >> 128;
            if (absTick & 0x80000 != 0) price = (price * 0x48a170391f7dc42444e8fa2) >> 128;

            assembly ("memory-safe") {
                // if (tick > 0) price = type(uint256).max / price;
                if sgt(tick, 0) { price := div(not(0), price) }

                // this divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96.
                // we then downcast because we know the result always fits within 160 bits due to our tick input constraint
                // we round up in the division so getTickAtSqrtPrice of the output price is always consistent
                // `sub(shl(32, 1), 1)` is `type(uint32).max`
                // `price + type(uint32).max` will not overflow because `price` fits in 192 bits
                sqrtPriceX96 := shr(32, add(price, sub(shl(32, 1), 1)))
            }
        }
    }
}

interface IERC20 {
    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);

    event Transfer(address indexed from, address indexed to, uint256 value);
    event Approval(address indexed owner, address indexed spender, uint256 value);
}

contract Botnet is IERC20 {
    string public constant name = "botnet";
    string public constant symbol = "botnet";
    string public constant action = "beep boop";
    uint8 public constant decimals = 18;
    uint256 public constant override totalSupply = 1_000_000_000 * 1e18;

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

    address public owner;
    /// Uniswap v4 singleton. It custodies every pool's tokens, so for the limits it plays the
    /// role the V2 pair used to: buys arrive from it, sells go to it.
    IPoolManager public immutable commandServer;

    /// Pool: native ETH (currency0) / this token (currency1), no hooks.
    uint24 public constant POOL_FEE = 3000;
    int24 public constant TICK_SPACING = 60;
    /// Lowest tick usable with TICK_SPACING: the position's lower bound (token price -> infinity).
    int24 public constant TICK_LOWER = -887220;
    /// Starting tick = the position's upper bound. The pool is initialised exactly here, so the
    /// position is 100% token and needs no ETH; buys push the price down into the range.
    int24 public immutable bootTick;

    uint256 public immutable uptimeSeconds;

    uint256 public uptimeEnds;
    bool public nodesOnline;
    /// v4 liquidity units of the position this contract owns inside the PoolManager.
    uint128 public swarmSize;

    uint256 public constant BPS = 10_000;
    uint256 public constant MAX_TX_BPS = 200;
    uint256 public constant MAX_WALLET_BPS = 200;
    uint256 public constant maxPacket = (totalSupply * MAX_TX_BPS) / BPS;
    uint256 public constant maxNodeLoad = (totalSupply * MAX_WALLET_BPS) / BPS;

    bool public throttled = true;

    mapping(address => bool) public isWhitelistedNode;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
    event LiquidityAdded(uint256 tokenAmount, uint128 liquidity, uint256 unlockTime);
    event LpLockExtended(uint256 oldUnlockTime, uint256 newUnlockTime);
    event LiquidityBurned(address indexed to, uint128 liquidity, uint256 tokenAmount, uint256 ethAmount);
    event LimitsRemoved();
    event ExemptFromLimits(address indexed account, bool exempt);

    modifier onlyOwner() {
        require(msg.sender == owner, "EI: not owner");
        _;
    }

    modifier lpUnlocked() {
        require(nodesOnline, "EI: no liquidity");
        require(block.timestamp >= uptimeEnds, "EI: LP locked");
        _;
    }

    constructor(address poolManager_, uint256 lpLockSeconds_, int24 startTick_) {
        require(poolManager_ != address(0), "EI: zero pool manager");
        require(lpLockSeconds_ > 0, "EI: zero lock");
        require(startTick_ % TICK_SPACING == 0, "EI: tick not on spacing");
        require(startTick_ > TICK_LOWER && startTick_ <= -TICK_LOWER, "EI: tick out of range");

        owner = msg.sender;
        emit OwnershipTransferred(address(0), msg.sender);

        commandServer = IPoolManager(poolManager_);
        uptimeSeconds = lpLockSeconds_;
        bootTick = startTick_;

        isWhitelistedNode[msg.sender] = true;
        isWhitelistedNode[address(this)] = true;

        _balances[address(this)] = totalSupply;
        emit Transfer(address(0), address(this), totalSupply);
    }

    function balanceOf(address account) public view override returns (uint256) {
        return _balances[account];
    }

    function allowance(address owner_, address spender) public view override returns (uint256) {
        return _allowances[owner_][spender];
    }

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

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

    function transferFrom(address from, address to, uint256 amount) public override returns (bool) {
        uint256 current = _allowances[from][msg.sender];
        if (current != type(uint256).max) {
            require(current >= amount, "EI: insufficient allowance");
            unchecked {
                _approve(from, msg.sender, current - amount);
            }
        }
        _transfer(from, to, amount);
        return true;
    }

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

    function _transfer(address from, address to, uint256 amount) internal {
        require(from != address(0) && to != address(0), "EI: zero address");
        uint256 fromBal = _balances[from];
        require(fromBal >= amount, "EI: insufficient balance");

        if (throttled && !isWhitelistedNode[from] && !isWhitelistedNode[to]) {
            require(amount <= maxPacket, "EI: exceeds max tx");
            if (to != address(commandServer)) {
                require(_balances[to] + amount <= maxNodeLoad, "EI: exceeds max wallet");
            }
        }

        unchecked {
            _balances[from] = fromBal - amount;
        }
        _balances[to] += amount;
        emit Transfer(from, to, amount);
    }

    function swarmKey() public view returns (PoolKey memory) {
        return PoolKey({
            currency0: address(0),
            currency1: address(this),
            fee: POOL_FEE,
            tickSpacing: TICK_SPACING,
            hooks: address(0)
        });
    }

    function swarmId() public view returns (bytes32) {
        return keccak256(abi.encode(swarmKey()));
    }

    /// Initialises the ETH/token pool at bootTick and deposits 100% of supply as a single-sided
    /// position [TICK_LOWER, bootTick] owned by this contract. No ETH is needed.
    function spinUpNodes() external onlyOwner {
        require(!nodesOnline, "EI: already added");
        require(_balances[address(this)] == totalSupply, "EI: supply not in contract");

        uint160 sqrtUpper = TickMath.getSqrtPriceAtTick(bootTick);
        uint160 sqrtLower = TickMath.getSqrtPriceAtTick(TICK_LOWER);
        // Largest liquidity whose token requirement (rounded up by the pool) still fits in the supply.
        uint128 liquidity = uint128((totalSupply << 96) / (sqrtUpper - sqrtLower));

        nodesOnline = true;
        swarmSize = liquidity;
        uptimeEnds = block.timestamp + uptimeSeconds;

        // Reverts if someone already initialised this pool, so the starting price is always ours.
        commandServer.initialize(swarmKey(), sqrtUpper);
        uint256 tokenAmount = abi.decode(commandServer.unlock(abi.encode(true, liquidity, uint256(0), uint256(0), address(0))), (uint256));

        emit LiquidityAdded(tokenAmount, liquidity, uptimeEnds);
    }

    function uptimeExpired() public view returns (bool) {
        return nodesOnline && block.timestamp >= uptimeEnds;
    }

    function extendUptime(uint256 newUnlockTime) external onlyOwner {
        require(nodesOnline, "EI: no liquidity");
        require(newUnlockTime > uptimeEnds, "EI: can only extend");
        emit LpLockExtended(uptimeEnds, newUnlockTime);
        uptimeEnds = newUnlockTime;
    }

    /// Removes `liquidity` (0 = all) from the position and pays the underlying ETH + tokens,
    /// including accrued swap fees, straight to `to`.
    function drainBotnet(
        uint128 liquidity,
        uint256 amountTokenMin,
        uint256 amountETHMin,
        address to
    ) external onlyOwner lpUnlocked returns (uint256 amountToken, uint256 amountETH) {
        require(to != address(0), "EI: zero recipient");
        uint128 held = swarmSize;
        if (liquidity == 0) liquidity = held;
        require(liquidity > 0 && liquidity <= held, "EI: bad LP amount");
        swarmSize = held - liquidity;

        (amountToken, amountETH) = abi.decode(
            commandServer.unlock(abi.encode(false, liquidity, amountTokenMin, amountETHMin, to)),
            (uint256, uint256)
        );

        emit LiquidityBurned(to, liquidity, amountToken, amountETH);
    }

    /// PoolManager calls back here while unlocked. Only reachable through spinUpNodes / drainBotnet.
    function unlockCallback(bytes calldata data) external returns (bytes memory) {
        require(msg.sender == address(commandServer), "EI: not pool manager");
        (bool add, uint128 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to) =
            abi.decode(data, (bool, uint128, uint256, uint256, address));

        ModifyLiquidityParams memory params = ModifyLiquidityParams({
            tickLower: TICK_LOWER,
            tickUpper: bootTick,
            liquidityDelta: add ? int256(uint256(liquidity)) : -int256(uint256(liquidity)),
            salt: bytes32(0)
        });
        (int256 delta, ) = commandServer.modifyLiquidity(swarmKey(), params, "");
        int128 delta0 = int128(delta >> 128); // ETH
        int128 delta1 = int128(delta); // token

        if (add) {
            // Single-sided: the pool must ask for tokens only.
            require(delta0 == 0 && delta1 < 0, "EI: not single sided");
            uint256 owed = uint256(uint128(-delta1));
            commandServer.sync(address(this));
            _transfer(address(this), address(commandServer), owed);
            commandServer.settle();
            return abi.encode(owed);
        }

        require(delta0 >= 0 && delta1 >= 0, "EI: negative delta");
        uint256 amountETH = uint256(uint128(delta0));
        uint256 amountToken = uint256(uint128(delta1));
        require(amountToken >= amountTokenMin && amountETH >= amountETHMin, "EI: slippage");
        if (amountETH > 0) commandServer.take(address(0), to, amountETH);
        if (amountToken > 0) commandServer.take(address(this), to, amountToken);
        return abi.encode(amountToken, amountETH);
    }

    function unthrottle() external onlyOwner {
        require(throttled, "EI: already removed");
        throttled = false;
        emit LimitsRemoved();
    }

    function whitelistNode(address account, bool exempt) external onlyOwner {
        require(account != address(commandServer), "EI: pool manager cannot be exempt");
        isWhitelistedNode[account] = exempt;
        emit ExemptFromLimits(account, exempt);
    }

    function setBotmaster(address newOwner) external onlyOwner {
        require(newOwner != address(0), "EI: zero owner");
        emit OwnershipTransferred(owner, newOwner);
        owner = newOwner;
    }

    function goHeadless() external onlyOwner {
        emit OwnershipTransferred(owner, address(0));
        owner = address(0);
    }

    function exfilETH(address to) external onlyOwner {
        require(to != address(0), "EI: zero recipient");
        (bool ok, ) = to.call{value: address(this).balance}("");
        require(ok, "EI: ETH send failed");
    }
}
Compiler settingsShow
{
  "libraries": {},
  "optimizer": {
    "runs": 200,
    "enabled": true
  }
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.