await telegram; prod wallets

This commit is contained in:
Dobromir Popov 2024-10-11 09:46:42 +03:00
parent 7d63f60247
commit 49a78083c4
2 changed files with 27 additions and 26 deletions

View File

@ -9,9 +9,8 @@ TELEGRAM_BOT_TOKEN="6805059978:AAHNJKuOeazMSJHc3-BXRCsFfEVyFHeFnjw"
DISPLAY_CURRENCY=USD DISPLAY_CURRENCY=USD
# Niki's to Sync: [PROD] # Niki's to Sync: [PROD]
# FOLLOWED_WALLET="7keSmTZozjmuX66gd9GBSJYEHnMqsyutWpvuuKtXZKDH" FOLLOWED_WALLET="7keSmTZozjmuX66gd9GBSJYEHnMqsyutWpvuuKtXZKDH" YOUR_WALLET="7QXGLRjvyFAmxdRaP9Wk18KwWTMfspF4Na2sr3o3PzxV"
# YOUR_WALLET="7QXGLRjvyFAmxdRaP9Wk18KwWTMfspF4Na2sr3o3PzxV"
# Sync to main [DEV] # Sync to main [DEV]
FOLLOWED_WALLET="7QXGLRjvyFAmxdRaP9Wk18KwWTMfspF4Na2sr3o3PzxV" # FOLLOWED_WALLET="7QXGLRjvyFAmxdRaP9Wk18KwWTMfspF4Na2sr3o3PzxV"
YOUR_WALLET="65nzyZXTLC81MthTo52a2gRJjqryTizWVqpK2fDKLye5" # YOUR_WALLET="65nzyZXTLC81MthTo52a2gRJjqryTizWVqpK2fDKLye5"

View File

@ -940,7 +940,7 @@ async def process_log(log_result):
except Exception as e: except Exception as e:
logging.error(f"Error aquiring log details and following: {e}") logging.error(f"Error aquiring log details and following: {e}")
send_telegram_message(f"Not followed! Error following move.") await send_telegram_message(f"Not followed! Error following move.")
return return
except Exception as e: except Exception as e:
@ -1017,13 +1017,13 @@ async def follow_move(move):
amount_to_swap = your_balance * (move['percentage_swapped'] / 100) amount_to_swap = your_balance * (move['percentage_swapped'] / 100)
# # always get 99% of the amount to swap # # always get 99% of the amount to swap
amount_to_swap = amount_to_swap * 0.95 # amount_to_swap = amount_to_swap * 0.95
# Convert to lamports # Convert to lamports
# if decimals is 6, then amount = amount * 1e6; if 9, then amount = amount * 1e9 # if decimals is 6, then amount = amount * 1e6; if 9, then amount = amount * 1e9
amount = int(amount_to_swap * 10**token_info.get('decimals') ) amount = int(amount_to_swap * 10**token_info.get('decimals') )
if your_balance >= amount_to_swap: if your_balance < amount_to_swap:
msg = ( msg = (
f"<b>Warning:</b>\n" f"<b>Warning:</b>\n"
f"Insufficient balance: {your_balance:.6f} {token_name_in}. We want to swap {amount_to_swap:.6f}\n({move['symbol_in']}, decimals {token_info.get('decimals')} amount {amount}).\n This will probably fail. But we will try anyway." f"Insufficient balance: {your_balance:.6f} {token_name_in}. We want to swap {amount_to_swap:.6f}\n({move['symbol_in']}, decimals {token_info.get('decimals')} amount {amount}).\n This will probably fail. But we will try anyway."
@ -1205,8 +1205,9 @@ async def subscribe_to_wallet():
reconnect_delay = min(reconnect_delay * 2, max_reconnect_delay) reconnect_delay = min(reconnect_delay * 2, max_reconnect_delay)
pk = os.getenv("PK") pk = os.getenv("PK")
async def check_PK():
global pk
if not pk: if not pk:
try: try:
script_dir = os.path.dirname(os.path.abspath(__file__)) script_dir = os.path.dirname(os.path.abspath(__file__))
@ -1223,11 +1224,12 @@ if not pk:
if not pk: if not pk:
logging.error("Private key not found in environment variables. Will not be able to sign transactions.") logging.error("Private key not found in environment variables. Will not be able to sign transactions.")
# send TG warning message # send TG warning message
send_telegram_message("<b>Warning:</b> Private key not found in environment variables. Will not be able to sign transactions.") await send_telegram_message("<b>Warning:</b> Private key not found in environment variables. Will not be able to sign transactions.")
async def main(): async def main():
await send_telegram_message("Solana Agent Started. Connecting to mainnet...") await send_telegram_message("Solana Agent Started. Connecting to mainnet...")
await check_PK()
await subscribe_to_wallet() await subscribe_to_wallet()
def run_flask(): def run_flask():