-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
100 lines (77 loc) · 2.67 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
import random
import sys
import time
from concurrent.futures import ThreadPoolExecutor
from itertools import count
import questionary
from loguru import logger
from questionary import Choice
from modules_settings import *
from utils.sleeping import sleep
from utils.logs_handler import filter_out_utils
from utils.password_handler import get_wallet_data
from settings import (
RANDOM_WALLET,
SLEEP_FROM,
SLEEP_TO,
QUANTITY_THREADS,
THREAD_SLEEP_FROM,
THREAD_SLEEP_TO,
SAVE_LOGS
)
import threading
transaction_lock = threading.Lock()
def get_module():
counter = count(1)
result = questionary.select(
"Select a method to get started",
choices=[
Choice(f"{next(counter)}) Encrypt private keys and proxies", encrypt_privates),
Choice(f"{next(counter)}) Make deposit from OKX", withdraw_okx),
Choice(f"{next(counter)}) Testnet Bridge (Layer Zero)", testnet_bridge),
Choice(f"{next(counter)}) Swap ETH -> stETH", get_steth),
Choice(f"{next(counter)}) Stake stETH", stake_steth),
Choice(f"{next(counter)}) Unstake stETH", unstake_steth),
Choice(f"{next(counter)}) Custom Routes", custom_routes),
Choice(f"{next(counter)}) Automatic Routes", automatic_routes),
Choice(f"{next(counter)}) Exit", "exit"),
],
qmark="⚙️ ",
pointer="✅ "
).ask()
if result == "exit":
sys.exit()
return result
def get_wallets():
wallets_data = get_wallet_data()
return list(wallets_data.values())
async def run_module(module, wallet_data):
try:
await module(wallet_data)
except Exception as e:
logger.error(e)
import traceback
traceback.print_exc()
await sleep(SLEEP_FROM, SLEEP_TO)
def _async_run_module(module, wallet_data):
asyncio.run(run_module(module, wallet_data))
def main(module):
if module == encrypt_privates:
return encrypt_privates(force=True)
wallets_data = get_wallets()
if RANDOM_WALLET:
random.shuffle(wallets_data)
with ThreadPoolExecutor(max_workers=QUANTITY_THREADS) as executor:
for _, wallet_data in enumerate(wallets_data, start=1):
executor.submit(
_async_run_module,
module,
wallet_data
)
time.sleep(random.randint(THREAD_SLEEP_FROM, THREAD_SLEEP_TO))
if __name__ == '__main__':
if SAVE_LOGS:
logger.add('logs.txt', filter=filter_out_utils)
module = get_module()
main(module)
logger.success("All done!")