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
from typing import List, Dict, Any, Tuple
import random
import time
from threading import Thread
from modules.webui import init_app
from modules.storage import init_db, store_transaction
app = Flask(__name__)
# config = load_config()
@ -769,14 +766,12 @@ async def follow_move(move):
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')
# Convert to lamports
# if decimals is 6, then amount = amount * 1e6; if 9, then amount = amount * 1e9
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
msg = (