Bladeren bron

Merge branch 'master' into mutable

Signed-off-by: Filip Dunđer <fdundjer@outlook.com>
Filip Dunđer 1 jaar geleden
bovenliggende
commit
c9dc532a29
5 gewijzigde bestanden met toevoegingen van 39 en 24 verwijderingen
  1. 9 3
      README.md
  2. 11 9
      bot.ts
  3. 16 9
      index.ts
  4. 2 2
      package-lock.json
  5. 1 1
      package.json

+ 9 - 3
README.md

@@ -67,6 +67,15 @@ You should see the following output:
   - Stop loss is calculated based on quote mint.
 - `SELL_SLIPPAGE` - Slippage %.
 
+#### Snipe list
+- `USE_SNIPE_LIST` - Set to `true` to enable buying only tokens listed in `snipe-list.txt`.
+  - Pool must not exist before the bot starts.
+  - If token can be traded before bot starts nothing will happen. Bot will not buy the token.
+- `SNIPE_LIST_REFRESH_INTERVAL` - Interval in milliseconds to refresh the snipe list.
+  - You can update snipe list while bot is running. It will pickup the new changes each time it does refresh.
+
+Note: When using snipe list filters below will be disabled.
+
 #### Filters
 - `FILTER_CHECK_INTERVAL` - Interval in milliseconds for checking if pool match the filters.
   - Set to zero to disable filters.
@@ -75,9 +84,6 @@ You should see the following output:
   - Set to zero to disable filters.
 - `CONSECUTIVE_FILTER_MATCHES` - How many times in a row pool needs to match the filters.
   - This is useful because when pool is burned (and rugged), other filters may not report the same behavior. eg. pool size may still have old value
-- `USE_SNIPE_LIST` - Set to `true` to enable buying only tokens listed in `snipe-list.txt`.
-  - Pool must not exist before the script starts.
-- `SNIPE_LIST_REFRESH_INTERVAL` - Interval in milliseconds to refresh the snipe list.
 - `CHECK_IF_MUTABLE` - Set to `true` to buy tokens only if their metadata are not mutable.
 - `CHECK_IF_MINT_IS_RENOUNCED` - Set to `true` to buy tokens only if their mint is renounced.
 - `CHECK_IF_FREEZABLE` - Set to `true` to buy tokens only if they are not freezable.

+ 11 - 9
bot.ts

@@ -100,7 +100,7 @@ export class Bot {
   }
 
   public async buy(accountId: PublicKey, poolState: LiquidityStateV4) {
-    logger.trace({ mint: poolState.baseMint }, `Processing buy...`);
+    logger.trace({ mint: poolState.baseMint }, `Processing new pool...`);
 
     if (this.config.useSnipeList && !this.snipeListCache?.isInList(poolState.baseMint.toString())) {
       logger.debug({ mint: poolState.baseMint.toString() }, `Skipping buy because token is not in a snipe list`);
@@ -131,11 +131,13 @@ export class Bot {
       ]);
       const poolKeys: LiquidityPoolKeysV4 = createPoolKeys(accountId, poolState, market);
 
-      const match = await this.filterMatch(poolKeys);
+      if (!this.config.useSnipeList) {
+        const match = await this.filterMatch(poolKeys);
 
-      if (!match) {
-        logger.trace({ mint: poolKeys.baseMint.toString() }, `Skipping buy because pool doesn't match filters`);
-        return;
+        if (!match) {
+          logger.trace({ mint: poolKeys.baseMint.toString() }, `Skipping buy because pool doesn't match filters`);
+          return;
+        }
       }
 
       for (let i = 0; i < this.config.maxBuyRetries; i++) {
@@ -170,7 +172,7 @@ export class Bot {
             break;
           }
 
-          logger.debug(
+          logger.info(
             {
               mint: poolState.baseMint.toString(),
               signature: result.signature,
@@ -197,7 +199,7 @@ export class Bot {
     }
 
     try {
-      logger.trace({ mint: rawAccount.mint }, `Processing sell...`);
+      logger.trace({ mint: rawAccount.mint }, `Processing new token...`);
 
       const poolData = await this.poolStorage.get(rawAccount.mint.toString());
 
@@ -269,7 +271,7 @@ export class Bot {
         }
       }
     } catch (error) {
-      logger.debug({ mint: rawAccount.mint.toString(), error }, `Failed to sell token`);
+      logger.error({ mint: rawAccount.mint.toString(), error }, `Failed to sell token`);
     } finally {
       if (this.config.oneTokenAtATime) {
         this.sellExecutionCount--;
@@ -351,7 +353,7 @@ export class Bot {
 
   private async filterMatch(poolKeys: LiquidityPoolKeysV4) {
     if (this.config.filterCheckInterval === 0 || this.config.filterCheckDuration === 0) {
-      return;
+      return true;
     }
 
     const timesToCheck = this.config.filterCheckDuration / this.config.filterCheckInterval;

+ 16 - 9
index.ts

@@ -110,17 +110,24 @@ function printDetails(wallet: Keypair, quoteToken: Token, bot: Bot) {
   logger.info(`Take profit: ${botConfig.takeProfit}%`);
   logger.info(`Stop loss: ${botConfig.stopLoss}%`);
 
-  logger.info('- Filters -');
+  logger.info('- Snipe list -');
   logger.info(`Snipe list: ${botConfig.useSnipeList}`);
   logger.info(`Snipe list refresh interval: ${SNIPE_LIST_REFRESH_INTERVAL} ms`);
-  logger.info(`Filter check interval: ${botConfig.filterCheckInterval} ms`);
-  logger.info(`Filter check duration: ${botConfig.filterCheckDuration} ms`);
-  logger.info(`Consecutive filter matches: ${botConfig.consecutiveMatchCount} ms`);
-  logger.info(`Check renounced: ${botConfig.checkRenounced}`);
-  logger.info(`Check freezable: ${botConfig.checkFreezable}`);
-  logger.info(`Check burned: ${botConfig.checkBurned}`);
-  logger.info(`Min pool size: ${botConfig.minPoolSize.toFixed()}`);
-  logger.info(`Max pool size: ${botConfig.maxPoolSize.toFixed()}`);
+
+  if (botConfig.useSnipeList) {
+    logger.info('- Filters -');
+    logger.info(`Filters are disabled when snipe list is on`);
+  } else {
+    logger.info('- Filters -');
+    logger.info(`Filter check interval: ${botConfig.filterCheckInterval} ms`);
+    logger.info(`Filter check duration: ${botConfig.filterCheckDuration} ms`);
+    logger.info(`Consecutive filter matches: ${botConfig.consecutiveMatchCount}`);
+    logger.info(`Check renounced: ${botConfig.checkRenounced}`);
+    logger.info(`Check freezable: ${botConfig.checkFreezable}`);
+    logger.info(`Check burned: ${botConfig.checkBurned}`);
+    logger.info(`Min pool size: ${botConfig.minPoolSize.toFixed()}`);
+    logger.info(`Max pool size: ${botConfig.maxPoolSize.toFixed()}`);
+  }
 
   logger.info('------- CONFIGURATION END -------');
 

+ 2 - 2
package-lock.json

@@ -1,12 +1,12 @@
 {
   "name": "warp-solana-bot",
-  "version": "2.0.0",
+  "version": "2.0.1",
   "lockfileVersion": 3,
   "requires": true,
   "packages": {
     "": {
       "name": "warp-solana-bot",
-      "version": "2.0.0",
+      "version": "2.0.1",
       "dependencies": {
         "@metaplex-foundation/mpl-token-metadata": "^3.2.1",
         "@raydium-io/raydium-sdk": "^1.3.1-beta.47",

+ 1 - 1
package.json

@@ -2,7 +2,7 @@
   "name": "warp-solana-bot",
   "author": "Filip Dundjer",
   "homepage": "https://warp.id",
-  "version": "2.0.0",
+  "version": "2.0.1",
   "scripts": {
     "start": "ts-node index.ts",
     "tsc": "tsc --noEmit"