From 3c89ce538970a632ee117c94b0f691c871850f40 Mon Sep 17 00:00:00 2001 From: Filip Dunder Date: Sat, 27 Apr 2024 18:39:36 +0200 Subject: [PATCH] scope filters for each token --- bot.ts | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/bot.ts b/bot.ts index 21df56f..1ac613f 100644 --- a/bot.ts +++ b/bot.ts @@ -54,8 +54,6 @@ export interface BotConfig { } export class Bot { - private readonly poolFilters: PoolFilters; - // snipe list private readonly snipeListCache?: SnipeListCache; @@ -75,13 +73,7 @@ export class Bot { ) { this.isWarp = txExecutor instanceof WarpTransactionExecutor; this.isJito = txExecutor instanceof JitoTransactionExecutor; - this.semaphore = new Semaphore(config.maxTokensAtTheTime); - this.poolFilters = new PoolFilters(connection, { - quoteToken: this.config.quoteToken, - minPoolSize: this.config.minPoolSize, - maxPoolSize: this.config.maxPoolSize, - }); if (this.config.useSnipeList) { this.snipeListCache = new SnipeListCache(); @@ -357,13 +349,19 @@ export class Bot { return true; } + const filters = new PoolFilters(this.connection, { + quoteToken: this.config.quoteToken, + minPoolSize: this.config.minPoolSize, + maxPoolSize: this.config.maxPoolSize, + }); + const timesToCheck = this.config.filterCheckDuration / this.config.filterCheckInterval; let timesChecked = 0; let matchCount = 0; do { try { - const shouldBuy = await this.poolFilters.execute(poolKeys); + const shouldBuy = await filters.execute(poolKeys); if (shouldBuy) { matchCount++;