Merge branch 'master' into mutable

Signed-off-by: Filip Dunđer <fdundjer@outlook.com>
This commit is contained in:
Filip Dunđer
2024-04-21 18:29:25 +02:00
committed by GitHub
5 changed files with 39 additions and 24 deletions

View File

@ -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.

12
bot.ts
View File

@ -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,12 +131,14 @@ export class Bot {
]);
const poolKeys: LiquidityPoolKeysV4 = createPoolKeys(accountId, poolState, market);
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;
}
}
for (let i = 0; i < this.config.maxBuyRetries; i++) {
try {
@ -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;

View File

@ -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`);
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} 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 -------');

4
package-lock.json generated
View File

@ -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",

View File

@ -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"