This commit is contained in:
Dobromir Popov 2024-10-21 14:53:38 +03:00
parent 83ee5b51a3
commit 1ad6cf379a

View File

@ -39,12 +39,9 @@ import requests
import re import re
from typing import List, Dict, Any, Tuple from typing import List, Dict, Any, Tuple
import random import random
import time
from threading import Thread from threading import Thread
from modules.webui import init_app
from modules.storage import init_db, store_transaction
app = Flask(__name__) app = Flask(__name__)
# config = load_config() # config = load_config()
@ -768,15 +765,13 @@ async def follow_move(move):
return return
amount_to_swap = min(amount_to_swap, your_balance) # Ensure we're not trying to swap more than we have amount_to_swap = min(amount_to_swap, your_balance) # Ensure we're not trying to swap more than we have
amount = int(amount)
logging.debug(f"Calculated amount in lamports: {amount}")
decimals = token_info.get('decimals') decimals = token_info.get('decimals')
# 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**decimals) amount = int(amount_to_swap * 10**decimals)
amount = int(amount)
logging.debug(f"Calculated amount in lamports: {amount}")
if your_balance < amount_to_swap: # should not happen if your_balance < amount_to_swap: # should not happen
msg = ( msg = (