mirror of
https://github.com/chainstacklabs/pumpfun-bonkfun-bot.git
synced 2026-08-13 15:28:05 +00:00
docs(cursor): add uv rules, formatting
This commit is contained in:
@@ -14,6 +14,7 @@ logger = get_logger(__name__)
|
||||
|
||||
class AccountCleanupManager:
|
||||
"""Handles safe cleanup of token accounts (ATA) after trading sessions."""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
client: SolanaClient,
|
||||
@@ -60,7 +61,9 @@ class AccountCleanupManager:
|
||||
instructions = []
|
||||
|
||||
if balance > 0 and self.close_with_force_burn:
|
||||
logger.info(f"Burning {balance} tokens from ATA {ata} (mint: {mint})...")
|
||||
logger.info(
|
||||
f"Burning {balance} tokens from ATA {ata} (mint: {mint})..."
|
||||
)
|
||||
burn_ix = burn(
|
||||
BurnParams(
|
||||
account=ata,
|
||||
|
||||
+35
-9
@@ -17,26 +17,52 @@ def should_cleanup_post_session(cleanup_mode) -> bool:
|
||||
|
||||
|
||||
async def handle_cleanup_after_failure(
|
||||
client, wallet, mint, priority_fee_manager, cleanup_mode, cleanup_with_prior_fee, force_burn
|
||||
):
|
||||
client,
|
||||
wallet,
|
||||
mint,
|
||||
priority_fee_manager,
|
||||
cleanup_mode,
|
||||
cleanup_with_prior_fee,
|
||||
force_burn,
|
||||
):
|
||||
if should_cleanup_after_failure(cleanup_mode):
|
||||
logger.info("[Cleanup] Triggered by failed buy transaction.")
|
||||
manager = AccountCleanupManager(client, wallet, priority_fee_manager, cleanup_with_prior_fee, force_burn)
|
||||
manager = AccountCleanupManager(
|
||||
client, wallet, priority_fee_manager, cleanup_with_prior_fee, force_burn
|
||||
)
|
||||
await manager.cleanup_ata(mint)
|
||||
|
||||
|
||||
async def handle_cleanup_after_sell(
|
||||
client, wallet, mint, priority_fee_manager, cleanup_mode, cleanup_with_prior_fee, force_burn
|
||||
):
|
||||
client,
|
||||
wallet,
|
||||
mint,
|
||||
priority_fee_manager,
|
||||
cleanup_mode,
|
||||
cleanup_with_prior_fee,
|
||||
force_burn,
|
||||
):
|
||||
if should_cleanup_after_sell(cleanup_mode):
|
||||
logger.info("[Cleanup] Triggered after token sell.")
|
||||
manager = AccountCleanupManager(client, wallet, priority_fee_manager, cleanup_with_prior_fee, force_burn)
|
||||
manager = AccountCleanupManager(
|
||||
client, wallet, priority_fee_manager, cleanup_with_prior_fee, force_burn
|
||||
)
|
||||
await manager.cleanup_ata(mint)
|
||||
|
||||
|
||||
async def handle_cleanup_post_session(
|
||||
client, wallet, mints, priority_fee_manager, cleanup_mode, cleanup_with_prior_fee, force_burn
|
||||
):
|
||||
client,
|
||||
wallet,
|
||||
mints,
|
||||
priority_fee_manager,
|
||||
cleanup_mode,
|
||||
cleanup_with_prior_fee,
|
||||
force_burn,
|
||||
):
|
||||
if should_cleanup_post_session(cleanup_mode):
|
||||
logger.info("[Cleanup] Triggered post trading session.")
|
||||
manager = AccountCleanupManager(client, wallet, priority_fee_manager, cleanup_with_prior_fee, force_burn)
|
||||
manager = AccountCleanupManager(
|
||||
client, wallet, priority_fee_manager, cleanup_with_prior_fee, force_burn
|
||||
)
|
||||
for mint in mints:
|
||||
await manager.cleanup_ata(mint)
|
||||
|
||||
Reference in New Issue
Block a user