Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
czbag committed Oct 11, 2023
1 parent 678d42d commit 08209ae
Show file tree
Hide file tree
Showing 11 changed files with 117 additions and 44 deletions.
1 change: 1 addition & 0 deletions data/run_accounts.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"accounts": []}
50 changes: 37 additions & 13 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
from typing import Union

import questionary
from loguru import logger
from questionary import Choice

from config import ACCOUNTS, RECIPIENTS
from utils.sleeping import sleep
from utils.helpers import get_run_accounts, update_run_accounts
from modules_settings import *
from settings import TYPE_WALLET, RANDOM_WALLET, IS_SLEEP, SLEEP_FROM, SLEEP_TO
from settings import TYPE_WALLET, RANDOM_WALLET, SLEEP_FROM, SLEEP_TO, QUANTITY_RUN_ACCOUNTS


def get_module():
Expand Down Expand Up @@ -73,27 +74,50 @@ def get_wallets(use_recipients: bool = False):
return wallets


def run_module(module, account_id, key, recipient: Union[str, None] = None):
if recipient:
asyncio.run(module(account_id, key, TYPE_WALLET, recipient))
else:
asyncio.run(module(account_id, key, TYPE_WALLET))
async def run_module(module, account_id, key, sleep_time, start_id, recipient: Union[str, None] = None):
if start_id != 1:
await asyncio.sleep(sleep_time)

while True:
run_accounts = get_run_accounts()

if len(run_accounts["accounts"]) < QUANTITY_RUN_ACCOUNTS:
update_run_accounts(account_id, "add")

if recipient:
await module(account_id, key, TYPE_WALLET, recipient)
else:
await module(account_id, key, TYPE_WALLET)

update_run_accounts(account_id, "remove")

break
else:
logger.info(f'Current run accounts: {len(run_accounts["accounts"])}')
await asyncio.sleep(60)

def main(module):

async def main(module):
if module in [deposit_starknet, withdraw_starknet, bridge_orbiter, make_transfer]:
wallets = get_wallets(True)
else:
wallets = get_wallets()

tasks = []

sleep_time = random.randint(SLEEP_FROM, SLEEP_TO)

if RANDOM_WALLET:
random.shuffle(wallets)

for account in wallets:
run_module(module, account.get("id"), account.get("key"), account.get("recipient", None))
for _, account in enumerate(wallets, start=1):
tasks.append(asyncio.create_task(
run_module(module, account.get("id"), account.get("key"), sleep_time, _, account.get("recipient", None))
))

sleep_time += random.randint(SLEEP_FROM, SLEEP_TO)

if account != wallets[-1] and IS_SLEEP:
sleep(SLEEP_FROM, SLEEP_TO)
await asyncio.gather(*tasks)


if __name__ == '__main__':
Expand All @@ -103,7 +127,7 @@ def main(module):
if module == "tx_checker":
get_tx_count(TYPE_WALLET)
else:
main(module)
asyncio.run(main(module))

print("\n❤️ Subscribe to me – https://t.me/sybilwave\n")
print("🤑 Donate me: 0x00000b0ddce0bfda4531542ad1f2f5fad7b9cde9")
2 changes: 1 addition & 1 deletion modules/multiswap.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,4 @@ async def swap(
)

if _ != len(path):
sleep(sleep_from, sleep_to)
await sleep(sleep_from, sleep_to)
2 changes: 1 addition & 1 deletion modules/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ async def start(self, use_modules: list, sleep_from: int, sleep_to: int, random_

await module(self._id, self.private_key, self.type_account)

sleep(sleep_from, sleep_to)
await sleep(sleep_from, sleep_to)
2 changes: 1 addition & 1 deletion modules/swap_tokens.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ async def swap(
)

if _ != len(STARKNET_TOKENS):
sleep(sleep_from, sleep_to)
await sleep(sleep_from, sleep_to)
2 changes: 1 addition & 1 deletion modules/zklend.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ async def deposit(
await self.wait_until_tx_finished(transaction_response.transaction_hash)

if make_withdraw:
sleep(sleep_from, sleep_to)
await sleep(sleep_from, sleep_to)

await self.withdraw_all(token)

Expand Down
51 changes: 41 additions & 10 deletions modules_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ async def withdraw_starknet(_id, key, type_account, recipient):
all_amount - swap from min_percent to max_percent
"""

min_amount = 0.0001
max_amount = 0.0002
min_amount = 0.019
max_amount = 0.02
decimal = 5

all_amount = True
all_amount = False

min_percent = 5
max_percent = 5
Expand Down Expand Up @@ -293,7 +293,7 @@ async def deposit_zklend(_id, key, type_account):
all_amount - deposit from min_percent to max_percent
"""

use_token = ["USDT"]
use_token = ["ETH"]

min_amount = 0.0001
max_amount = 0.0002
Expand Down Expand Up @@ -397,7 +397,7 @@ async def swap_multiswap(_id, key, type_account):
random_swap_token = True

min_percent = 10
max_percent = 50
max_percent = 60

multi = Multiswap(_id, key, type_account)
await multi.swap(
Expand Down Expand Up @@ -439,11 +439,42 @@ async def custom_routes(account_id, key, type_account):
example [module_1, module_2, [module_3, module_4], module 5]
The script will start with module 1, 2, 5 and select a random one from module 3 and 4
"""

use_modules = [swap_multiswap, [swap_tokens, deposit_zklend]]

sleep_from = 150
sleep_to = 700
"""
BRIDGE:
– deposit_starknet
– withdraw_starknet
– bridge_orbiter
DEX:
– swap_jediswap
– swap_myswap
– swap_starkswap
– swap_sithswap
– swap_protoss
– swap_avnu
– swap_fibrous
LANDING:
– deposit_zklend
– withdraw_zklend
– enable_collateral_zklend
– disable_collateral_zklend
NFT/DOMAIN:
– mint_starknet_id
– mint_starkverse
ANOTHER:
– send_mail_dmail
– swap_tokens
– swap_multiswap
– make_transfer
______________________________________________________
Disclaimer - You can add modules to [] to select random ones,
example [module_1, module_2, [module_3, module_4], module 5]
The script will start with module 1, 2, 5 and select a random one from module 3 and 4
"""

use_modules = [deposit_zklend, deposit_zklend, deposit_zklend, deposit_zklend]

sleep_from = 1
sleep_to = 3

random_module = True

Expand Down
3 changes: 1 addition & 2 deletions settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
# RANDOM WALLETS MODE
RANDOM_WALLET = True # True/False

# SLEEP MODE
IS_SLEEP = True # True/False
QUANTITY_RUN_ACCOUNTS = 5

SLEEP_FROM = 100
SLEEP_TO = 700
Expand Down
4 changes: 2 additions & 2 deletions utils/gas_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ async def wait_gas_ethereum():

if gas > MAX_GWEI:
logger.info(f'Current GWEI: {gas} > {MAX_GWEI}')
sleep(60, 70)
await sleep(60, 70)
else:
logger.success(f"GWEI is normal | current: {gas} < {MAX_GWEI}")
break
Expand All @@ -49,7 +49,7 @@ async def wait_gas_starknet():

if gas > MAX_GWEI:
logger.info(f'Current GWEI: {gas} > {MAX_GWEI}')
sleep(60, 70)
await sleep(60, 70)
else:
logger.success(f"GWEI is normal | current: {gas} < {MAX_GWEI}")
break
Expand Down
25 changes: 24 additions & 1 deletion utils/helpers.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import json

from loguru import logger

from settings import RETRY_COUNT
Expand All @@ -13,7 +15,28 @@ async def wrapper(*args, **kwargs):
return result
except Exception as e:
logger.error(f"Error | {e}")
sleep(10, 60)
await sleep(10, 60)
retries += 1

return wrapper


def get_run_accounts():
with open("data/run_accounts.json", "r") as data:
return json.load(data)


def update_run_accounts(_id: int, method: str):
run_accounts = get_run_accounts()

with open("data/run_accounts.json", "w") as data:
try:
if method == "add":
run_accounts["accounts"].append(_id)
else:
run_accounts["accounts"].remove(_id)

json.dump(run_accounts, data)
except:
new_data = {"accounts": []}
json.dump(new_data, data)
19 changes: 7 additions & 12 deletions utils/sleeping.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
import time
import asyncio
import random

from tqdm import tqdm
from loguru import logger


def sleep(sleep_from: int, sleep_to: int):
async def sleep(sleep_from: int, sleep_to: int):
delay = random.randint(sleep_from, sleep_to)
with tqdm(
total=delay,
desc="💤 Sleep",
bar_format="{desc}: |{bar:20}| {percentage:.0f}% | {n_fmt}/{total_fmt}",
colour="green"
) as pbar:
for _ in range(delay):
time.sleep(1)
pbar.update(1)

logger.info(f"💤 Sleep {delay} s.")
for _ in range(delay):
await asyncio.sleep(1)

0 comments on commit 08209ae

Please sign in to comment.