diff --git a/README.md b/README.md index 67f76a6..4928c3b 100644 --- a/README.md +++ b/README.md @@ -150,4 +150,4 @@ By following these steps, you'll terminate the bot and retrieve your setup UTXOs ### Disclaimer By running this software, you assume all responsibility and risk associated with its operation. Users are to exercise caution and perform their own due diligence when running the bot, especially in a live environment. -The duckpools community welcomes contributions and feedback as we work towards enhancing the functionality and reliability of this project. +The duckpools community welcomes contributions and feedback as we work towards enhancing the functionality and reliability of this project. \ No newline at end of file diff --git a/erg_pool/e_borrow_proxy.py b/erg_pool/e_borrow_proxy.py index 498bc57..a9eca19 100644 --- a/erg_pool/e_borrow_proxy.py +++ b/erg_pool/e_borrow_proxy.py @@ -8,6 +8,7 @@ get_pool_param_box from helpers.serializer import encode_int_tuple, encode_long, encode_long_pair from logger import set_logger +from helpers.terminal_link import make_terminal_link logger = set_logger(__name__) @@ -152,9 +153,22 @@ def process_borrow_proxy_box(pool, box, latest_tx, fee=TX_FEE): if tx_id != -1: logger.info("Successfully submitted refund transaction with ID: %s", tx_id) else: - logger.warning("Failed to process or refund transaction object: %s Failed Refund txID quoted as: %s", - json.dumps(transaction_to_sign), tx_id) - return latest_tx + box_id = box.get('boxId', 'unknown') + transaction_id = box.get('transactionId', 'unknown') + box_url = f"https://ergexplorer.com/boxes#{box_id}" if box_id != 'unknown' else None + tx_url = f"https://ergexplorer.com/transactions#{transaction_id}" if transaction_id != 'unknown' else None + box_link = make_terminal_link(box_url, box_id) if box_url else box_id + tx_link = make_terminal_link(tx_url, transaction_id) if tx_url else transaction_id + duckpools_link = make_terminal_link("https://www.duckpools.io/", "www.duckpools.io") + logger.warning( + f"Failed to process or refund transaction.\n" + f"\t- Transaction ID: {tx_link}\n" + f"\t- Box ID: {box_link}\n" + f"\t- Refund txID: -1\n" + f"\t- If this persists, verify the bot's configuration or contact Duckpools support on Discord. Visit {duckpools_link}\n" + ) + logger.debug(f"Full transaction object: {transaction_to_sign}") + return latest_tx return obj diff --git a/erg_pool/e_lend_proxy.py b/erg_pool/e_lend_proxy.py index 385da79..824a3fb 100644 --- a/erg_pool/e_lend_proxy.py +++ b/erg_pool/e_lend_proxy.py @@ -7,6 +7,7 @@ from helpers.node_calls import tree_to_address, box_id_to_binary, sign_tx from helpers.platform_functions import calculate_final_amount, get_pool_param_box from logger import set_logger +from helpers.terminal_link import make_terminal_link logger = set_logger(__name__) @@ -123,10 +124,22 @@ def process_lend_proxy_box(pool, box, latest_tx): if tx_id != ERROR: logger.info("Successfully submitted refund transaction with ID: %s", tx_id) else: - logger.warning("Failed to process or refund transaction object: %s Failed Refund txID quoted as: %s", - json.dumps(transaction_to_sign), tx_id) - - return latest_tx + box_id = box.get('boxId', 'unknown') + transaction_id = box.get('transactionId', 'unknown') + box_url = f"https://ergexplorer.com/boxes#{box_id}" if box_id != 'unknown' else None + tx_url = f"https://ergexplorer.com/transactions#{transaction_id}" if transaction_id != 'unknown' else None + box_link = make_terminal_link(box_url, box_id) if box_url else box_id + tx_link = make_terminal_link(tx_url, transaction_id) if tx_url else transaction_id + duckpools_link = make_terminal_link("https://www.duckpools.io/", "www.duckpools.io") + logger.warning( + f"Failed to process or refund transaction.\n" + f"\t- Transaction ID: {tx_link}\n" + f"\t- Box ID: {box_link}\n" + f"\t- Refund txID: -1\n" + f"\t- If this persists, verify the bot's configuration or contact Duckpools support on Discord. Visit {duckpools_link}\n" + ) + logger.debug(f"Full transaction object: {transaction_to_sign}") + return latest_tx return obj diff --git a/erg_pool/e_repay_proxy.py b/erg_pool/e_repay_proxy.py index f5ddfcb..2ca17c0 100644 --- a/erg_pool/e_repay_proxy.py +++ b/erg_pool/e_repay_proxy.py @@ -7,6 +7,7 @@ from helpers.platform_functions import get_parent_box, get_head_child, get_children_boxes, get_base_child, \ get_interest_box from logger import set_logger +from helpers.terminal_link import make_terminal_link logger = set_logger(__name__) @@ -36,8 +37,22 @@ def refund_repay_proxy_box(box): if tx_id != -1: logger.info("Successfully submitted refund transaction with ID: %s", tx_id) else: - logger.warning("Failed to process or refund transaction object: %s Failed Refund txID quoted as: %s", - json.dumps(transaction_to_sign), tx_id) + box_id = box.get('boxId', 'unknown') + transaction_id = box.get('transactionId', 'unknown') + box_url = f"https://ergexplorer.com/boxes#{box_id}" if box_id != 'unknown' else None + tx_url = f"https://ergexplorer.com/transactions#{transaction_id}" if transaction_id != 'unknown' else None + box_link = make_terminal_link(box_url, box_id) if box_url else box_id + tx_link = make_terminal_link(tx_url, transaction_id) if tx_url else transaction_id + duckpools_link = make_terminal_link("https://www.duckpools.io/", "www.duckpools.io") + logger.warning( + f"Failed to process or refund transaction.\n" + f"\t- Transaction ID: {tx_link}\n" + f"\t- Box ID: {box_link}\n" + f"\t- Refund txID: -1\n" + f"\t- If this persists, verify the bot's configuration or contact Duckpools support on Discord. Visit {duckpools_link}\n" + ) + logger.debug(f"Full transaction object: {transaction_to_sign}") + return latest_tx def process_repay_proxy_box(pool, box, empty): diff --git a/erg_pool/e_repay_to_pool.py b/erg_pool/e_repay_to_pool.py index 47c12d7..8a9b026 100644 --- a/erg_pool/e_repay_to_pool.py +++ b/erg_pool/e_repay_to_pool.py @@ -4,15 +4,43 @@ from helpers.job_helpers import latest_pool_info, job_processor from helpers.node_calls import box_id_to_binary, sign_tx from logger import set_logger +from helpers.terminal_link import make_terminal_link logger = set_logger(__name__) def process_repay_to_pool_box(pool, box, latest_tx): erg_pool_box, borrowed = latest_pool_info(pool, latest_tx) - erg_to_give = box["value"] - TX_FEE - final_borrowed = borrowed - int(box["assets"][0]["amount"]) + + box_id = box.get('boxId', 'unknown') + transaction_id = box.get('transactionId', 'unknown') + box_url = f"https://ergexplorer.com/boxes#{box_id}" if box_id != 'unknown' else None + tx_url = f"https://ergexplorer.com/transactions#{transaction_id}" if transaction_id != 'unknown' else None + box_link = make_terminal_link(box_url, box_id) if box_url else box_id + tx_link = make_terminal_link(tx_url, transaction_id) if tx_url else transaction_id + + if "assets" not in box or not box["assets"]: + duckpools_link = make_terminal_link("https://www.duckpools.io/", "www.duckpools.io") + logger.error( + f"[Repay to Pool] Box has no assets, the pool wallet needs to be refilled.\n" + f"\t- Transaction ID: {tx_link}\n" + f"\t- Box ID: {box_link}\n" + f"\t- If this persists, verify the bot's configuration or contact Duckpools support on Discord. Visit {duckpools_link}\n" + ) + return None + + try: + final_borrowed = borrowed - int(box["assets"][0]["amount"]) + except (ValueError, TypeError) as e: + duckpools_link = make_terminal_link("https://www.duckpools.io/", "www.duckpools.io") + logger.error( + f"[Repay to Pool] Invalid asset amount: {e}.\n" + f"\t- Transaction ID: {tx_link}\n" + f"\t- Box ID: {box_link}\n" + f"\t- If this persists, contact Duckpools support on Discord. Visit {duckpools_link}\n" + ) + return None transaction_to_sign = \ { diff --git a/erg_pool/e_withdraw_proxy.py b/erg_pool/e_withdraw_proxy.py index 69958b8..e970317 100644 --- a/erg_pool/e_withdraw_proxy.py +++ b/erg_pool/e_withdraw_proxy.py @@ -7,16 +7,44 @@ from helpers.node_calls import tree_to_address, box_id_to_binary, sign_tx from helpers.platform_functions import calculate_service_fee, get_pool_param_box from logger import set_logger +from helpers.terminal_link import make_terminal_link logger = set_logger(__name__) def process_withdraw_proxy_box(pool, box, latest_tx): erg_pool_box, borrowed = latest_pool_info(pool, latest_tx) + box_id = box.get('boxId', 'unknown') + transaction_id = box.get('transactionId', 'unknown') + box_url = f"https://ergexplorer.com/boxes#{box_id}" if box_id != 'unknown' else None + tx_url = f"https://ergexplorer.com/transactions#{transaction_id}" if transaction_id != 'unknown' else None + box_link = make_terminal_link(box_url, box_id) if box_url else box_id + tx_link = make_terminal_link(tx_url, transaction_id) if tx_url else transaction_id + + if "assets" not in box or not box["assets"]: + duckpools_link = make_terminal_link("https://www.duckpools.io/", "www.duckpools.io") + logger.error( + f"[Withdraw Proxy] Box has no assets, the pool wallet needs to be refilled.\n" + f"\t- Transaction ID: {tx_link}\n" + f"\t- Box ID: {box_link}\n" + f"\t- If this persists, verify the bot's configuration or contact Duckpools support on Discord. Visit {duckpools_link}\n" + ) + return None + + try: + user_gives = box["assets"][0]["amount"] + except (ValueError, TypeError) as e: + duckpools_link = make_terminal_link("https://www.duckpools.io/", "www.duckpools.io") + logger.error( + f"[Withdraw Proxy] Invalid asset amount: {e}.\n" + f"\t- Transaction ID: {tx_link}\n" + f"\t- Box ID: {box_link}\n" + f"\t- If this persists, contact Duckpools support on Discord. Visit {duckpools_link}\n" + ) + return None held_erg0 = erg_pool_box["value"] held_tokens = int(erg_pool_box["assets"][1]["amount"]) - user_gives = box["assets"][0]["amount"] circulating_tokens = int(MAX_LP_TOKENS - held_tokens) final_circulating = circulating_tokens - user_gives held_erg1 = ceil(final_circulating * (held_erg0 + borrowed) / circulating_tokens - borrowed) + 1 @@ -123,9 +151,21 @@ def process_withdraw_proxy_box(pool, box, latest_tx): if tx_id != ERROR: logger.info("Successfully submitted refund transaction with ID: %s", tx_id) else: - logger.warning("Failed to process or refund transaction object: %s Failed Refund txID quoted as: %s", - json.dumps(transaction_to_sign), tx_id) - return latest_tx + box_id = box.get('boxId', 'unknown') + transaction_id = box.get('transactionId', 'unknown') + box_url = f"https://ergexplorer.com/boxes#{box_id}" if box_id != 'unknown' else None + tx_url = f"https://ergexplorer.com/transactions#{transaction_id}" if transaction_id != 'unknown' else None + box_link = make_terminal_link(box_url, box_id) if box_url else box_id + tx_link = make_terminal_link(tx_url, transaction_id) if tx_url else transaction_id + logger.warning( + f"Failed to process or refund transaction.\n" + f"- Transaction ID: {tx_link}\n" + f"- Box ID: {box_link}\n" + f"- Refund txID: -1\n" + f"- If this persists, verify the bot's configuration or contact Duckpools support on Discord.\n" + ) + logger.debug(f"Full transaction object: {transaction_to_sign}") + return latest_tx return obj diff --git a/helpers/terminal_link.py b/helpers/terminal_link.py new file mode 100644 index 0000000..a48a872 --- /dev/null +++ b/helpers/terminal_link.py @@ -0,0 +1,8 @@ +def make_terminal_link(url, text=None): + """ + Returns an OSC 8 hyperlink for supported terminals (iTerm2, GNOME Terminal, etc). + If not supported, the text will just display as normal. + """ + if not text: + text = url + return f"\033]8;;{url}\033\\{text}\033]8;;\033\\" \ No newline at end of file diff --git a/token_pools/t_borrow_proxy_susd.py b/token_pools/t_borrow_proxy_susd.py index 55503a9..5007aa3 100644 --- a/token_pools/t_borrow_proxy_susd.py +++ b/token_pools/t_borrow_proxy_susd.py @@ -6,6 +6,7 @@ from helpers.platform_functions import get_dex_box, get_parent_box, get_head_child, get_pool_param_box from helpers.serializer import encode_int_tuple, encode_long, encode_long_pair from logger import set_logger +from helpers.terminal_link import make_terminal_link logger = set_logger(__name__) @@ -143,9 +144,22 @@ def process_borrow_proxy_box(pool, box, latest_tx, fee=TX_FEE): if tx_id != -1: logger.info("Successfully submitted refund transaction with ID: %s", tx_id) else: - logger.warning("Failed to process or refund transaction object: %s Failed Refund txID quoted as: %s", - json.dumps(transaction_to_sign), tx_id) - return latest_tx + box_id = box.get('boxId', 'unknown') + transaction_id = box.get('transactionId', 'unknown') + box_url = f"https://ergexplorer.com/boxes#{box_id}" if box_id != 'unknown' else None + tx_url = f"https://ergexplorer.com/transactions#{transaction_id}" if transaction_id != 'unknown' else None + box_link = make_terminal_link(box_url, box_id) if box_url else box_id + tx_link = make_terminal_link(tx_url, transaction_id) if tx_url else transaction_id + duckpools_link = make_terminal_link("https://www.duckpools.io/", "www.duckpools.io") + logger.warning( + f"Failed to process or refund transaction.\n" + f"\t- Transaction ID: {tx_link}\n" + f"\t- Box ID: {box_link}\n" + f"\t- Refund txID: -1\n" + f"\t- If this persists, verify the bot's configuration or contact Duckpools support on Discord. Visit {duckpools_link}\n" + ) + logger.debug(f"Full transaction object: {transaction_to_sign}") + return latest_tx return obj diff --git a/token_pools/t_lend_proxy_sUsd.py b/token_pools/t_lend_proxy_sUsd.py index 9fff624..ed6fb25 100644 --- a/token_pools/t_lend_proxy_sUsd.py +++ b/token_pools/t_lend_proxy_sUsd.py @@ -6,16 +6,44 @@ from helpers.node_calls import tree_to_address, box_id_to_binary, sign_tx, current_height from helpers.platform_functions import calculate_final_amount, get_pool_param_box from logger import set_logger +from helpers.terminal_link import make_terminal_link logger = set_logger(__name__) def process_lend_proxy_box(pool, box, latest_tx): - if box["assets"][0]["tokenId"] != pool["CURRENCY_ID"]: - return latest_tx + box_id = box.get('boxId', 'unknown') + transaction_id = box.get('transactionId', 'unknown') + box_url = f"https://ergexplorer.com/boxes#{box_id}" if box_id != 'unknown' else None + tx_url = f"https://ergexplorer.com/transactions#{transaction_id}" if transaction_id != 'unknown' else None + box_link = make_terminal_link(box_url, box_id) if box_url else box_id + tx_link = make_terminal_link(tx_url, transaction_id) if tx_url else transaction_id + + if "assets" not in box or not box["assets"]: + duckpools_link = make_terminal_link("https://www.duckpools.io/", "www.duckpools.io") + logger.error( + f"[Lend Proxy SUSD] Box has no assets, the pool wallet needs to be refilled.\n" + f"\t- Transaction ID: {tx_link}\n" + f"\t- Box ID: {box_link}\n" + f"\t- If this persists, verify the bot's configuration or contact Duckpools support on Discord. Visit {duckpools_link}\n" + ) + return None + + try: + if box["assets"][0]["tokenId"] != pool["CURRENCY_ID"]: + return latest_tx + token_amount = box["assets"][0]["amount"] + except (ValueError, TypeError) as e: + duckpools_link = make_terminal_link("https://www.duckpools.io/", "www.duckpools.io") + logger.error( + f"[Lend Proxy SUSD] Invalid asset amount: {e}.\n" + f"\t- Transaction ID: {tx_link}\n" + f"\t- Box ID: {box_link}\n" + f"\t- If this persists, contact Duckpools support on Discord. Visit {duckpools_link}\n" + ) + return None pool_box, borrowed = latest_pool_info(pool, latest_tx) - token_amount = box["assets"][0]["amount"] service_fee = max(calculate_final_amount(token_amount, pool["thresholds"]), 1) assets_to_give = token_amount - service_fee held_tokens = int(pool_box["assets"][1]["amount"]) @@ -129,10 +157,21 @@ def process_lend_proxy_box(pool, box, latest_tx): if tx_id != -1: logger.info("Successfully submitted refund transaction with ID: %s", tx_id) else: - logger.warning("Failed to process or refund transaction object: %s Failed Refund txID quoted as: %s", - json.dumps(transaction_to_sign), tx_id) - - return latest_tx + box_id = box.get('boxId', 'unknown') + transaction_id = box.get('transactionId', 'unknown') + box_url = f"https://ergexplorer.com/boxes#{box_id}" if box_id != 'unknown' else None + tx_url = f"https://ergexplorer.com/transactions#{transaction_id}" if transaction_id != 'unknown' else None + box_link = make_terminal_link(box_url, box_id) if box_url else box_id + tx_link = make_terminal_link(tx_url, transaction_id) if tx_url else transaction_id + logger.warning( + f"Failed to process or refund transaction.\n" + f"- Transaction ID: {tx_link}\n" + f"- Box ID: {box_link}\n" + f"- Refund txID: -1\n" + f"- If this persists, verify the bot's configuration or contact Duckpools support on Discord.\n" + ) + logger.debug(f"Full transaction object: {transaction_to_sign}") + return latest_tx return obj diff --git a/token_pools/t_repay_proxy_susd.py b/token_pools/t_repay_proxy_susd.py index a9b213f..8f2a515 100644 --- a/token_pools/t_repay_proxy_susd.py +++ b/token_pools/t_repay_proxy_susd.py @@ -7,6 +7,7 @@ from helpers.platform_functions import get_parent_box, get_head_child, get_children_boxes, get_base_child, \ get_interest_box from logger import set_logger +from helpers.terminal_link import make_terminal_link logger = set_logger(__name__) @@ -40,8 +41,22 @@ def refund_repay_proxy_box(box): if tx_id != -1: logger.info("Successfully submitted refund transaction with ID: %s", tx_id) else: - logger.warning("Failed to process or refund transaction object: %s Failed Refund txID quoted as: %s", - json.dumps(transaction_to_sign), tx_id) + box_id = box.get('boxId', 'unknown') + transaction_id = box.get('transactionId', 'unknown') + box_url = f"https://ergexplorer.com/boxes#{box_id}" if box_id != 'unknown' else None + tx_url = f"https://ergexplorer.com/transactions#{transaction_id}" if transaction_id != 'unknown' else None + box_link = make_terminal_link(box_url, box_id) if box_url else box_id + tx_link = make_terminal_link(tx_url, transaction_id) if tx_url else transaction_id + duckpools_link = make_terminal_link("https://www.duckpools.io/", "www.duckpools.io") + logger.warning( + f"Failed to process or refund transaction.\n" + f"\t- Transaction ID: {tx_link}\n" + f"\t- Box ID: {box_link}\n" + f"\t- Refund txID: -1\n" + f"\t- If this persists, verify the bot's configuration or contact Duckpools support on Discord. Visit {duckpools_link}\n" + ) + logger.debug(f"Full transaction object: {transaction_to_sign}") + return latest_tx def process_repay_proxy_box(pool, box, empty): diff --git a/token_pools/t_repay_to_pool_susd.py b/token_pools/t_repay_to_pool_susd.py index 2de5cda..09a8bd5 100644 --- a/token_pools/t_repay_to_pool_susd.py +++ b/token_pools/t_repay_to_pool_susd.py @@ -4,15 +4,42 @@ from helpers.job_helpers import latest_pool_info, job_processor from helpers.node_calls import box_id_to_binary, sign_tx from logger import set_logger +from helpers.terminal_link import make_terminal_link logger = set_logger(__name__) def process_repay_to_pool_box(pool, box, latest_tx): pool_box, borrowed = latest_pool_info(pool, latest_tx) + box_id = box.get('boxId', 'unknown') + transaction_id = box.get('transactionId', 'unknown') + box_url = f"https://ergexplorer.com/boxes#{box_id}" if box_id != 'unknown' else None + tx_url = f"https://ergexplorer.com/transactions#{transaction_id}" if transaction_id != 'unknown' else None + box_link = make_terminal_link(box_url, box_id) if box_url else box_id + tx_link = make_terminal_link(tx_url, transaction_id) if tx_url else transaction_id - assets_to_give = box["assets"][1]["amount"] - final_borrowed = borrowed - int(box["assets"][0]["amount"]) + if "assets" not in box or len(box["assets"]) < 2: + duckpools_link = make_terminal_link("https://www.duckpools.io/", "www.duckpools.io") + logger.error( + f"[Repay to Pool SUSD] Box has no assets, the pool wallet needs to be refilled.\n" + f"\t- Transaction ID: {tx_link}\n" + f"\t- Box ID: {box_link}\n" + f"\t- If this persists, verify the bot's configuration or contact Duckpools support on Discord. Visit {duckpools_link}\n" + ) + return None + + try: + assets_to_give = box["assets"][1]["amount"] + final_borrowed = borrowed - int(box["assets"][0]["amount"]) + except (ValueError, TypeError) as e: + duckpools_link = make_terminal_link("https://www.duckpools.io/", "www.duckpools.io") + logger.error( + f"[Repay to Pool SUSD] Invalid asset amount: {e}.\n" + f"\t- Transaction ID: {tx_link}\n" + f"\t- Box ID: {box_link}\n" + f"\t- If this persists, contact Duckpools support on Discord. Visit {duckpools_link}\n" + ) + return None transaction_to_sign = \ { diff --git a/token_pools/t_withdraw_proxy_sigusd.py b/token_pools/t_withdraw_proxy_sigusd.py index 424b6ae..b3e18cd 100644 --- a/token_pools/t_withdraw_proxy_sigusd.py +++ b/token_pools/t_withdraw_proxy_sigusd.py @@ -6,18 +6,46 @@ from helpers.node_calls import tree_to_address, box_id_to_binary, sign_tx, current_height from helpers.platform_functions import calculate_service_fee, get_pool_param_box from logger import set_logger +from helpers.terminal_link import make_terminal_link logger = set_logger(__name__) def process_withdraw_proxy_box(pool, box, latest_tx): - if box["assets"][0]["tokenId"] != pool["LEND_TOKEN"]: - return latest_tx + box_id = box.get('boxId', 'unknown') + transaction_id = box.get('transactionId', 'unknown') + box_url = f"https://ergexplorer.com/boxes#{box_id}" if box_id != 'unknown' else None + tx_url = f"https://ergexplorer.com/transactions#{transaction_id}" if transaction_id != 'unknown' else None + box_link = make_terminal_link(box_url, box_id) if box_url else box_id + tx_link = make_terminal_link(tx_url, transaction_id) if tx_url else transaction_id + + if "assets" not in box or not box["assets"]: + duckpools_link = make_terminal_link("https://www.duckpools.io/", "www.duckpools.io") + logger.error( + f"[Withdraw Proxy SUSD] Box has no assets, the pool wallet needs to be refilled.\n" + f"\t- Transaction ID: {tx_link}\n" + f"\t- Box ID: {box_link}\n" + f"\t- If this persists, verify the bot's configuration or contact Duckpools support on Discord. Visit {duckpools_link}\n" + ) + return None + + try: + if box["assets"][0]["tokenId"] != pool["LEND_TOKEN"]: + return latest_tx + user_gives = box["assets"][0]["amount"] + except (ValueError, TypeError) as e: + duckpools_link = make_terminal_link("https://www.duckpools.io/", "www.duckpools.io") + logger.error( + f"[Withdraw Proxy SUSD] Invalid asset amount: {e}.\n" + f"\t- Transaction ID: {tx_link}\n" + f"\t- Box ID: {box_link}\n" + f"\t- If this persists, contact Duckpools support on Discord. Visit {duckpools_link}\n" + ) + return None pool_box, borrowed = latest_pool_info(pool, latest_tx) held_erg0 = pool_box["assets"][3]["amount"] held_tokens = int(pool_box["assets"][1]["amount"]) - user_gives = box["assets"][0]["amount"] circulating_tokens = int(9000000000000010 - held_tokens) final_circulating = circulating_tokens - user_gives held_erg1 = ceil(final_circulating * (held_erg0 + borrowed) / circulating_tokens - borrowed) + 1 @@ -128,9 +156,21 @@ def process_withdraw_proxy_box(pool, box, latest_tx): if tx_id != -1: logger.info("Successfully submitted refund transaction with ID: %s", tx_id) else: - logger.warning("Failed to process or refund transaction object: %s Failed Refund txID quoted as: %s", - json.dumps(transaction_to_sign), tx_id) - return latest_tx + box_id = box.get('boxId', 'unknown') + transaction_id = box.get('transactionId', 'unknown') + box_url = f"https://ergexplorer.com/boxes#{box_id}" if box_id != 'unknown' else None + tx_url = f"https://ergexplorer.com/transactions#{transaction_id}" if transaction_id != 'unknown' else None + box_link = make_terminal_link(box_url, box_id) if box_url else box_id + tx_link = make_terminal_link(tx_url, transaction_id) if tx_url else transaction_id + logger.warning( + f"Failed to process or refund transaction.\n" + f"- Transaction ID: {tx_link}\n" + f"- Box ID: {box_link}\n" + f"- Refund txID: -1\n" + f"- If this persists, verify the bot's configuration or contact Duckpools support on Discord.\n" + ) + logger.debug(f"Full transaction object: {transaction_to_sign}") + return latest_tx return obj