From 498d28d172409331d5db3a5c0200e16ee3560db0 Mon Sep 17 00:00:00 2001 From: Alexander Date: Sun, 28 Jul 2024 17:53:44 -0400 Subject: [PATCH] fixed rounding to 15 decimal places by default for convert_tokens_multi --- core.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/core.py b/core.py index cb80c64..5ab08ef 100755 --- a/core.py +++ b/core.py @@ -228,14 +228,7 @@ def convert_tokens_multi(account, multi_address, token0_address, token1_address, cost = routes_functions[multi_address]['costs'][token0_address] mints = routes_functions[multi_address]['mints'] or 1 tokens_cost = cost * iterations * mints - # python is so stupid sometimes - try: - decimal_places = len(str(cost).split('.')[1]) - decimal_places = decimal_places if decimal_places <= 15 else 15 - except (AttributeError, IndexError): - tokens_required = tokens_cost - else: - tokens_required = float(round(tokens_cost, decimal_places)) + tokens_required = round(tokens_cost, 15) # check if the wallet has enough tokens to convert if tokens_required > (tokens_balance := get_token_balance(token0_address, account.address)):