├── accounts.txt ├── proxy.txt ├── requirements.txt ├── .env ├── README.md └── bot.py /accounts.txt: -------------------------------------------------------------------------------- 1 | your_private_key_1 2 | your_private_key_2 -------------------------------------------------------------------------------- /proxy.txt: -------------------------------------------------------------------------------- 1 | ip:port # Default Protcol HTTP. 2 | protocol://ip:port 3 | protocol://user:pass@ip:port -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | web3==7.11.1 2 | aiohttp==3.11.10 3 | aiohttp-socks==0.9.1 4 | fake-useragent==1.5.1 5 | python-dotenv==1.1.1 6 | eth-account==0.13.7 7 | eth-utils==5.3.0 8 | eth-abi==5.2.0 9 | colorama==0.4.6 10 | pytz==2024.1 -------------------------------------------------------------------------------- /.env: -------------------------------------------------------------------------------- 1 | WRAP_AMOUNT = 0.1 2 | 3 | SWAP_COUNT = 10 4 | XOS_SWAP_AMOUNT = 0.01 5 | WXOS_SWAP_AMOUNT = 0.01 6 | BNB_SWAP_AMOUNT = 0.0001 7 | BONK_SWAP_AMOUNT = 1 8 | JUP_SWAP_AMOUNT = 0.1 9 | PENGU_SWAP_AMOUNT = 1 10 | RAY_SWAP_AMOUNT = 0.1 11 | SOL_SWAP_AMOUNT = 0.0001 12 | TRUMP_SWAP_AMOUNT = 0.01 13 | TST_SWAP_AMOUNT = 1 14 | USDC_SWAP_AMOUNT = 0.1 15 | USDT_SWAP_AMOUNT = 0.1 16 | WIF_SWAP_AMOUNT = 0.1 17 | 18 | LIQUIDITY_COUNT = 10 19 | XOS_LIQUIDITY_AMOUNT = 0.01 20 | WXOS_LIQUIDITY_AMOUNT = 0.01 21 | BNB_LIQUIDITY_AMOUNT = 0.0001 22 | BONK_LIQUIDITY_AMOUNT = 1 23 | JUP_LIQUIDITY_AMOUNT = 0.1 24 | PENGU_LIQUIDITY_AMOUNT = 1 25 | RAY_LIQUIDITY_AMOUNT = 0.1 26 | SOL_LIQUIDITY_AMOUNT = 0.0001 27 | TRUMP_LIQUIDITY_AMOUNT = 0.01 28 | USDC_LIQUIDITY_AMOUNT = 0.1 29 | USDT_LIQUIDITY_AMOUNT = 0.1 30 | WIF_LIQUIDITY_AMOUNT = 0.1 31 | 32 | MIN_DELAY = 5 33 | MAX_DELAY = 10 -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Xos Testnet BOT 2 | Xos Testnet BOT 3 | 4 | - Register Here: [Xos Testnet](X.ink/P4136T) 5 | - Connect New EVM Wallet 6 | - Claim [Faucet](https://faucet.x.ink/) 7 | - [XOS Dex](https://dex.x.ink/swap) 8 | 9 | ## Features 10 | 11 | - Auto Get Account Information 12 | - Auto Run With [Proxyscrape Free Proxy](https://proxyscrape.com/free-proxy-list) - `Choose 1` 13 | - Auto Run With Private Proxy - `Choose 2` 14 | - Auto Run Without Proxy - `Choose 3` 15 | - Auto Rotate Invalid Proxies - `y` or `n` 16 | - Auto Claim Check-In 17 | - Auto Perform Draw 18 | - Auto Wrap XOS to WXOS 19 | - Auto Unwrap WXOS to XOS 20 | - Auto Make Random Swap 21 | - Auto Add Liquidity 22 | - Multi Accounts 23 | 24 | ## Requiremnets 25 | 26 | - Make sure you have Python3.9 or higher installed and pip. 27 | 28 | ## Instalation 29 | 30 | 1. **Clone The Repositories:** 31 | ```bash 32 | git clone https://github.com/vonssy/XosTestnet-BOT.git 33 | ``` 34 | ```bash 35 | cd XosTestnet-BOT 36 | ``` 37 | 38 | 2. **Install Requirements:** 39 | ```bash 40 | pip install -r requirements.txt #or pip3 install -r requirements.txt 41 | ``` 42 | 43 | ### Note: Check your web3, eth-account, eth-abi, and eth-utils library version first. If not same with version in requirements.txt, u must uninstall that library. 44 | - **Check Library Version** 45 | ```bash 46 | pip show libary_name 47 | ``` 48 | - **Uninstall Library** 49 | ```bash 50 | pip uninstall libary_name 51 | ``` 52 | - **Install Library With Version** 53 | ```bash 54 | pip install libary_name==version 55 | ``` 56 | 57 | ## Configuration 58 | 59 | - **accounts.txt:** You will find the file `accounts.txt` inside the project directory. Make sure `accounts.txt` contains data that matches the format expected by the script. Here are examples of file formats: 60 | ```bash 61 | your_private_key_1 62 | your_private_key_2 63 | ``` 64 | 65 | - **proxy.txt:** You will find the file `proxy.txt` inside the project directory. Make sure `proxy.txt` contains data that matches the format expected by the script. Here are examples of file formats: 66 | ```bash 67 | ip:port # Default Protcol HTTP. 68 | protocol://ip:port 69 | protocol://user:pass@ip:port 70 | ``` 71 | 72 | ## Run 73 | 74 | ```bash 75 | python bot.py #or python3 bot.py 76 | ``` 77 | 78 | ## Buy Me a Coffee 79 | 80 | - **EVM:** 0xe3c9ef9a39e9eb0582e5b147026cae524338521a 81 | - **TON:** UQBEFv58DC4FUrGqinBB5PAQS7TzXSm5c1Fn6nkiet8kmehB 82 | - **SOL:** E1xkaJYmAFEj28NPHKhjbf7GcvfdjKdvXju8d8AeSunf 83 | - **SUI:** 0xa03726ecbbe00b31df6a61d7a59d02a7eedc39fe269532ceab97852a04cf3347 84 | 85 | Thank you for visiting this repository, don't forget to contribute in the form of follows and stars. 86 | If you have questions, find an issue, or have suggestions for improvement, feel free to contact me or open an *issue* in this GitHub repository. 87 | 88 | **vonssy** -------------------------------------------------------------------------------- /bot.py: -------------------------------------------------------------------------------- 1 | from web3 import Web3 2 | from web3.exceptions import TransactionNotFound 3 | from eth_account import Account 4 | from eth_account.messages import encode_defunct 5 | from eth_abi.abi import encode 6 | from eth_utils import to_hex 7 | from dotenv import load_dotenv 8 | from aiohttp import ClientResponseError, ClientSession, ClientTimeout, BasicAuth 9 | from aiohttp_socks import ProxyConnector 10 | from fake_useragent import FakeUserAgent 11 | from datetime import datetime 12 | from colorama import * 13 | import asyncio, random, time, json, re, os, pytz 14 | 15 | load_dotenv() 16 | 17 | wib = pytz.timezone('Asia/Jakarta') 18 | 19 | class XOS: 20 | def __init__(self) -> None: 21 | self.BASE_API = "https://api.x.ink/v1" 22 | self.RPC_URL = "https://testnet-rpc.x.ink/" 23 | self.WXOS_CONTRACT_ADDRESS = "0x0AAB67cf6F2e99847b9A95DeC950B250D648c1BB" 24 | self.BNB_CONTRACT_ADDRESS = "0x83DFbE02dc1B1Db11bc13a8Fc7fd011E2dBbd7c0" 25 | self.BONK_CONTRACT_ADDRESS = "0x00309602f7977D45322279c4dD5cf61D16FD061B" 26 | self.JUP_CONTRACT_ADDRESS = "0x26b597804318824a2E88Cd717376f025E6bb2219" 27 | self.PENGU_CONTRACT_ADDRESS = "0x9573577927d3AbECDa9C69F5E8C50bc88b1e26EE" 28 | self.RAY_CONTRACT_ADDRESS = "0x4A79C7Fdb6d448b3f8F643010F4CdE8b2363EFD6" 29 | self.SOL_CONTRACT_ADDRESS = "0x0c8a3D1fE7E40a39D3331D5Fa4B9fee1EcA1926A" 30 | self.TRUMP_CONTRACT_ADDRESS = "0xC09a5026d9244d482Fb913609Aeb7347B7F12800" 31 | self.TST_CONTRACT_ADDRESS = "0xD1194D2D06EDFBD815574383aeD6A9D76Cd568dA" 32 | self.USDC_CONTRACT_ADDRESS = "0xb2C1C007421f0Eb5f4B3b3F38723C309Bb208d7d" 33 | self.USDT_CONTRACT_ADDRESS = "0x2CCDB83a043A32898496c1030880Eb2cB977CAbc" 34 | self.WIF_CONTRACT_ADDRESS = "0x9c6eEc453821d12B8dfea20b6FbdDB47f7bc500d" 35 | self.SWAP_ROUTER_ADDRESS = "0xdc7D6b58c89A554b3FDC4B5B10De9b4DbF39FB40" 36 | self.POOL_ROUTER_ADDRESS = "0x55a4669cd6895EA25C174F13E1b49d69B4481704" 37 | self.QUOTER_ROUTER_ADDRESS = "0xE9b889C12A10f35B1b6b37764cd939988d465B85" 38 | self.ERC20_CONTRACT_ABI = json.loads('''[ 39 | {"type":"function","name":"balanceOf","stateMutability":"view","inputs":[{"name":"address","type":"address"}],"outputs":[{"name":"","type":"uint256"}]}, 40 | {"type":"function","name":"allowance","stateMutability":"view","inputs":[{"name":"owner","type":"address"},{"name":"spender","type":"address"}],"outputs":[{"name":"","type":"uint256"}]}, 41 | {"type":"function","name":"approve","stateMutability":"nonpayable","inputs":[{"name":"spender","type":"address"},{"name":"amount","type":"uint256"}],"outputs":[{"name":"","type":"bool"}]}, 42 | {"type":"function","name":"decimals","stateMutability":"view","inputs":[],"outputs":[{"name":"","type":"uint8"}]}, 43 | {"type":"function","name":"deposit","stateMutability":"payable","inputs":[],"outputs":[]}, 44 | {"type":"function","name":"withdraw","stateMutability":"nonpayable","inputs":[{"name":"wad","type":"uint256"}],"outputs":[]}, 45 | {"type":"function","name":"multicall","stateMutability":"nonpayable","inputs":[{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"outputs":[{"internalType":"bytes[]","name":"","type":"bytes[]"}]} 46 | ]''') 47 | self.QUOTER_CONTRACT_ABI = [ 48 | { 49 | "type": "function", 50 | "name": "quoteExactInput", 51 | "stateMutability": "nonpayable", 52 | "inputs": [ 53 | { "internalType": "bytes", "name": "path", "type": "bytes" }, 54 | { "internalType": "uint256", "name": "amountIn", "type": "uint256" } 55 | ], 56 | "outputs": [ 57 | { "internalType": "uint256", "name": "amountOut", "type": "uint256" } 58 | ] 59 | } 60 | ] 61 | self.SWAP_CONTRACT_ABI = [ 62 | { 63 | "type": "function", 64 | "name": "multicall", 65 | "stateMutability": "payable", 66 | "inputs": [ 67 | { "internalType": "uint256", "name": "deadline", "type": "uint256" }, 68 | { "internalType": "bytes[]", "name": "data", "type": "bytes[]" } 69 | ], 70 | "outputs": [ 71 | { "internalType": "bytes[]", "name": "", "type": "bytes[]" } 72 | ] 73 | } 74 | ] 75 | self.LIQUIDITY_CONTRACT_ABI = [ 76 | { 77 | "type": "function", 78 | "name": "multicall", 79 | "stateMutability": "payable", 80 | "inputs": [ 81 | { "internalType": "bytes[]", "name": "data", "type": "bytes[]" } 82 | ], 83 | "outputs": [ 84 | { "internalType": "bytes[]", "name": "results", "type": "bytes[]" } 85 | ] 86 | }, 87 | { 88 | "type": "function", 89 | "name": "mint", 90 | "stateMutability": "nonpayable", 91 | "inputs": [ 92 | { 93 | "type": "tuple", 94 | "name": "params", 95 | "internalType": "struct INonfungiblePositionManager.MintParams", 96 | "components": [ 97 | { "internalType": "address", "name": "token0", "type": "address" }, 98 | { "internalType": "address", "name": "token1", "type": "address" }, 99 | { "internalType": "uint24", "name": "fee", "type": "uint24" }, 100 | { "internalType": "int24", "name": "tickLower", "type": "int24" }, 101 | { "internalType": "int24", "name": "tickUpper", "type": "int24" }, 102 | { "internalType": "uint256", "name": "amount0Desired", "type": "uint256" }, 103 | { "internalType": "uint256", "name": "amount1Desired", "type": "uint256" }, 104 | { "internalType": "uint256", "name": "amount0Min", "type": "uint256" }, 105 | { "internalType": "uint256", "name": "amount1Min", "type": "uint256" }, 106 | { "internalType": "address", "name": "recipient", "type": "address" }, 107 | { "internalType": "uint256", "name": "deadline", "type": "uint256" } 108 | ] 109 | } 110 | ], 111 | "outputs": [ 112 | { "internalType": "uint256", "name": "tokenId", "type": "uint256" }, 113 | { "internalType": "uint128", "name": "liquidity", "type": "uint128" }, 114 | { "internalType": "uint256", "name": "amount0", "type": "uint256" }, 115 | { "internalType": "uint256", "name": "amount1", "type": "uint256" } 116 | ] 117 | } 118 | ] 119 | self.REF_CODE = "1V7NKQ" # U can change it with yours. 120 | self.HEADERS = {} 121 | self.proxies = [] 122 | self.proxy_index = 0 123 | self.account_proxies = {} 124 | self.access_tokens = {} 125 | self.used_nonce = {} 126 | self.wrap_option = None 127 | self.wrap_amount = float(os.getenv("WRAP_AMOUNT")) 128 | self.swap_count = int(os.getenv("SWAP_COUNT")) 129 | self.xos_swap_amount = float(os.getenv("XOS_SWAP_AMOUNT")) 130 | self.wxos_swap_amount = float(os.getenv("WXOS_SWAP_AMOUNT")) 131 | self.bnb_swap_amount = float(os.getenv("BNB_SWAP_AMOUNT")) 132 | self.bonk_swap_amount = float(os.getenv("BONK_SWAP_AMOUNT")) 133 | self.jup_swap_amount = float(os.getenv("JUP_SWAP_AMOUNT")) 134 | self.pengu_swap_amount = float(os.getenv("PENGU_SWAP_AMOUNT")) 135 | self.ray_swap_amount = float(os.getenv("RAY_SWAP_AMOUNT")) 136 | self.sol_swap_amount = float(os.getenv("SOL_SWAP_AMOUNT")) 137 | self.trump_swap_amount = float(os.getenv("TRUMP_SWAP_AMOUNT")) 138 | self.tst_swap_amount = float(os.getenv("TST_SWAP_AMOUNT")) 139 | self.usdc_swap_amount = float(os.getenv("USDC_SWAP_AMOUNT")) 140 | self.usdt_swap_amount = float(os.getenv("USDT_SWAP_AMOUNT")) 141 | self.wif_swap_amount = float(os.getenv("WIF_SWAP_AMOUNT")) 142 | self.liquidity_count = int(os.getenv("LIQUIDITY_COUNT")) 143 | self.xos_liquidity_amount = float(os.getenv("XOS_LIQUIDITY_AMOUNT")) 144 | self.wxos_liquidity_amount = float(os.getenv("WXOS_LIQUIDITY_AMOUNT")) 145 | self.bnb_liquidity_amount = float(os.getenv("BNB_LIQUIDITY_AMOUNT")) 146 | self.bonk_liquidity_amount = float(os.getenv("BONK_LIQUIDITY_AMOUNT")) 147 | self.jup_liquidity_amount = float(os.getenv("JUP_LIQUIDITY_AMOUNT")) 148 | self.pengu_liquidity_amount = float(os.getenv("PENGU_LIQUIDITY_AMOUNT")) 149 | self.ray_liquidity_amount = float(os.getenv("RAY_LIQUIDITY_AMOUNT")) 150 | self.sol_liquidity_amount = float(os.getenv("SOL_LIQUIDITY_AMOUNT")) 151 | self.trump_liquidity_amount = float(os.getenv("TRUMP_LIQUIDITY_AMOUNT")) 152 | self.usdc_liquidity_amount = float(os.getenv("USDC_LIQUIDITY_AMOUNT")) 153 | self.usdt_liquidity_amount = float(os.getenv("USDT_LIQUIDITY_AMOUNT")) 154 | self.wif_liquidity_amount = float(os.getenv("WIF_LIQUIDITY_AMOUNT")) 155 | self.min_delay = int(os.getenv("MIN_DELAY")) 156 | self.max_delay = int(os.getenv("MAX_DELAY")) 157 | 158 | def clear_terminal(self): 159 | os.system('cls' if os.name == 'nt' else 'clear') 160 | 161 | def log(self, message): 162 | print( 163 | f"{Fore.CYAN + Style.BRIGHT}[ {datetime.now().astimezone(wib).strftime('%x %X %Z')} ]{Style.RESET_ALL}" 164 | f"{Fore.WHITE + Style.BRIGHT} | {Style.RESET_ALL}{message}", 165 | flush=True 166 | ) 167 | 168 | def welcome(self): 169 | print( 170 | f""" 171 | {Fore.GREEN + Style.BRIGHT}XOS Testnet {Fore.BLUE + Style.BRIGHT} Auto BOT 172 | """ 173 | f""" 174 | {Fore.GREEN + Style.BRIGHT}Rey? {Fore.YELLOW + Style.BRIGHT} 175 | """ 176 | ) 177 | 178 | def format_seconds(self, seconds): 179 | hours, remainder = divmod(seconds, 3600) 180 | minutes, seconds = divmod(remainder, 60) 181 | return f"{int(hours):02}:{int(minutes):02}:{int(seconds):02}" 182 | 183 | async def load_proxies(self, use_proxy_choice: bool): 184 | filename = "proxy.txt" 185 | try: 186 | if use_proxy_choice == 1: 187 | async with ClientSession(timeout=ClientTimeout(total=30)) as session: 188 | async with session.get("https://raw.githubusercontent.com/monosans/proxy-list/refs/heads/main/proxies/all.txt") as response: 189 | response.raise_for_status() 190 | content = await response.text() 191 | with open(filename, 'w') as f: 192 | f.write(content) 193 | self.proxies = [line.strip() for line in content.splitlines() if line.strip()] 194 | else: 195 | if not os.path.exists(filename): 196 | self.log(f"{Fore.RED + Style.BRIGHT}File {filename} Not Found.{Style.RESET_ALL}") 197 | return 198 | with open(filename, 'r') as f: 199 | self.proxies = [line.strip() for line in f.read().splitlines() if line.strip()] 200 | 201 | if not self.proxies: 202 | self.log(f"{Fore.RED + Style.BRIGHT}No Proxies Found.{Style.RESET_ALL}") 203 | return 204 | 205 | self.log( 206 | f"{Fore.GREEN + Style.BRIGHT}Proxies Total : {Style.RESET_ALL}" 207 | f"{Fore.WHITE + Style.BRIGHT}{len(self.proxies)}{Style.RESET_ALL}" 208 | ) 209 | 210 | except Exception as e: 211 | self.log(f"{Fore.RED + Style.BRIGHT}Failed To Load Proxies: {e}{Style.RESET_ALL}") 212 | self.proxies = [] 213 | 214 | def check_proxy_schemes(self, proxies): 215 | schemes = ["http://", "https://", "socks4://", "socks5://"] 216 | if any(proxies.startswith(scheme) for scheme in schemes): 217 | return proxies 218 | return f"http://{proxies}" 219 | 220 | def get_next_proxy_for_account(self, token): 221 | if token not in self.account_proxies: 222 | if not self.proxies: 223 | return None 224 | proxy = self.check_proxy_schemes(self.proxies[self.proxy_index]) 225 | self.account_proxies[token] = proxy 226 | self.proxy_index = (self.proxy_index + 1) % len(self.proxies) 227 | return self.account_proxies[token] 228 | 229 | def rotate_proxy_for_account(self, token): 230 | if not self.proxies: 231 | return None 232 | proxy = self.check_proxy_schemes(self.proxies[self.proxy_index]) 233 | self.account_proxies[token] = proxy 234 | self.proxy_index = (self.proxy_index + 1) % len(self.proxies) 235 | return proxy 236 | 237 | def build_proxy_config(self, proxy=None): 238 | if not proxy: 239 | return None, None, None 240 | 241 | if proxy.startswith("socks"): 242 | connector = ProxyConnector.from_url(proxy) 243 | return connector, None, None 244 | 245 | elif proxy.startswith("http"): 246 | match = re.match(r"http://(.*?):(.*?)@(.*)", proxy) 247 | if match: 248 | username, password, host_port = match.groups() 249 | clean_url = f"http://{host_port}" 250 | auth = BasicAuth(username, password) 251 | return None, clean_url, auth 252 | else: 253 | return None, proxy, None 254 | 255 | raise Exception("Unsupported Proxy Type.") 256 | 257 | def generate_address(self, account: str): 258 | try: 259 | account = Account.from_key(account) 260 | address = account.address 261 | 262 | return address 263 | except Exception as e: 264 | return None 265 | 266 | def generate_payload(self, account: str, address: str, message: str): 267 | try: 268 | encoded_message = encode_defunct(text=message) 269 | signed_message = Account.sign_message(encoded_message, private_key=account) 270 | signature = to_hex(signed_message.signature) 271 | 272 | payload = { 273 | "walletAddress":address, 274 | "signMessage":message, 275 | "signature":signature, 276 | "referrer":self.REF_CODE 277 | } 278 | 279 | return payload 280 | except Exception as e: 281 | raise Exception(f"Generate Req Payload Failed: {str(e)}") 282 | 283 | def mask_account(self, account): 284 | try: 285 | mask_account = account[:6] + '*' * 6 + account[-6:] 286 | return mask_account 287 | except Exception as e: 288 | return None 289 | 290 | def generate_swap_option(self): 291 | token_data = { 292 | "XOS": (self.WXOS_CONTRACT_ADDRESS, self.xos_swap_amount), 293 | "WXOS": (self.WXOS_CONTRACT_ADDRESS, self.wxos_swap_amount), 294 | "BNB": (self.BNB_CONTRACT_ADDRESS, self.bnb_swap_amount), 295 | "BONK": (self.BONK_CONTRACT_ADDRESS, self.bonk_swap_amount), 296 | "JUP": (self.JUP_CONTRACT_ADDRESS, self.jup_swap_amount), 297 | "PENGU": (self.PENGU_CONTRACT_ADDRESS, self.pengu_swap_amount), 298 | "RAY": (self.RAY_CONTRACT_ADDRESS, self.ray_swap_amount), 299 | "SOL": (self.SOL_CONTRACT_ADDRESS, self.sol_swap_amount), 300 | "TRUMP": (self.TRUMP_CONTRACT_ADDRESS, self.trump_swap_amount), 301 | "TST": (self.TST_CONTRACT_ADDRESS, self.tst_swap_amount), 302 | "USDC": (self.USDC_CONTRACT_ADDRESS, self.usdc_swap_amount), 303 | "USDT": (self.USDT_CONTRACT_ADDRESS, self.usdt_swap_amount), 304 | "WIF": (self.WIF_CONTRACT_ADDRESS, self.wif_swap_amount) 305 | } 306 | 307 | tickers = list(token_data.keys()) 308 | 309 | while True: 310 | from_ticker = random.choice(tickers) 311 | to_ticker = random.choice(tickers) 312 | 313 | if from_ticker == to_ticker: 314 | continue 315 | 316 | if (from_ticker == "XOS" and to_ticker == "WXOS") or (from_ticker == "WXOS" and to_ticker == "XOS"): 317 | continue 318 | 319 | if from_ticker == "XOS": 320 | swap_type = "native to erc20" 321 | elif to_ticker == "XOS": 322 | swap_type = "erc20 to native" 323 | else: 324 | swap_type = "erc20 to erc20" 325 | 326 | from_token, amount_in = token_data[from_ticker] 327 | to_token, _ = token_data[to_ticker] 328 | 329 | return swap_type, from_ticker, to_ticker, from_token, to_token, amount_in 330 | 331 | def generate_liquidity_option(self): 332 | self.WXOS_CONTRACT_ADDRESS = "0x0AAB67cf6F2e99847b9A95DeC950B250D648c1BB" 333 | self.BONK_CONTRACT_ADDRESS = "0x00309602f7977D45322279c4dD5cf61D16FD061B" 334 | self.PENGU_CONTRACT_ADDRESS = "0x9573577927d3AbECDa9C69F5E8C50bc88b1e26EE" 335 | self.TST_CONTRACT_ADDRESS = "0xD1194D2D06EDFBD815574383aeD6A9D76Cd568dA" 336 | self.USDC_CONTRACT_ADDRESS = "0xb2C1C007421f0Eb5f4B3b3F38723C309Bb208d7d" 337 | self.USDT_CONTRACT_ADDRESS = "0x2CCDB83a043A32898496c1030880Eb2cB977CAbc" 338 | self.WIF_CONTRACT_ADDRESS = "0x9c6eEc453821d12B8dfea20b6FbdDB47f7bc500d" 339 | self.JUP_CONTRACT_ADDRESS = "0x26b597804318824a2E88Cd717376f025E6bb2219" 340 | self.RAY_CONTRACT_ADDRESS = "0x4A79C7Fdb6d448b3f8F643010F4CdE8b2363EFD6" 341 | self.SOL_CONTRACT_ADDRESS = "0x0c8a3D1fE7E40a39D3331D5Fa4B9fee1EcA1926A" 342 | self.TRUMP_CONTRACT_ADDRESS = "0xC09a5026d9244d482Fb913609Aeb7347B7F12800" 343 | self.BNB_CONTRACT_ADDRESS = "0x83DFbE02dc1B1Db11bc13a8Fc7fd011E2dBbd7c0" 344 | 345 | swap_options = [ 346 | ("native", "XOS", "BONK", self.WXOS_CONTRACT_ADDRESS, self.BONK_CONTRACT_ADDRESS, self.xos_liquidity_amount), 347 | ("native", "XOS", "PENGU", self.WXOS_CONTRACT_ADDRESS, self.PENGU_CONTRACT_ADDRESS, self.xos_liquidity_amount), 348 | ("native", "XOS", "TST", self.WXOS_CONTRACT_ADDRESS, self.TST_CONTRACT_ADDRESS, self.xos_liquidity_amount), 349 | ("native", "XOS", "USDC", self.WXOS_CONTRACT_ADDRESS, self.USDC_CONTRACT_ADDRESS, self.xos_liquidity_amount), 350 | ("native", "XOS", "USDT", self.WXOS_CONTRACT_ADDRESS, self.USDT_CONTRACT_ADDRESS, self.xos_liquidity_amount), 351 | ("native", "XOS", "WIF", self.WXOS_CONTRACT_ADDRESS, self.WIF_CONTRACT_ADDRESS, self.xos_liquidity_amount), 352 | ("native", "XOS", "JUP", self.WXOS_CONTRACT_ADDRESS, self.JUP_CONTRACT_ADDRESS, self.xos_liquidity_amount), 353 | ("native", "XOS", "RAY", self.WXOS_CONTRACT_ADDRESS, self.RAY_CONTRACT_ADDRESS, self.xos_liquidity_amount), 354 | ("native", "XOS", "SOL", self.WXOS_CONTRACT_ADDRESS, self.SOL_CONTRACT_ADDRESS, self.xos_liquidity_amount), 355 | ("native", "XOS", "TRUMP", self.WXOS_CONTRACT_ADDRESS, self.TRUMP_CONTRACT_ADDRESS, self.xos_liquidity_amount), 356 | ("native", "XOS", "BNB", self.WXOS_CONTRACT_ADDRESS, self.BNB_CONTRACT_ADDRESS, self.xos_liquidity_amount), 357 | ("erc20", "WXOS", "PENGU", self.WXOS_CONTRACT_ADDRESS, self.PENGU_CONTRACT_ADDRESS, self.wxos_liquidity_amount), 358 | ("erc20", "WXOS", "TST", self.WXOS_CONTRACT_ADDRESS, self.TST_CONTRACT_ADDRESS, self.wxos_liquidity_amount), 359 | ("erc20", "WXOS", "USDC", self.WXOS_CONTRACT_ADDRESS, self.USDC_CONTRACT_ADDRESS, self.wxos_liquidity_amount), 360 | ("erc20", "WXOS", "USDT", self.WXOS_CONTRACT_ADDRESS, self.USDT_CONTRACT_ADDRESS, self.wxos_liquidity_amount), 361 | ("erc20", "WXOS", "WIF", self.WXOS_CONTRACT_ADDRESS, self.WIF_CONTRACT_ADDRESS, self.wxos_liquidity_amount), 362 | ("erc20", "WXOS", "JUP", self.WXOS_CONTRACT_ADDRESS, self.JUP_CONTRACT_ADDRESS, self.wxos_liquidity_amount), 363 | ("erc20", "WXOS", "RAY", self.WXOS_CONTRACT_ADDRESS, self.RAY_CONTRACT_ADDRESS, self.wxos_liquidity_amount), 364 | ("erc20", "WXOS", "SOL", self.WXOS_CONTRACT_ADDRESS, self.SOL_CONTRACT_ADDRESS, self.wxos_liquidity_amount), 365 | ("erc20", "WXOS", "TRUMP", self.WXOS_CONTRACT_ADDRESS, self.TRUMP_CONTRACT_ADDRESS, self.wxos_liquidity_amount), 366 | ("erc20", "WXOS", "BNB", self.WXOS_CONTRACT_ADDRESS, self.BNB_CONTRACT_ADDRESS, self.wxos_liquidity_amount), 367 | ("erc20", "BONK", "WXOS", self.BONK_CONTRACT_ADDRESS, self.WXOS_CONTRACT_ADDRESS, self.bonk_liquidity_amount), 368 | ("erc20", "BONK", "PENGU", self.BONK_CONTRACT_ADDRESS, self.PENGU_CONTRACT_ADDRESS, self.bonk_liquidity_amount), 369 | ("erc20", "BONK", "TST", self.BONK_CONTRACT_ADDRESS, self.TST_CONTRACT_ADDRESS, self.bonk_liquidity_amount), 370 | ("erc20", "BONK", "USDC", self.BONK_CONTRACT_ADDRESS, self.USDC_CONTRACT_ADDRESS, self.bonk_liquidity_amount), 371 | ("erc20", "BONK", "USDT", self.BONK_CONTRACT_ADDRESS, self.USDT_CONTRACT_ADDRESS, self.bonk_liquidity_amount), 372 | ("erc20", "BONK", "WIF", self.BONK_CONTRACT_ADDRESS, self.WIF_CONTRACT_ADDRESS, self.bonk_liquidity_amount), 373 | ("erc20", "BONK", "JUP", self.BONK_CONTRACT_ADDRESS, self.JUP_CONTRACT_ADDRESS, self.bonk_liquidity_amount), 374 | ("erc20", "BONK", "RAY", self.BONK_CONTRACT_ADDRESS, self.RAY_CONTRACT_ADDRESS, self.bonk_liquidity_amount), 375 | ("erc20", "BONK", "TRUMP", self.BONK_CONTRACT_ADDRESS, self.TRUMP_CONTRACT_ADDRESS, self.bonk_liquidity_amount), 376 | ("erc20", "BONK", "BNB", self.BONK_CONTRACT_ADDRESS, self.BNB_CONTRACT_ADDRESS, self.bonk_liquidity_amount), 377 | ("erc20", "PENGU", "TST", self.PENGU_CONTRACT_ADDRESS, self.TST_CONTRACT_ADDRESS, self.pengu_liquidity_amount), 378 | ("erc20", "PENGU", "USDC", self.PENGU_CONTRACT_ADDRESS, self.USDC_CONTRACT_ADDRESS, self.pengu_liquidity_amount), 379 | ("erc20", "PENGU", "WIF", self.PENGU_CONTRACT_ADDRESS, self.WIF_CONTRACT_ADDRESS, self.pengu_liquidity_amount), 380 | ("erc20", "PENGU", "TRUMP", self.PENGU_CONTRACT_ADDRESS, self.TRUMP_CONTRACT_ADDRESS, self.pengu_liquidity_amount), 381 | ("erc20", "USDC", "TST", self.USDC_CONTRACT_ADDRESS, self.TST_CONTRACT_ADDRESS, self.usdc_liquidity_amount), 382 | ("erc20", "USDC", "TRUMP", self.USDC_CONTRACT_ADDRESS, self.TRUMP_CONTRACT_ADDRESS, self.usdc_liquidity_amount), 383 | ("erc20", "USDT", "PENGU", self.USDT_CONTRACT_ADDRESS, self.PENGU_CONTRACT_ADDRESS, self.usdt_liquidity_amount), 384 | ("erc20", "USDT", "TST", self.USDT_CONTRACT_ADDRESS, self.TST_CONTRACT_ADDRESS, self.usdt_liquidity_amount), 385 | ("erc20", "USDT", "USDC", self.USDT_CONTRACT_ADDRESS, self.USDC_CONTRACT_ADDRESS, self.usdt_liquidity_amount), 386 | ("erc20", "USDT", "WIF", self.USDT_CONTRACT_ADDRESS, self.WIF_CONTRACT_ADDRESS, self.usdt_liquidity_amount), 387 | ("erc20", "USDT", "TRUMP", self.USDT_CONTRACT_ADDRESS, self.TRUMP_CONTRACT_ADDRESS, self.usdt_liquidity_amount), 388 | ("erc20", "USDT", "BNB", self.USDT_CONTRACT_ADDRESS, self.BNB_CONTRACT_ADDRESS, self.usdt_liquidity_amount), 389 | ("erc20", "WIF", "TST", self.WIF_CONTRACT_ADDRESS, self.TST_CONTRACT_ADDRESS, self.wif_liquidity_amount), 390 | ("erc20", "WIF", "USDC", self.WIF_CONTRACT_ADDRESS, self.USDC_CONTRACT_ADDRESS, self.wif_liquidity_amount), 391 | ("erc20", "WIF", "TRUMP", self.WIF_CONTRACT_ADDRESS, self.TRUMP_CONTRACT_ADDRESS, self.wif_liquidity_amount), 392 | ("erc20", "JUP", "PENGU", self.JUP_CONTRACT_ADDRESS, self.PENGU_CONTRACT_ADDRESS, self.jup_liquidity_amount), 393 | ("erc20", "JUP", "USDC", self.JUP_CONTRACT_ADDRESS, self.USDC_CONTRACT_ADDRESS, self.jup_liquidity_amount), 394 | ("erc20", "JUP", "USDT", self.JUP_CONTRACT_ADDRESS, self.USDT_CONTRACT_ADDRESS, self.jup_liquidity_amount), 395 | ("erc20", "JUP", "WIF", self.JUP_CONTRACT_ADDRESS, self.WIF_CONTRACT_ADDRESS, self.jup_liquidity_amount), 396 | ("erc20", "JUP", "RAY", self.JUP_CONTRACT_ADDRESS, self.RAY_CONTRACT_ADDRESS, self.jup_liquidity_amount), 397 | ("erc20", "RAY", "PENGU", self.RAY_CONTRACT_ADDRESS, self.PENGU_CONTRACT_ADDRESS, self.ray_liquidity_amount), 398 | ("erc20", "RAY", "TST", self.RAY_CONTRACT_ADDRESS, self.TST_CONTRACT_ADDRESS, self.ray_liquidity_amount), 399 | ("erc20", "RAY", "USDC", self.RAY_CONTRACT_ADDRESS, self.USDC_CONTRACT_ADDRESS, self.ray_liquidity_amount), 400 | ("erc20", "RAY", "BNB", self.RAY_CONTRACT_ADDRESS, self.BNB_CONTRACT_ADDRESS, self.ray_liquidity_amount), 401 | ("erc20", "TRUMP", "TST", self.TRUMP_CONTRACT_ADDRESS, self.TST_CONTRACT_ADDRESS, self.trump_liquidity_amount), 402 | ("erc20", "SOL", "PENGU", self.SOL_CONTRACT_ADDRESS, self.PENGU_CONTRACT_ADDRESS, self.sol_liquidity_amount), 403 | ("erc20", "SOL", "USDC", self.SOL_CONTRACT_ADDRESS, self.USDC_CONTRACT_ADDRESS, self.sol_liquidity_amount), 404 | ("erc20", "SOL", "USDT", self.SOL_CONTRACT_ADDRESS, self.USDT_CONTRACT_ADDRESS, self.sol_liquidity_amount), 405 | ("erc20", "SOL", "WIF", self.SOL_CONTRACT_ADDRESS, self.WIF_CONTRACT_ADDRESS, self.sol_liquidity_amount), 406 | ("erc20", "SOL", "JUP", self.SOL_CONTRACT_ADDRESS, self.JUP_CONTRACT_ADDRESS, self.sol_liquidity_amount), 407 | ("erc20", "SOL", "RAY", self.SOL_CONTRACT_ADDRESS, self.RAY_CONTRACT_ADDRESS, self.sol_liquidity_amount), 408 | ("erc20", "SOL", "TRUMP", self.SOL_CONTRACT_ADDRESS, self.TRUMP_CONTRACT_ADDRESS, self.sol_liquidity_amount), 409 | ("erc20", "SOL", "BNB", self.SOL_CONTRACT_ADDRESS, self.BNB_CONTRACT_ADDRESS, self.sol_liquidity_amount), 410 | ("erc20", "BNB", "PENGU", self.BNB_CONTRACT_ADDRESS, self.PENGU_CONTRACT_ADDRESS, self.bnb_liquidity_amount), 411 | ("erc20", "BNB", "TST", self.BNB_CONTRACT_ADDRESS, self.TST_CONTRACT_ADDRESS, self.bnb_liquidity_amount), 412 | ("erc20", "BNB", "USDC", self.BNB_CONTRACT_ADDRESS, self.USDC_CONTRACT_ADDRESS, self.bnb_liquidity_amount), 413 | ("erc20", "BNB", "WIF", self.BNB_CONTRACT_ADDRESS, self.WIF_CONTRACT_ADDRESS, self.bnb_liquidity_amount) 414 | 415 | ] 416 | 417 | token_type, ticker0, ticker1, token0, token1, amount0 = random.choice(swap_options) 418 | 419 | liquidity_option = f"{ticker0}/{ticker1}" 420 | 421 | amount0_desired = int(amount0 * (10 ** 18)) 422 | 423 | return liquidity_option, token_type, ticker0, ticker1, token0, token1, amount0_desired 424 | 425 | async def get_web3_with_check(self, address: str, use_proxy: bool, retries=3, timeout=60): 426 | request_kwargs = {"timeout": timeout} 427 | 428 | proxy = self.get_next_proxy_for_account(address) if use_proxy else None 429 | 430 | if use_proxy and proxy: 431 | request_kwargs["proxies"] = {"http": proxy, "https": proxy} 432 | 433 | for attempt in range(retries): 434 | try: 435 | web3 = Web3(Web3.HTTPProvider(self.RPC_URL, request_kwargs=request_kwargs)) 436 | web3.eth.get_block_number() 437 | return web3 438 | except Exception as e: 439 | if attempt < retries - 1: 440 | await asyncio.sleep(3) 441 | continue 442 | raise Exception(f"Failed to Connect to RPC: {str(e)}") 443 | 444 | async def send_raw_transaction_with_retries(self, account, web3, tx, retries=5): 445 | for attempt in range(retries): 446 | try: 447 | signed_tx = web3.eth.account.sign_transaction(tx, account) 448 | raw_tx = web3.eth.send_raw_transaction(signed_tx.raw_transaction) 449 | tx_hash = web3.to_hex(raw_tx) 450 | return tx_hash 451 | except TransactionNotFound: 452 | pass 453 | except Exception as e: 454 | self.log( 455 | f"{Fore.CYAN + Style.BRIGHT} Message :{Style.RESET_ALL}" 456 | f"{Fore.YELLOW + Style.BRIGHT} [Attempt {attempt + 1}] Send TX Error: {str(e)} {Style.RESET_ALL}" 457 | ) 458 | await asyncio.sleep(2 ** attempt) 459 | raise Exception("Transaction Hash Not Found After Maximum Retries") 460 | 461 | async def wait_for_receipt_with_retries(self, web3, tx_hash, retries=5): 462 | for attempt in range(retries): 463 | try: 464 | receipt = await asyncio.to_thread(web3.eth.wait_for_transaction_receipt, tx_hash, timeout=300) 465 | return receipt 466 | except TransactionNotFound: 467 | pass 468 | except Exception as e: 469 | self.log( 470 | f"{Fore.CYAN + Style.BRIGHT} Message :{Style.RESET_ALL}" 471 | f"{Fore.YELLOW + Style.BRIGHT} [Attempt {attempt + 1}] Wait for Receipt Error: {str(e)} {Style.RESET_ALL}" 472 | ) 473 | await asyncio.sleep(2 ** attempt) 474 | raise Exception("Transaction Receipt Not Found After Maximum Retries") 475 | 476 | async def get_token_balance(self, address: str, contract_address: str, use_proxy: bool, retries=5): 477 | for attempt in range(retries): 478 | try: 479 | web3 = await self.get_web3_with_check(address, use_proxy) 480 | 481 | if contract_address == "XOS": 482 | balance = web3.eth.get_balance(address) 483 | decimals = 18 484 | else: 485 | token_contract = web3.eth.contract(address=web3.to_checksum_address(contract_address), abi=self.ERC20_CONTRACT_ABI) 486 | balance = token_contract.functions.balanceOf(address).call() 487 | decimals = token_contract.functions.decimals().call() 488 | 489 | token_balance = balance / (10 ** decimals) 490 | 491 | return token_balance 492 | except Exception as e: 493 | if attempt < retries - 1: 494 | await asyncio.sleep(3) 495 | continue 496 | self.log( 497 | f"{Fore.CYAN+Style.BRIGHT} Message :{Style.RESET_ALL}" 498 | f"{Fore.RED+Style.BRIGHT} {str(e)} {Style.RESET_ALL}" 499 | ) 500 | return None 501 | 502 | async def get_amount_out_min(self, address: str, path: str, amount_in_wei: int, use_proxy: bool): 503 | try: 504 | web3 = await self.get_web3_with_check(address, use_proxy) 505 | 506 | contract = web3.eth.contract(address=web3.to_checksum_address(self.QUOTER_ROUTER_ADDRESS), abi=self.QUOTER_CONTRACT_ABI) 507 | 508 | amount_out = contract.functions.quoteExactInput(path, amount_in_wei).call() 509 | 510 | return amount_out 511 | except Exception as e: 512 | return None 513 | 514 | async def perform_wrap(self, account: str, address: str, use_proxy: bool): 515 | try: 516 | web3 = await self.get_web3_with_check(address, use_proxy) 517 | 518 | contract_address = web3.to_checksum_address(self.WXOS_CONTRACT_ADDRESS) 519 | token_contract = web3.eth.contract(address=contract_address, abi=self.ERC20_CONTRACT_ABI) 520 | 521 | amount_to_wei = web3.to_wei(self.wrap_amount, "ether") 522 | wrap_data = token_contract.functions.deposit() 523 | estimated_gas = wrap_data.estimate_gas({"from": address, "value": amount_to_wei}) 524 | 525 | max_priority_fee = web3.to_wei(11.25, "gwei") 526 | max_fee = max_priority_fee 527 | 528 | wrap_tx = wrap_data.build_transaction({ 529 | "from": address, 530 | "value": amount_to_wei, 531 | "gas": int(estimated_gas * 1.2), 532 | "maxFeePerGas": int(max_fee), 533 | "maxPriorityFeePerGas": int(max_priority_fee), 534 | "nonce": self.used_nonce[address], 535 | "chainId": web3.eth.chain_id, 536 | }) 537 | 538 | tx_hash = await self.send_raw_transaction_with_retries(account, web3, wrap_tx) 539 | receipt = await self.wait_for_receipt_with_retries(web3, tx_hash) 540 | block_number = receipt.blockNumber 541 | self.used_nonce[address] += 1 542 | 543 | return tx_hash, block_number 544 | except Exception as e: 545 | self.log( 546 | f"{Fore.CYAN+Style.BRIGHT} Message :{Style.RESET_ALL}" 547 | f"{Fore.RED+Style.BRIGHT} {str(e)} {Style.RESET_ALL}" 548 | ) 549 | return None, None 550 | 551 | async def perform_unwrap(self, account: str, address: str, use_proxy: bool): 552 | try: 553 | web3 = await self.get_web3_with_check(address, use_proxy) 554 | 555 | contract_address = web3.to_checksum_address(self.WXOS_CONTRACT_ADDRESS) 556 | token_contract = web3.eth.contract(address=contract_address, abi=self.ERC20_CONTRACT_ABI) 557 | 558 | amount_to_wei = web3.to_wei(self.wrap_amount, "ether") 559 | unwrap_data = token_contract.functions.withdraw(amount_to_wei) 560 | estimated_gas = unwrap_data.estimate_gas({"from": address}) 561 | 562 | max_priority_fee = web3.to_wei(11.25, "gwei") 563 | max_fee = max_priority_fee 564 | 565 | unwrap_tx = unwrap_data.build_transaction({ 566 | "from": address, 567 | "gas": int(estimated_gas * 1.2), 568 | "maxFeePerGas": int(max_fee), 569 | "maxPriorityFeePerGas": int(max_priority_fee), 570 | "nonce": self.used_nonce[address], 571 | "chainId": web3.eth.chain_id, 572 | }) 573 | 574 | tx_hash = await self.send_raw_transaction_with_retries(account, web3, unwrap_tx) 575 | receipt = await self.wait_for_receipt_with_retries(web3, tx_hash) 576 | block_number = receipt.blockNumber 577 | self.used_nonce[address] += 1 578 | 579 | return tx_hash, block_number 580 | except Exception as e: 581 | self.log( 582 | f"{Fore.CYAN+Style.BRIGHT} Message :{Style.RESET_ALL}" 583 | f"{Fore.RED+Style.BRIGHT} {str(e)} {Style.RESET_ALL}" 584 | ) 585 | return None, None 586 | 587 | async def approving_token(self, account: str, address: str, spender_address: str, contract_address: str, amount: float, use_proxy: bool): 588 | try: 589 | web3 = await self.get_web3_with_check(address, use_proxy) 590 | 591 | spender = web3.to_checksum_address(spender_address) 592 | token_contract = web3.eth.contract(address=web3.to_checksum_address(contract_address), abi=self.ERC20_CONTRACT_ABI) 593 | 594 | amount_to_wei = web3.to_wei(amount, "ether") 595 | 596 | allowance = token_contract.functions.allowance(address, spender).call() 597 | if allowance < amount_to_wei: 598 | approve_data = token_contract.functions.approve(spender, 2**256 - 1) 599 | estimated_gas = approve_data.estimate_gas({"from": address}) 600 | 601 | max_priority_fee = web3.to_wei(11.25, "gwei") 602 | max_fee = max_priority_fee 603 | 604 | approve_tx = approve_data.build_transaction({ 605 | "from": address, 606 | "gas": int(estimated_gas * 1.2), 607 | "maxFeePerGas": int(max_fee), 608 | "maxPriorityFeePerGas": int(max_priority_fee), 609 | "nonce": self.used_nonce[address], 610 | "chainId": web3.eth.chain_id, 611 | }) 612 | 613 | tx_hash = await self.send_raw_transaction_with_retries(account, web3, approve_tx) 614 | receipt = await self.wait_for_receipt_with_retries(web3, tx_hash) 615 | block_number = receipt.blockNumber 616 | self.used_nonce[address] += 1 617 | 618 | explorer = f"https://testnet.xoscan.io/tx/{tx_hash}" 619 | 620 | self.log( 621 | f"{Fore.CYAN+Style.BRIGHT} Approve :{Style.RESET_ALL}" 622 | f"{Fore.GREEN+Style.BRIGHT} Success {Style.RESET_ALL}" 623 | ) 624 | self.log( 625 | f"{Fore.CYAN+Style.BRIGHT} Block :{Style.RESET_ALL}" 626 | f"{Fore.WHITE+Style.BRIGHT} {block_number} {Style.RESET_ALL}" 627 | ) 628 | self.log( 629 | f"{Fore.CYAN+Style.BRIGHT} Tx Hash :{Style.RESET_ALL}" 630 | f"{Fore.WHITE+Style.BRIGHT} {tx_hash} {Style.RESET_ALL}" 631 | ) 632 | self.log( 633 | f"{Fore.CYAN+Style.BRIGHT} Explorer :{Style.RESET_ALL}" 634 | f"{Fore.WHITE+Style.BRIGHT} {explorer} {Style.RESET_ALL}" 635 | ) 636 | await self.print_timer() 637 | 638 | return True 639 | except Exception as e: 640 | raise Exception(f"Approving Token Contract Failed: {str(e)}") 641 | 642 | def generate_multicall_bytes_data(self, address: str, swap_type: str, fee: int, from_token: str, to_token: str, amount_in_wei: int, amount_out_min_wei: int): 643 | try: 644 | if swap_type in ["native to erc20", "erc20 to erc20"]: 645 | exact_input_single_prefix = bytes.fromhex('04e45aaf') 646 | exact_input_single_bytes = encode( 647 | ['address', 'address', 'uint24', 'address', 'uint256', 'uint256', 'uint160'], 648 | [ 649 | from_token, 650 | to_token, 651 | fee, 652 | address, 653 | amount_in_wei, 654 | amount_out_min_wei, 655 | 0 656 | ] 657 | ) 658 | 659 | data_bytes = [exact_input_single_prefix + exact_input_single_bytes] 660 | 661 | elif swap_type == "erc20 to native": 662 | exact_input_single_prefix = bytes.fromhex('04e45aaf') 663 | exact_input_single_bytes = encode( 664 | ['address', 'address', 'uint24', 'address', 'uint256', 'uint256', 'uint160'], 665 | [ 666 | from_token, 667 | to_token, 668 | fee, 669 | "0x0000000000000000000000000000000000000002", 670 | amount_in_wei, 671 | amount_out_min_wei, 672 | 0 673 | ] 674 | ) 675 | 676 | unwrap_weth_9_prefix = bytes.fromhex('49404b7c') 677 | unwrap_weth_9_bytes = encode( 678 | ['uint256', 'address'], 679 | [ 680 | amount_out_min_wei, 681 | address 682 | ] 683 | ) 684 | 685 | data_bytes = [exact_input_single_prefix + exact_input_single_bytes, unwrap_weth_9_prefix + unwrap_weth_9_bytes ] 686 | 687 | return data_bytes 688 | except Exception as e: 689 | raise Exception(f"Generate Multicall Bytes Data Failed: {str(e)}") 690 | 691 | async def perform_swap(self, account: str, address: str, swap_type: str, from_token: str, to_token: str, amount_in: float, use_proxy: bool): 692 | try: 693 | web3 = await self.get_web3_with_check(address, use_proxy) 694 | 695 | amount_in_wei = web3.to_wei(amount_in, "ether") 696 | 697 | fee = 100 if swap_type == "erc20 to native" else 500 698 | 699 | if swap_type != "native to erc20": 700 | await self.approving_token(account, address, self.SWAP_ROUTER_ADDRESS, from_token, amount_in_wei, use_proxy) 701 | 702 | path = bytes.fromhex(from_token[2:]) + (fee).to_bytes(3, "big") + bytes.fromhex(to_token[2:]) 703 | 704 | amount_out_wei = await self.get_amount_out_min(address, path, amount_in_wei, use_proxy) 705 | if not amount_out_wei: 706 | raise Exception("Fetch Amount Out Min Failed") 707 | 708 | amount_out_min_wei = (amount_out_wei * (10000 - 50)) // 10000 709 | 710 | deadline = int(time.time()) + 600 711 | 712 | data_bytes = self.generate_multicall_bytes_data(address, swap_type, fee, from_token, to_token, amount_in_wei, amount_out_min_wei) 713 | 714 | max_priority_fee = web3.to_wei(11.25, "gwei") 715 | max_fee = max_priority_fee 716 | 717 | if swap_type == "native to erc20": 718 | token_contract = web3.eth.contract(address=web3.to_checksum_address(self.SWAP_ROUTER_ADDRESS), abi=self.SWAP_CONTRACT_ABI) 719 | swap_data = token_contract.functions.multicall(deadline, data_bytes) 720 | estimated_gas = swap_data.estimate_gas({"from": address, "value":amount_in_wei}) 721 | swap_tx = swap_data.build_transaction({ 722 | "from": address, 723 | "value": amount_in_wei, 724 | "gas": int(estimated_gas * 1.2), 725 | "maxFeePerGas": int(max_fee), 726 | "maxPriorityFeePerGas": int(max_priority_fee), 727 | "nonce": self.used_nonce[address], 728 | "chainId": web3.eth.chain_id 729 | }) 730 | 731 | else: 732 | token_contract = web3.eth.contract(address=web3.to_checksum_address(self.SWAP_ROUTER_ADDRESS), abi=self.ERC20_CONTRACT_ABI) 733 | swap_data = token_contract.functions.multicall(deadline, data_bytes) 734 | estimated_gas = swap_data.estimate_gas({"from": address}) 735 | swap_tx = swap_data.build_transaction({ 736 | "from": address, 737 | "gas": int(estimated_gas * 1.2), 738 | "maxFeePerGas": int(max_fee), 739 | "maxPriorityFeePerGas": int(max_priority_fee), 740 | "nonce": self.used_nonce[address], 741 | "chainId": web3.eth.chain_id 742 | }) 743 | 744 | tx_hash = await self.send_raw_transaction_with_retries(account, web3, swap_tx) 745 | receipt = await self.wait_for_receipt_with_retries(web3, tx_hash) 746 | block_number = receipt.blockNumber 747 | self.used_nonce[address] += 1 748 | 749 | return tx_hash, block_number 750 | except Exception as e: 751 | self.log( 752 | f"{Fore.CYAN+Style.BRIGHT} Message :{Style.RESET_ALL}" 753 | f"{Fore.RED+Style.BRIGHT} {str(e)} {Style.RESET_ALL}" 754 | ) 755 | return None, None 756 | 757 | def generate_liquidity_calldata(self, address: str, token_type: str, token0: str, token1: str, amount0_desired: int, amount1_desired: int): 758 | try: 759 | amount0_min = (amount0_desired * (10000 - 100)) // 10000 760 | amount1_min = (amount1_desired * (10000 - 100)) // 10000 761 | deadline = int(time.time()) + 600 762 | 763 | if token_type == "native": 764 | mint_prefix = bytes.fromhex("88316456") 765 | mint_params = encode( 766 | [ 767 | 'address', 'address', 'uint24', 'int24', 'int24', 'uint256', 768 | 'uint256', 'uint256', 'uint256', 'address', 'uint256' 769 | ], 770 | [ 771 | token0, token1, 500, -887220, 887220, amount0_desired, 772 | amount1_desired, amount0_min, amount1_min, address, deadline 773 | ] 774 | ) 775 | refund_eth_prefix = bytes.fromhex("12210e8a") 776 | 777 | calldata = [mint_prefix + mint_params, refund_eth_prefix] 778 | 779 | elif token_type == "erc20": 780 | calldata = ( 781 | token0, token1, 500, -887220, 887220, amount0_desired, 782 | amount1_desired, amount0_min, amount1_min, address, deadline 783 | ) 784 | 785 | return calldata 786 | except Exception as e: 787 | raise Exception(f"Generate Liquidity Calldata Failed: {str(e)}") 788 | 789 | async def perform_liquidity(self, account: str, address: str, token_type: str, token0: str, token1: str, amount0_desired: int, amount1_desired: int, use_proxy: bool): 790 | try: 791 | web3 = await self.get_web3_with_check(address, use_proxy) 792 | 793 | if token_type == "erc20": 794 | await self.approving_token(account, address, self.POOL_ROUTER_ADDRESS, token0, amount0_desired, use_proxy) 795 | 796 | await self.approving_token(account, address, self.POOL_ROUTER_ADDRESS, token1, amount1_desired, use_proxy) 797 | 798 | token_contract = web3.eth.contract(address=web3.to_checksum_address(self.POOL_ROUTER_ADDRESS), abi=self.LIQUIDITY_CONTRACT_ABI) 799 | 800 | calldata = self.generate_liquidity_calldata(address, token_type, token0, token1, amount0_desired, amount1_desired) 801 | 802 | max_priority_fee = web3.to_wei(11.25, "gwei") 803 | max_fee = max_priority_fee 804 | 805 | if token_type == "native": 806 | liquidity_data = token_contract.functions.multicall(calldata) 807 | estimated_gas = liquidity_data.estimate_gas({"from": address, "value":amount1_desired}) 808 | liquidity_tx = liquidity_data.build_transaction({ 809 | "from": address, 810 | "value": amount1_desired, 811 | "gas": int(estimated_gas * 1.2), 812 | "maxFeePerGas": int(max_fee), 813 | "maxPriorityFeePerGas": int(max_priority_fee), 814 | "nonce": self.used_nonce[address], 815 | "chainId": web3.eth.chain_id 816 | }) 817 | 818 | elif token_type == "erc20": 819 | liquidity_data = token_contract.functions.mint(calldata) 820 | estimated_gas = liquidity_data.estimate_gas({"from": address}) 821 | liquidity_tx = liquidity_data.build_transaction({ 822 | "from": address, 823 | "gas": int(estimated_gas * 1.2), 824 | "maxFeePerGas": int(max_fee), 825 | "maxPriorityFeePerGas": int(max_priority_fee), 826 | "nonce": self.used_nonce[address], 827 | "chainId": web3.eth.chain_id 828 | }) 829 | 830 | tx_hash = await self.send_raw_transaction_with_retries(account, web3, liquidity_tx) 831 | receipt = await self.wait_for_receipt_with_retries(web3, tx_hash) 832 | block_number = receipt.blockNumber 833 | self.used_nonce[address] += 1 834 | 835 | return tx_hash, block_number 836 | except Exception as e: 837 | self.log( 838 | f"{Fore.CYAN+Style.BRIGHT} Message :{Style.RESET_ALL}" 839 | f"{Fore.RED+Style.BRIGHT} {str(e)} {Style.RESET_ALL}" 840 | ) 841 | return None, None 842 | 843 | async def print_timer(self): 844 | for remaining in range(random.randint(self.min_delay, self.max_delay), 0, -1): 845 | print( 846 | f"{Fore.CYAN + Style.BRIGHT}[ {datetime.now().astimezone(wib).strftime('%x %X %Z')} ]{Style.RESET_ALL}" 847 | f"{Fore.WHITE + Style.BRIGHT} | {Style.RESET_ALL}" 848 | f"{Fore.BLUE + Style.BRIGHT}Wait For{Style.RESET_ALL}" 849 | f"{Fore.WHITE + Style.BRIGHT} {remaining} {Style.RESET_ALL}" 850 | f"{Fore.BLUE + Style.BRIGHT}Seconds For Next Tx...{Style.RESET_ALL}", 851 | end="\r", 852 | flush=True 853 | ) 854 | await asyncio.sleep(1) 855 | 856 | def print_wrap_option_question(self): 857 | while True: 858 | try: 859 | print(f"{Fore.GREEN + Style.BRIGHT}Select Option:{Style.RESET_ALL}") 860 | print(f"{Fore.WHITE + Style.BRIGHT}1. Wrap XOS to WXOS{Style.RESET_ALL}") 861 | print(f"{Fore.WHITE + Style.BRIGHT}2. Unwrap WXOS to XOS{Style.RESET_ALL}") 862 | print(f"{Fore.WHITE + Style.BRIGHT}3. Skipped{Style.RESET_ALL}") 863 | wrap_option = int(input(f"{Fore.BLUE + Style.BRIGHT}Choose [1/2/3] -> {Style.RESET_ALL}").strip()) 864 | 865 | if wrap_option in [1, 2, 3]: 866 | wrap_type = ( 867 | "Wrap XOS to WXOS" if wrap_option == 1 else 868 | "Unwrap WXOS to XOS" if wrap_option == 2 else 869 | "Skipped" 870 | ) 871 | print(f"{Fore.GREEN + Style.BRIGHT}{wrap_type} Selected.{Style.RESET_ALL}") 872 | self.wrap_option = wrap_option 873 | break 874 | else: 875 | print(f"{Fore.RED + Style.BRIGHT}Please enter either 1, 2 or 3.{Style.RESET_ALL}") 876 | except ValueError: 877 | print(f"{Fore.RED + Style.BRIGHT}Invalid input. Enter a number (1, 2 or 3).{Style.RESET_ALL}") 878 | 879 | def print_question(self): 880 | while True: 881 | try: 882 | print(f"{Fore.GREEN + Style.BRIGHT}Select Option:{Style.RESET_ALL}") 883 | print(f"{Fore.WHITE + Style.BRIGHT}1. Check-In - Draw{Style.RESET_ALL}") 884 | print(f"{Fore.WHITE + Style.BRIGHT}2. Wrap XOS to WXOS{Style.RESET_ALL}") 885 | print(f"{Fore.WHITE + Style.BRIGHT}3. Unwrap WXOS to XOS{Style.RESET_ALL}") 886 | print(f"{Fore.WHITE + Style.BRIGHT}4. Random Swap{Style.RESET_ALL}") 887 | print(f"{Fore.WHITE + Style.BRIGHT}5. Add Liquidity{Style.RESET_ALL}") 888 | print(f"{Fore.WHITE + Style.BRIGHT}6. Run All Features{Style.RESET_ALL}") 889 | option = int(input(f"{Fore.BLUE + Style.BRIGHT}Choose [1/2/3/4/5] -> {Style.RESET_ALL}").strip()) 890 | 891 | if option in [1, 2, 3, 4, 5, 6]: 892 | option_type = ( 893 | "Check-In - Draw" if option == 1 else 894 | "Wrap XOS to WXOS" if option == 2 else 895 | "Unwrap WXOS to XOS" if option == 3 else 896 | "Random Swap" if option == 4 else 897 | "Add Liquidity" if option == 5 else 898 | "Run All Features" 899 | ) 900 | print(f"{Fore.GREEN + Style.BRIGHT}{option_type} Selected.{Style.RESET_ALL}") 901 | if option == 6: 902 | self.print_wrap_option_question() 903 | break 904 | else: 905 | print(f"{Fore.RED + Style.BRIGHT}Please enter either 1, 2, 3, 4, 5 or 6.{Style.RESET_ALL}") 906 | except ValueError: 907 | print(f"{Fore.RED + Style.BRIGHT}Invalid input. Enter a number (1, 2, 3, 4, 5 or 6).{Style.RESET_ALL}") 908 | 909 | while True: 910 | try: 911 | print(f"{Fore.WHITE + Style.BRIGHT}1. Run With Free Proxyscrape Proxy{Style.RESET_ALL}") 912 | print(f"{Fore.WHITE + Style.BRIGHT}2. Run With Private Proxy{Style.RESET_ALL}") 913 | print(f"{Fore.WHITE + Style.BRIGHT}3. Run Without Proxy{Style.RESET_ALL}") 914 | choose = int(input(f"{Fore.BLUE + Style.BRIGHT}Choose [1/2/3] -> {Style.RESET_ALL}").strip()) 915 | 916 | if choose in [1, 2, 3]: 917 | proxy_type = ( 918 | "With Free Proxyscrape" if choose == 1 else 919 | "With Private" if choose == 2 else 920 | "Without" 921 | ) 922 | print(f"{Fore.GREEN + Style.BRIGHT}Run {proxy_type} Proxy Selected.{Style.RESET_ALL}") 923 | break 924 | else: 925 | print(f"{Fore.RED + Style.BRIGHT}Please enter either 1, 2 or 3.{Style.RESET_ALL}") 926 | except ValueError: 927 | print(f"{Fore.RED + Style.BRIGHT}Invalid input. Enter a number (1, 2 or 3).{Style.RESET_ALL}") 928 | 929 | rotate = False 930 | if choose in [1, 2]: 931 | while True: 932 | rotate = input(f"{Fore.BLUE + Style.BRIGHT}Rotate Invalid Proxy? [y/n] -> {Style.RESET_ALL}").strip() 933 | 934 | if rotate in ["y", "n"]: 935 | rotate = rotate == "y" 936 | break 937 | else: 938 | print(f"{Fore.RED + Style.BRIGHT}Invalid input. Enter 'y' or 'n'.{Style.RESET_ALL}") 939 | 940 | return option, choose, rotate 941 | 942 | async def check_connection(self, proxy_url=None): 943 | connector, proxy, proxy_auth = self.build_proxy_config(proxy_url) 944 | try: 945 | async with ClientSession(connector=connector, timeout=ClientTimeout(total=10)) as session: 946 | async with session.get(url="https://api.ipify.org?format=json", proxy=proxy, proxy_auth=proxy_auth) as response: 947 | response.raise_for_status() 948 | return True 949 | except (Exception, ClientResponseError) as e: 950 | self.log( 951 | f"{Fore.CYAN+Style.BRIGHT}Status :{Style.RESET_ALL}" 952 | f"{Fore.RED+Style.BRIGHT} Connection Not 200 OK {Style.RESET_ALL}" 953 | f"{Fore.MAGENTA+Style.BRIGHT}-{Style.RESET_ALL}" 954 | f"{Fore.YELLOW+Style.BRIGHT} {str(e)} {Style.RESET_ALL}" 955 | ) 956 | return None 957 | 958 | async def get_message(self, address: str, proxy_url=None, retries=5): 959 | url = f"{self.BASE_API}/get-sign-message2?walletAddress={address}" 960 | for attempt in range(retries): 961 | connector, proxy, proxy_auth = self.build_proxy_config(proxy_url) 962 | try: 963 | async with ClientSession(connector=connector, timeout=ClientTimeout(total=60)) as session: 964 | async with session.get(url=url, headers=self.HEADERS[address], proxy=proxy, proxy_auth=proxy_auth) as response: 965 | response.raise_for_status() 966 | return await response.json() 967 | except (Exception, ClientResponseError) as e: 968 | if attempt < retries - 1: 969 | await asyncio.sleep(5) 970 | continue 971 | self.log( 972 | f"{Fore.CYAN + Style.BRIGHT}Status :{Style.RESET_ALL}" 973 | f"{Fore.RED + Style.BRIGHT} GET Nonce Failed {Style.RESET_ALL}" 974 | f"{Fore.MAGENTA + Style.BRIGHT}-{Style.RESET_ALL}" 975 | f"{Fore.YELLOW + Style.BRIGHT} {str(e)} {Style.RESET_ALL}" 976 | ) 977 | 978 | return None 979 | 980 | async def verify_signature(self, account: str, address: str, message: str, proxy_url=None, retries=5): 981 | url = f"{self.BASE_API}/verify-signature2" 982 | data = json.dumps(self.generate_payload(account, address, message)) 983 | headers = { 984 | **self.HEADERS[address], 985 | "Content-Length": str(len(data)), 986 | "Content-Type": "application/json" 987 | } 988 | for attempt in range(retries): 989 | connector, proxy, proxy_auth = self.build_proxy_config(proxy_url) 990 | try: 991 | async with ClientSession(connector=connector, timeout=ClientTimeout(total=60)) as session: 992 | async with session.post(url=url, headers=headers, data=data, proxy=proxy, proxy_auth=proxy_auth) as response: 993 | response.raise_for_status() 994 | return await response.json() 995 | except (Exception, ClientResponseError) as e: 996 | if attempt < retries - 1: 997 | await asyncio.sleep(5) 998 | continue 999 | self.log( 1000 | f"{Fore.CYAN + Style.BRIGHT}Status :{Style.RESET_ALL}" 1001 | f"{Fore.RED + Style.BRIGHT} Login Failed {Style.RESET_ALL}" 1002 | f"{Fore.MAGENTA + Style.BRIGHT}-{Style.RESET_ALL}" 1003 | f"{Fore.YELLOW + Style.BRIGHT} {str(e)} {Style.RESET_ALL}" 1004 | ) 1005 | 1006 | return None 1007 | 1008 | async def user_data(self, address: str, proxy_url=None, retries=5): 1009 | url = f"{self.BASE_API}/me" 1010 | headers = { 1011 | **self.HEADERS[address], 1012 | "Authorization": f"Bearer {self.access_tokens[address]}" 1013 | } 1014 | for attempt in range(retries): 1015 | connector, proxy, proxy_auth = self.build_proxy_config(proxy_url) 1016 | try: 1017 | async with ClientSession(connector=connector, timeout=ClientTimeout(total=60)) as session: 1018 | async with session.get(url=url, headers=headers, proxy=proxy, proxy_auth=proxy_auth) as response: 1019 | response.raise_for_status() 1020 | return await response.json() 1021 | except (Exception, ClientResponseError) as e: 1022 | if attempt < retries - 1: 1023 | await asyncio.sleep(5) 1024 | continue 1025 | self.log( 1026 | f"{Fore.CYAN + Style.BRIGHT}Error :{Style.RESET_ALL}" 1027 | f"{Fore.RED + Style.BRIGHT} GET Balance & Draw Ticket Failed {Style.RESET_ALL}" 1028 | f"{Fore.MAGENTA + Style.BRIGHT}-{Style.RESET_ALL}" 1029 | f"{Fore.YELLOW + Style.BRIGHT} {str(e)} {Style.RESET_ALL}" 1030 | ) 1031 | 1032 | return None 1033 | 1034 | async def claim_checkin(self, address: str, proxy_url=None, retries=5): 1035 | url = f"{self.BASE_API}/check-in" 1036 | headers = { 1037 | **self.HEADERS[address], 1038 | "Authorization": f"Bearer {self.access_tokens[address]}", 1039 | "Content-Length": "2", 1040 | "Content-Type": "application/json" 1041 | } 1042 | for attempt in range(retries): 1043 | connector, proxy, proxy_auth = self.build_proxy_config(proxy_url) 1044 | try: 1045 | async with ClientSession(connector=connector, timeout=ClientTimeout(total=60)) as session: 1046 | async with session.post(url=url, headers=headers, json={}, proxy=proxy, proxy_auth=proxy_auth) as response: 1047 | response.raise_for_status() 1048 | return await response.json() 1049 | except (Exception, ClientResponseError) as e: 1050 | if attempt < retries - 1: 1051 | await asyncio.sleep(5) 1052 | continue 1053 | self.log( 1054 | f"{Fore.CYAN + Style.BRIGHT}Check-In:{Style.RESET_ALL}" 1055 | f"{Fore.RED + Style.BRIGHT} Not Claimed {Style.RESET_ALL}" 1056 | f"{Fore.MAGENTA + Style.BRIGHT}-{Style.RESET_ALL}" 1057 | f"{Fore.YELLOW + Style.BRIGHT} {str(e)} {Style.RESET_ALL}" 1058 | ) 1059 | 1060 | return None 1061 | 1062 | async def perform_draw(self, address: str, proxy_url=None, retries=5): 1063 | url = f"{self.BASE_API}/draw" 1064 | headers = { 1065 | **self.HEADERS[address], 1066 | "Authorization": f"Bearer {self.access_tokens[address]}", 1067 | "Content-Length": "2", 1068 | "Content-Type": "application/json" 1069 | } 1070 | for attempt in range(retries): 1071 | connector, proxy, proxy_auth = self.build_proxy_config(proxy_url) 1072 | try: 1073 | async with ClientSession(connector=connector, timeout=ClientTimeout(total=60)) as session: 1074 | async with session.post(url=url, headers=headers, json={}, proxy=proxy, proxy_auth=proxy_auth) as response: 1075 | response.raise_for_status() 1076 | return await response.json() 1077 | except (Exception, ClientResponseError) as e: 1078 | if attempt < retries - 1: 1079 | await asyncio.sleep(5) 1080 | continue 1081 | self.log( 1082 | f"{Fore.CYAN + Style.BRIGHT}Draw :{Style.RESET_ALL}" 1083 | f"{Fore.RED + Style.BRIGHT} Failed {Style.RESET_ALL}" 1084 | f"{Fore.MAGENTA + Style.BRIGHT}-{Style.RESET_ALL}" 1085 | f"{Fore.YELLOW + Style.BRIGHT} {str(e)} {Style.RESET_ALL}" 1086 | ) 1087 | 1088 | return None 1089 | 1090 | async def process_check_connection(self, address: str, use_proxy: bool, rotate_proxy: bool): 1091 | while True: 1092 | proxy = self.get_next_proxy_for_account(address) if use_proxy else None 1093 | self.log( 1094 | f"{Fore.CYAN+Style.BRIGHT}Proxy :{Style.RESET_ALL}" 1095 | f"{Fore.WHITE + Style.BRIGHT} {proxy} {Style.RESET_ALL}" 1096 | ) 1097 | 1098 | is_valid = await self.check_connection(proxy) 1099 | if not is_valid: 1100 | if rotate_proxy: 1101 | proxy = self.rotate_proxy_for_account(address) 1102 | continue 1103 | 1104 | return False 1105 | 1106 | return True 1107 | 1108 | async def process_get_nonce(self, address: str, use_proxy: bool, rotate_proxy: bool): 1109 | is_valid = await self.process_check_connection(address, use_proxy, rotate_proxy) 1110 | if is_valid: 1111 | 1112 | proxy = self.get_next_proxy_for_account(address) if use_proxy else None 1113 | 1114 | nonce = await self.get_message(address, proxy) 1115 | if not nonce: return False 1116 | 1117 | return nonce["message"] 1118 | 1119 | async def process_verify_signature(self, account: str, address: str, use_proxy: bool, rotate_proxy: bool): 1120 | message = await self.process_get_nonce(address, use_proxy, rotate_proxy) 1121 | if message: 1122 | proxy = self.get_next_proxy_for_account(address) if use_proxy else None 1123 | 1124 | verify = await self.verify_signature(account, address, message, proxy) 1125 | if not verify: return False 1126 | 1127 | self.access_tokens[address] = verify["token"] 1128 | 1129 | self.log( 1130 | f"{Fore.CYAN + Style.BRIGHT}Status :{Style.RESET_ALL}" 1131 | f"{Fore.GREEN + Style.BRIGHT} Login Success {Style.RESET_ALL}" 1132 | ) 1133 | return True 1134 | 1135 | async def process_perform_wrap(self, account: str, address: str, use_proxy: bool): 1136 | tx_hash, block_number = await self.perform_wrap(account, address, use_proxy) 1137 | if tx_hash and block_number: 1138 | explorer = f"https://testnet.xoscan.io/tx/{tx_hash}" 1139 | self.log( 1140 | f"{Fore.CYAN+Style.BRIGHT} Status :{Style.RESET_ALL}" 1141 | f"{Fore.GREEN+Style.BRIGHT} Success {Style.RESET_ALL}" 1142 | ) 1143 | self.log( 1144 | f"{Fore.CYAN+Style.BRIGHT} Block :{Style.RESET_ALL}" 1145 | f"{Fore.WHITE+Style.BRIGHT} {block_number} {Style.RESET_ALL}" 1146 | ) 1147 | self.log( 1148 | f"{Fore.CYAN+Style.BRIGHT} Tx Hash :{Style.RESET_ALL}" 1149 | f"{Fore.WHITE+Style.BRIGHT} {tx_hash} {Style.RESET_ALL}" 1150 | ) 1151 | self.log( 1152 | f"{Fore.CYAN+Style.BRIGHT} Explorer:{Style.RESET_ALL}" 1153 | f"{Fore.WHITE+Style.BRIGHT} {explorer} {Style.RESET_ALL}" 1154 | ) 1155 | else: 1156 | self.log( 1157 | f"{Fore.CYAN+Style.BRIGHT} Status :{Style.RESET_ALL}" 1158 | f"{Fore.RED+Style.BRIGHT} Perform On-Chain Failed {Style.RESET_ALL}" 1159 | ) 1160 | 1161 | async def process_perform_unwrap(self, account: str, address: str, use_proxy: bool): 1162 | tx_hash, block_number = await self.perform_unwrap(account, address, use_proxy) 1163 | if tx_hash and block_number: 1164 | explorer = f"https://testnet.xoscan.io/tx/{tx_hash}" 1165 | 1166 | self.log( 1167 | f"{Fore.CYAN+Style.BRIGHT} Status :{Style.RESET_ALL}" 1168 | f"{Fore.GREEN+Style.BRIGHT} Success {Style.RESET_ALL}" 1169 | ) 1170 | self.log( 1171 | f"{Fore.CYAN+Style.BRIGHT} Block :{Style.RESET_ALL}" 1172 | f"{Fore.WHITE+Style.BRIGHT} {block_number} {Style.RESET_ALL}" 1173 | ) 1174 | self.log( 1175 | f"{Fore.CYAN+Style.BRIGHT} Tx Hash :{Style.RESET_ALL}" 1176 | f"{Fore.WHITE+Style.BRIGHT} {tx_hash} {Style.RESET_ALL}" 1177 | ) 1178 | self.log( 1179 | f"{Fore.CYAN+Style.BRIGHT} Explorer:{Style.RESET_ALL}" 1180 | f"{Fore.WHITE+Style.BRIGHT} {explorer} {Style.RESET_ALL}" 1181 | ) 1182 | else: 1183 | self.log( 1184 | f"{Fore.CYAN+Style.BRIGHT} Status :{Style.RESET_ALL}" 1185 | f"{Fore.RED+Style.BRIGHT} Perform On-Chain Failed {Style.RESET_ALL}" 1186 | ) 1187 | 1188 | async def process_perform_swap(self, account: str, address: str, swap_type: str, from_token: str, to_token: str, amount_in: float, use_proxy: bool): 1189 | tx_hash, block_number = await self.perform_swap(account, address, swap_type, from_token, to_token, amount_in, use_proxy) 1190 | if tx_hash and block_number: 1191 | explorer = f"https://testnet.xoscan.io/tx/{tx_hash}" 1192 | 1193 | self.log( 1194 | f"{Fore.CYAN+Style.BRIGHT} Status :{Style.RESET_ALL}" 1195 | f"{Fore.GREEN+Style.BRIGHT} Success {Style.RESET_ALL}" 1196 | ) 1197 | self.log( 1198 | f"{Fore.CYAN+Style.BRIGHT} Block :{Style.RESET_ALL}" 1199 | f"{Fore.WHITE+Style.BRIGHT} {block_number} {Style.RESET_ALL}" 1200 | ) 1201 | self.log( 1202 | f"{Fore.CYAN+Style.BRIGHT} Tx Hash :{Style.RESET_ALL}" 1203 | f"{Fore.WHITE+Style.BRIGHT} {tx_hash} {Style.RESET_ALL}" 1204 | ) 1205 | self.log( 1206 | f"{Fore.CYAN+Style.BRIGHT} Explorer:{Style.RESET_ALL}" 1207 | f"{Fore.WHITE+Style.BRIGHT} {explorer} {Style.RESET_ALL}" 1208 | ) 1209 | else: 1210 | self.log( 1211 | f"{Fore.CYAN+Style.BRIGHT} Status :{Style.RESET_ALL}" 1212 | f"{Fore.RED+Style.BRIGHT} Perform On-Chain Failed {Style.RESET_ALL}" 1213 | ) 1214 | 1215 | async def process_perform_liquidity(self, account: str, address: str, token_type: str, token0: str, token1: str, amount0_desired: int, amount1_desired: int, use_proxy: bool): 1216 | tx_hash, block_number = await self.perform_liquidity(account, address, token_type, token0, token1, amount0_desired, amount1_desired, use_proxy) 1217 | if tx_hash and block_number: 1218 | explorer = f"https://testnet.xoscan.io/tx/{tx_hash}" 1219 | 1220 | self.log( 1221 | f"{Fore.CYAN+Style.BRIGHT} Status :{Style.RESET_ALL}" 1222 | f"{Fore.GREEN+Style.BRIGHT} Success {Style.RESET_ALL}" 1223 | ) 1224 | self.log( 1225 | f"{Fore.CYAN+Style.BRIGHT} Block :{Style.RESET_ALL}" 1226 | f"{Fore.WHITE+Style.BRIGHT} {block_number} {Style.RESET_ALL}" 1227 | ) 1228 | self.log( 1229 | f"{Fore.CYAN+Style.BRIGHT} Tx Hash :{Style.RESET_ALL}" 1230 | f"{Fore.WHITE+Style.BRIGHT} {tx_hash} {Style.RESET_ALL}" 1231 | ) 1232 | self.log( 1233 | f"{Fore.CYAN+Style.BRIGHT} Explorer:{Style.RESET_ALL}" 1234 | f"{Fore.WHITE+Style.BRIGHT} {explorer} {Style.RESET_ALL}" 1235 | ) 1236 | else: 1237 | self.log( 1238 | f"{Fore.CYAN+Style.BRIGHT} Status :{Style.RESET_ALL}" 1239 | f"{Fore.RED+Style.BRIGHT} Perform On-Chain Failed {Style.RESET_ALL}" 1240 | ) 1241 | 1242 | async def process_option_1(self, address: str, use_proxy: bool): 1243 | proxy = self.get_next_proxy_for_account(address) if use_proxy else None 1244 | 1245 | user = await self.user_data(address, proxy) 1246 | if user: 1247 | balance = user.get("data", {}).get("points", 0) 1248 | 1249 | self.log( 1250 | f"{Fore.CYAN + Style.BRIGHT}Balance :{Style.RESET_ALL}" 1251 | f"{Fore.WHITE + Style.BRIGHT} {balance} PTS {Style.RESET_ALL}" 1252 | ) 1253 | 1254 | claim = await self.claim_checkin(address, proxy) 1255 | if claim.get("success") == True: 1256 | days = claim['check_in_count'] 1257 | reward = claim['pointsEarned'] 1258 | self.log( 1259 | f"{Fore.CYAN + Style.BRIGHT}Check-In:{Style.RESET_ALL}" 1260 | f"{Fore.WHITE + Style.BRIGHT} Day {days} {Style.RESET_ALL}" 1261 | f"{Fore.GREEN + Style.BRIGHT}Is Claimed{Style.RESET_ALL}" 1262 | f"{Fore.MAGENTA + Style.BRIGHT} - {Style.RESET_ALL}" 1263 | f"{Fore.CYAN + Style.BRIGHT}Reward{Style.RESET_ALL}" 1264 | f"{Fore.WHITE + Style.BRIGHT} {reward} PTS{Style.RESET_ALL}" 1265 | ) 1266 | elif claim.get("success") == False: 1267 | if claim.get("error") == "Already checked in today": 1268 | self.log( 1269 | f"{Fore.CYAN + Style.BRIGHT}Check-In:{Style.RESET_ALL}" 1270 | f"{Fore.YELLOW + Style.BRIGHT} Already Claimed {Style.RESET_ALL}" 1271 | ) 1272 | elif claim.get("error") == "Please follow Twitter or join Discord first": 1273 | self.log( 1274 | f"{Fore.CYAN + Style.BRIGHT}Check-In:{Style.RESET_ALL}" 1275 | f"{Fore.YELLOW + Style.BRIGHT} Not Eligible, {Style.RESET_ALL}" 1276 | f"{Fore.WHITE + Style.BRIGHT}Connect Your X or Discord Account First{Style.RESET_ALL}" 1277 | ) 1278 | else: 1279 | self.log( 1280 | f"{Fore.CYAN + Style.BRIGHT}Check-In:{Style.RESET_ALL}" 1281 | f"{Fore.RED + Style.BRIGHT} Unknown Error {Style.RESET_ALL}" 1282 | ) 1283 | 1284 | user = await self.user_data(address, proxy) 1285 | if user: 1286 | current_draw = user.get("data", {}).get("currentDraws", 0) 1287 | 1288 | if current_draw > 0: 1289 | self.log( 1290 | f"{Fore.CYAN + Style.BRIGHT}Draw :{Style.RESET_ALL}" 1291 | f"{Fore.WHITE + Style.BRIGHT} {current_draw} {Style.RESET_ALL}" 1292 | f"{Fore.GREEN + Style.BRIGHT}Available{Style.RESET_ALL}" 1293 | ) 1294 | 1295 | count = 0 1296 | while current_draw > 0: 1297 | count += 1 1298 | 1299 | draw = await self.perform_draw(address, proxy) 1300 | if draw.get("message") == "Draw successful": 1301 | reward = draw['pointsEarned'] 1302 | self.log( 1303 | f"{Fore.MAGENTA + Style.BRIGHT} >{Style.RESET_ALL}" 1304 | f"{Fore.WHITE + Style.BRIGHT} {count} {Style.RESET_ALL}" 1305 | f"{Fore.GREEN + Style.BRIGHT}Success{Style.RESET_ALL}" 1306 | f"{Fore.MAGENTA + Style.BRIGHT} - {Style.RESET_ALL}" 1307 | f"{Fore.CYAN + Style.BRIGHT}Reward{Style.RESET_ALL}" 1308 | f"{Fore.WHITE + Style.BRIGHT} {reward} PTS {Style.RESET_ALL}" 1309 | ) 1310 | else: 1311 | break 1312 | else: 1313 | self.log( 1314 | f"{Fore.CYAN + Style.BRIGHT}Draw :{Style.RESET_ALL}" 1315 | f"{Fore.YELLOW + Style.BRIGHT} No Available {Style.RESET_ALL}" 1316 | ) 1317 | 1318 | async def process_option_2(self, account: str, address: str, use_proxy: bool): 1319 | if self.wrap_option == 1: 1320 | self.log(f"{Fore.CYAN+Style.BRIGHT}Wrap :{Style.RESET_ALL} ") 1321 | 1322 | balance = await self.get_token_balance(address, "XOS", use_proxy) 1323 | self.log( 1324 | f"{Fore.CYAN+Style.BRIGHT} Balance :{Style.RESET_ALL}" 1325 | f"{Fore.WHITE+Style.BRIGHT} {balance} XOS {Style.RESET_ALL}" 1326 | ) 1327 | self.log( 1328 | f"{Fore.CYAN+Style.BRIGHT} Amount :{Style.RESET_ALL}" 1329 | f"{Fore.WHITE+Style.BRIGHT} {self.wrap_amount} XOS {Style.RESET_ALL}" 1330 | ) 1331 | 1332 | if not balance or balance <= self.wrap_amount: 1333 | self.log( 1334 | f"{Fore.CYAN+Style.BRIGHT} Status :{Style.RESET_ALL}" 1335 | f"{Fore.YELLOW+Style.BRIGHT} Insufficient XOS Token Balance {Style.RESET_ALL}" 1336 | ) 1337 | return 1338 | 1339 | await self.process_perform_wrap(account, address, use_proxy) 1340 | 1341 | elif self.wrap_option == 2: 1342 | self.log(f"{Fore.CYAN+Style.BRIGHT}Unwrap :{Style.RESET_ALL} ") 1343 | 1344 | balance = await self.get_token_balance(address, self.WXOS_CONTRACT_ADDRESS, use_proxy) 1345 | self.log( 1346 | f"{Fore.CYAN+Style.BRIGHT} Balance :{Style.RESET_ALL}" 1347 | f"{Fore.WHITE+Style.BRIGHT} {balance} WXOS {Style.RESET_ALL}" 1348 | ) 1349 | self.log( 1350 | f"{Fore.CYAN+Style.BRIGHT} Amount :{Style.RESET_ALL}" 1351 | f"{Fore.WHITE+Style.BRIGHT} {self.wrap_amount} WXOS {Style.RESET_ALL}" 1352 | ) 1353 | 1354 | if not balance or balance <= self.wrap_amount: 1355 | self.log( 1356 | f"{Fore.CYAN+Style.BRIGHT} Status :{Style.RESET_ALL}" 1357 | f"{Fore.YELLOW+Style.BRIGHT} Insufficient WXOS Token Balance {Style.RESET_ALL}" 1358 | ) 1359 | return 1360 | 1361 | await self.process_perform_unwrap(account, address, use_proxy) 1362 | 1363 | async def process_option_2(self, account: str, address: str, use_proxy: bool): 1364 | self.log(f"{Fore.CYAN+Style.BRIGHT}Wrap :{Style.RESET_ALL} ") 1365 | 1366 | balance = await self.get_token_balance(address, "XOS", use_proxy) 1367 | self.log( 1368 | f"{Fore.CYAN+Style.BRIGHT} Balance :{Style.RESET_ALL}" 1369 | f"{Fore.WHITE+Style.BRIGHT} {balance} XOS {Style.RESET_ALL}" 1370 | ) 1371 | self.log( 1372 | f"{Fore.CYAN+Style.BRIGHT} Amount :{Style.RESET_ALL}" 1373 | f"{Fore.WHITE+Style.BRIGHT} {self.wrap_amount} XOS {Style.RESET_ALL}" 1374 | ) 1375 | 1376 | if not balance or balance <= self.wrap_amount: 1377 | self.log( 1378 | f"{Fore.CYAN+Style.BRIGHT} Status :{Style.RESET_ALL}" 1379 | f"{Fore.YELLOW+Style.BRIGHT} Insufficient XOS Token Balance {Style.RESET_ALL}" 1380 | ) 1381 | return 1382 | 1383 | await self.process_perform_wrap(account, address, use_proxy) 1384 | await self.print_timer() 1385 | 1386 | async def process_option_3(self, account: str, address: str, use_proxy: bool): 1387 | self.log(f"{Fore.CYAN+Style.BRIGHT}Unwrap :{Style.RESET_ALL} ") 1388 | 1389 | balance = await self.get_token_balance(address, self.WXOS_CONTRACT_ADDRESS, use_proxy) 1390 | self.log( 1391 | f"{Fore.CYAN+Style.BRIGHT} Balance :{Style.RESET_ALL}" 1392 | f"{Fore.WHITE+Style.BRIGHT} {balance} WXOS {Style.RESET_ALL}" 1393 | ) 1394 | self.log( 1395 | f"{Fore.CYAN+Style.BRIGHT} Amount :{Style.RESET_ALL}" 1396 | f"{Fore.WHITE+Style.BRIGHT} {self.wrap_amount} WXOS {Style.RESET_ALL}" 1397 | ) 1398 | 1399 | if not balance or balance <= self.wrap_amount: 1400 | self.log( 1401 | f"{Fore.CYAN+Style.BRIGHT} Status :{Style.RESET_ALL}" 1402 | f"{Fore.YELLOW+Style.BRIGHT} Insufficient WXOS Token Balance {Style.RESET_ALL}" 1403 | ) 1404 | return 1405 | 1406 | await self.process_perform_unwrap(account, address, use_proxy) 1407 | await self.print_timer() 1408 | 1409 | async def process_option_4(self, account: str, address: str, use_proxy: bool): 1410 | self.log(f"{Fore.CYAN+Style.BRIGHT}Swap :{Style.RESET_ALL} ") 1411 | for i in range(self.swap_count): 1412 | self.log( 1413 | f"{Fore.MAGENTA+Style.BRIGHT} ● {Style.RESET_ALL}" 1414 | f"{Fore.GREEN+Style.BRIGHT}Swap{Style.RESET_ALL}" 1415 | f"{Fore.WHITE+Style.BRIGHT} {i+1} / {self.swap_count} {Style.RESET_ALL} " 1416 | ) 1417 | 1418 | swap_type, from_ticker, to_ticker, from_token, to_token, amount_in = self.generate_swap_option() 1419 | 1420 | self.log( 1421 | f"{Fore.CYAN+Style.BRIGHT} Option :{Style.RESET_ALL}" 1422 | f"{Fore.BLUE+Style.BRIGHT} {from_ticker} to {to_ticker} {Style.RESET_ALL}" 1423 | ) 1424 | 1425 | if swap_type != "native to erc20": 1426 | balance = await self.get_token_balance(address, from_token, use_proxy) 1427 | else: 1428 | balance = await self.get_token_balance(address, "XOS", use_proxy) 1429 | 1430 | self.log( 1431 | f"{Fore.CYAN+Style.BRIGHT} Balance :{Style.RESET_ALL}" 1432 | f"{Fore.WHITE+Style.BRIGHT} {balance} {from_ticker} {Style.RESET_ALL}" 1433 | ) 1434 | self.log( 1435 | f"{Fore.CYAN+Style.BRIGHT} Amount :{Style.RESET_ALL}" 1436 | f"{Fore.WHITE+Style.BRIGHT} {amount_in} {from_ticker} {Style.RESET_ALL}" 1437 | ) 1438 | 1439 | if not balance or balance <= amount_in: 1440 | self.log( 1441 | f"{Fore.CYAN+Style.BRIGHT} Status :{Style.RESET_ALL}" 1442 | f"{Fore.YELLOW+Style.BRIGHT} Insufficient {from_ticker} Token Balance {Style.RESET_ALL}" 1443 | ) 1444 | continue 1445 | 1446 | await self.process_perform_swap(account, address, swap_type, from_token, to_token, amount_in, use_proxy) 1447 | await self.print_timer() 1448 | 1449 | async def process_option_5(self, account: str, address: str, use_proxy): 1450 | self.log(f"{Fore.CYAN+Style.BRIGHT}Add LP :{Style.RESET_ALL} ") 1451 | for i in range(self.liquidity_count): 1452 | self.log( 1453 | f"{Fore.MAGENTA+Style.BRIGHT} ● {Style.RESET_ALL}" 1454 | f"{Fore.GREEN+Style.BRIGHT}Liquidity{Style.RESET_ALL}" 1455 | f"{Fore.WHITE+Style.BRIGHT} {i+1} / {self.liquidity_count} {Style.RESET_ALL} " 1456 | ) 1457 | 1458 | liquidity_option, token_type, ticker0, ticker1, token0, token1, amount0_desired = self.generate_liquidity_option() 1459 | 1460 | self.log( 1461 | f"{Fore.CYAN+Style.BRIGHT} Option :{Style.RESET_ALL}" 1462 | f"{Fore.BLUE+Style.BRIGHT} {liquidity_option} {Style.RESET_ALL}" 1463 | ) 1464 | 1465 | if token_type == "native": 1466 | balance0 = await self.get_token_balance(address, "XOS", use_proxy) 1467 | 1468 | elif token_type == "erc20": 1469 | balance0 = await self.get_token_balance(address, token0, use_proxy) 1470 | 1471 | balance1 = await self.get_token_balance(address, token1, use_proxy) 1472 | 1473 | self.log(f"{Fore.CYAN+Style.BRIGHT} Balance :{Style.RESET_ALL}") 1474 | self.log( 1475 | f"{Fore.MAGENTA+Style.BRIGHT} ● {Style.RESET_ALL}" 1476 | f"{Fore.WHITE+Style.BRIGHT}{balance0} {ticker0}{Style.RESET_ALL}" 1477 | ) 1478 | self.log( 1479 | f"{Fore.MAGENTA+Style.BRIGHT} ● {Style.RESET_ALL}" 1480 | f"{Fore.WHITE+Style.BRIGHT}{balance1} {ticker1}{Style.RESET_ALL}" 1481 | ) 1482 | 1483 | path = bytes.fromhex(token0[2:]) + (500).to_bytes(3, "big") + bytes.fromhex(token1[2:]) 1484 | amount1_desired = await self.get_amount_out_min(address, path, amount0_desired, use_proxy) 1485 | if not amount1_desired: 1486 | self.log( 1487 | f"{Fore.CYAN+Style.BRIGHT} Status :{Style.RESET_ALL}" 1488 | f"{Fore.YELLOW+Style.BRIGHT} Fetch {ticker0} per {ticker1} Current Price Failed {Style.RESET_ALL}" 1489 | ) 1490 | continue 1491 | 1492 | amount0 = amount0_desired / (10 ** 18) 1493 | amount1 = amount1_desired / (10 ** 18) 1494 | 1495 | self.log(f"{Fore.CYAN+Style.BRIGHT} Amount :{Style.RESET_ALL}") 1496 | self.log( 1497 | f"{Fore.MAGENTA+Style.BRIGHT} ● {Style.RESET_ALL}" 1498 | f"{Fore.WHITE+Style.BRIGHT}{amount0} {ticker0}{Style.RESET_ALL}" 1499 | ) 1500 | self.log( 1501 | f"{Fore.MAGENTA+Style.BRIGHT} ● {Style.RESET_ALL}" 1502 | f"{Fore.WHITE+Style.BRIGHT}{amount1} {ticker1}{Style.RESET_ALL}" 1503 | ) 1504 | 1505 | if not balance0 or balance0 <= amount0: 1506 | self.log( 1507 | f"{Fore.CYAN+Style.BRIGHT} Status :{Style.RESET_ALL}" 1508 | f"{Fore.YELLOW+Style.BRIGHT} Insufficient {ticker0} Token Balance {Style.RESET_ALL}" 1509 | ) 1510 | continue 1511 | 1512 | if not balance1 or balance1 <= amount1: 1513 | self.log( 1514 | f"{Fore.CYAN+Style.BRIGHT} Status :{Style.RESET_ALL}" 1515 | f"{Fore.YELLOW+Style.BRIGHT} Insufficient {ticker1} Token Balance {Style.RESET_ALL}" 1516 | ) 1517 | continue 1518 | 1519 | await self.process_perform_liquidity(account, address, token_type, token0, token1, amount0_desired, amount1_desired, use_proxy) 1520 | await self.print_timer() 1521 | 1522 | async def process_accounts(self, account: str, address, option: int, use_proxy: bool, rotate_proxy: bool): 1523 | verifed = await self.process_verify_signature(account, address, use_proxy, rotate_proxy) 1524 | if verifed: 1525 | try: 1526 | web3 = await self.get_web3_with_check(address, use_proxy) 1527 | if not web3: return 1528 | 1529 | self.used_nonce[address] = web3.eth.get_transaction_count(address, "pending") 1530 | 1531 | except Exception as e: 1532 | return self.log( 1533 | f"{Fore.CYAN+Style.BRIGHT}Status :{Style.RESET_ALL}" 1534 | f"{Fore.YELLOW+Style.BRIGHT} {str(e)} {Style.RESET_ALL}" 1535 | ) 1536 | 1537 | if option == 1: 1538 | await self.process_option_1(address, use_proxy) 1539 | 1540 | elif option == 2: 1541 | await self.process_option_2(account, address, use_proxy) 1542 | 1543 | elif option == 3: 1544 | await self.process_option_3(account, address, use_proxy) 1545 | 1546 | elif option == 4: 1547 | await self.process_option_4(account, address, use_proxy) 1548 | 1549 | elif option == 5: 1550 | await self.process_option_5(account, address, use_proxy) 1551 | 1552 | elif option == 6: 1553 | await self.process_option_1(address, use_proxy) 1554 | await asyncio.sleep(5) 1555 | 1556 | if self.wrap_option == 1: 1557 | await self.process_option_2(account, address, use_proxy) 1558 | elif self.wrap_option == 2: 1559 | await self.process_option_3(account, address, use_proxy) 1560 | 1561 | await asyncio.sleep(5) 1562 | 1563 | await self.process_option_4(account, address, use_proxy) 1564 | await asyncio.sleep(5) 1565 | 1566 | await self.process_option_5(account, address, use_proxy) 1567 | await asyncio.sleep(5) 1568 | 1569 | async def main(self): 1570 | try: 1571 | with open('accounts.txt', 'r') as file: 1572 | accounts = [line.strip() for line in file if line.strip()] 1573 | 1574 | option, use_proxy_choice, rotate_proxy = self.print_question() 1575 | 1576 | use_proxy = False 1577 | if use_proxy_choice in [1, 2]: 1578 | use_proxy = True 1579 | 1580 | while True: 1581 | self.clear_terminal() 1582 | self.welcome() 1583 | self.log( 1584 | f"{Fore.GREEN + Style.BRIGHT}Account's Total: {Style.RESET_ALL}" 1585 | f"{Fore.WHITE + Style.BRIGHT}{len(accounts)}{Style.RESET_ALL}" 1586 | ) 1587 | 1588 | if use_proxy: 1589 | await self.load_proxies(use_proxy_choice) 1590 | 1591 | separator = "=" * 25 1592 | for account in accounts: 1593 | if account: 1594 | address = self.generate_address(account) 1595 | self.log( 1596 | f"{Fore.CYAN + Style.BRIGHT}{separator}[{Style.RESET_ALL}" 1597 | f"{Fore.WHITE + Style.BRIGHT} {self.mask_account(address)} {Style.RESET_ALL}" 1598 | f"{Fore.CYAN + Style.BRIGHT}]{separator}{Style.RESET_ALL}" 1599 | ) 1600 | 1601 | if not address: 1602 | self.log( 1603 | f"{Fore.CYAN + Style.BRIGHT}Status :{Style.RESET_ALL}" 1604 | f"{Fore.RED + Style.BRIGHT} Invalid Private Key or Library Version Not Supported {Style.RESET_ALL}" 1605 | ) 1606 | continue 1607 | 1608 | self.HEADERS[address] = { 1609 | "Accept": "application/json, text/plain, */*", 1610 | "Accept-Language": "id-ID,id;q=0.9,en-US;q=0.8,en;q=0.7", 1611 | "Origin": "https://x.ink", 1612 | "Referer": "https://x.ink/", 1613 | "Sec-Fetch-Dest": "empty", 1614 | "Sec-Fetch-Mode": "cors", 1615 | "Sec-Fetch-Site": "same-site", 1616 | "User-Agent": FakeUserAgent().random 1617 | } 1618 | 1619 | await self.process_accounts(account, address, option, use_proxy, rotate_proxy) 1620 | await asyncio.sleep(3) 1621 | 1622 | self.log(f"{Fore.CYAN + Style.BRIGHT}={Style.RESET_ALL}"*72) 1623 | 1624 | delay = 24 * 60 * 60 1625 | while delay > 0: 1626 | formatted_time = self.format_seconds(delay) 1627 | print( 1628 | f"{Fore.CYAN+Style.BRIGHT}[ Wait for{Style.RESET_ALL}" 1629 | f"{Fore.WHITE+Style.BRIGHT} {formatted_time} {Style.RESET_ALL}" 1630 | f"{Fore.CYAN+Style.BRIGHT}... ]{Style.RESET_ALL}" 1631 | f"{Fore.WHITE+Style.BRIGHT} | {Style.RESET_ALL}" 1632 | f"{Fore.BLUE+Style.BRIGHT}All Accounts Have Been Processed...{Style.RESET_ALL}", 1633 | end="\r", 1634 | flush=True 1635 | ) 1636 | await asyncio.sleep(1) 1637 | delay -= 1 1638 | 1639 | except FileNotFoundError: 1640 | self.log(f"{Fore.RED}File 'accounts.txt' Not Found.{Style.RESET_ALL}") 1641 | return 1642 | except Exception as e: 1643 | self.log(f"{Fore.RED+Style.BRIGHT}Error: {e}{Style.RESET_ALL}") 1644 | raise e 1645 | 1646 | if __name__ == "__main__": 1647 | try: 1648 | bot = XOS() 1649 | asyncio.run(bot.main()) 1650 | except KeyboardInterrupt: 1651 | print( 1652 | f"{Fore.CYAN + Style.BRIGHT}[ {datetime.now().astimezone(wib).strftime('%x %X %Z')} ]{Style.RESET_ALL}" 1653 | f"{Fore.WHITE + Style.BRIGHT} | {Style.RESET_ALL}" 1654 | f"{Fore.RED + Style.BRIGHT}[ EXIT ] XOS Testnet - BOT{Style.RESET_ALL} " 1655 | ) --------------------------------------------------------------------------------