Skip to content

leyten/liquid

Repository files navigation

PumpFun Buyback & Liquidity Bot

Automated TypeScript script that buys back PumpFun tokens and adds 50/50 liquidity to the pool. Now with Telegram bot support for multi-user access!

Features

  • 🤖 Telegram Bot - Allow multiple users to run the script via Telegram
  • 🔄 Automated Cycles - Automatically collects creator fees at the start of each cycle
  • 💰 Smart Allocation - Uses 50% of SOL balance for buyback and liquidity cycles
  • 💧 Liquidity Management - Adds 50/50 liquidity (tokens + SOL) to the pool
  • 🔥 LP Token Burning - Automatically burns LP tokens after liquidity deposit
  • 🛡️ Error Handling - Robust retry logic and error handling
  • ⚙️ Multi-User Support - Each user can configure their own coin

Installation

npm install

Configuration

  1. Copy .env.example to .env:
cp .env.example .env
  1. Edit .env and add your credentials:
RPC_ENDPOINT=https://api.mainnet-beta.solana.com
PRIVATE_KEY=your_private_key_here
MINT_ADDRESS=your_token_mint_address_here
SLIPPAGE=0.15

Optional Configuration:

  • SLIPPAGE - Slippage tolerance (default: 0.15 = 15%). Increase for volatile tokens (e.g., 0.20 for 20%)
  • LP_TOKEN_MINT - LP token mint address (default: 5DXmqgrTivkdwg43UMU1YSV5WAvVmgvjBxsVP1aLV4Dk)
  • MIN_BALANCE_SOL - Minimum SOL balance to trigger auto-run cycle (default: 0.5 SOL)
  • CHECK_INTERVAL_MS - Interval between balance checks in milliseconds (default: 60000 = 60 seconds)
  • AUTO_RUN - Enable/disable auto-run mode (default: true). Set to false to run once and exit

Private Key Format

The private key can be provided in two formats:

  • JSON array: [1,2,3,4,...] (64 numbers)
  • Base58 string: Your base58 encoded private key

Usage

Telegram Bot Mode (Recommended)

  1. Get a Telegram Bot Token from @BotFather
  2. Create a .env file:
    TELEGRAM_BOT_TOKEN=your-bot-token-here
    RPC_ENDPOINT=https://api.mainnet-beta.solana.com
  3. Build and start:
    npm run build
    npm start
  4. Open Telegram, find your bot, and send /start
  5. Use /setup to configure your coin (private key & mint address)
  6. Use /run to execute a cycle or /start_auto for automatic cycles

Bot Commands:

  • /start - Welcome message and help
  • /setup - Configure your coin (private key & mint address)
  • /run - Execute a single liquidity cycle
  • /start_auto - Start automatic cycles (runs every 2 minutes)
  • /stop - Stop automatic cycles
  • /status - Check your current configuration
  • /help - Show help message

Standalone Mode (Original)

For running with environment variables (single coin):

Development (with ts-node)

npm run dev

Production (build first)

npm run build
npm start

How It Works

Auto-Run Mode (Default)

The script runs continuously, executing cycles at regular intervals:

  1. Cycle Execution: Runs the full liquidity cycle every 60 seconds (configurable)
  2. Fee Collection: At the start of each cycle, collects any available creator fees
  3. Balance Check: After fee collection, checks if sufficient balance exists
  4. Conditional Execution: If balance is sufficient, proceeds with buyback and liquidity
  5. Repeat: Waits for next check interval and repeats

Single Run Mode

Set AUTO_RUN=false in .env to run once and exit.

Liquidity Cycle Steps

  1. Collect Creator Fees: Collects any available creator fees from the pool
  2. Balance Check: Checks the SOL balance (after fee collection)
  3. Allocation:
    • 49% SOL for token swap
    • 49% SOL for liquidity
    • 2% SOL reserved for fees
  4. Token Swap: Swaps 49% of SOL for tokens using PumpFun swap
  5. Liquidity Deposit: Deposits tokens + remaining SOL (50/50) into the liquidity pool
  6. LP Token Burn: Burns all received LP tokens by sending them to the burn address

Important Notes

  • ⚠️ Never commit your .env file - it contains sensitive private keys
  • The script uses 15% slippage tolerance by default (configurable)
  • Auto-run mode runs continuously - use Ctrl+C to stop
  • Ensure you have sufficient SOL for transactions (minimum 0.5 SOL recommended for auto-run)
  • All transactions are confirmed before proceeding to next step
  • The script will automatically retry on errors during monitoring

Deployment

For running the bot on a server 24/7, see DEPLOYMENT.md for detailed instructions.

Quick Start with PM2:

npm install -g pm2
npm run build
pm2 start dist/index.js --name pumpfun-bot
pm2 save
pm2 startup

Dependencies

  • @pump-fun/pump-swap-sdk - PumpFun swap SDK
  • @pump-fun/pump-sdk - PumpFun SDK (for creator fee collection)
  • @solana/web3.js - Solana Web3 library
  • @solana/spl-token - SPL Token library
  • node-telegram-bot-api - Telegram Bot API
  • dotenv - Environment variable management

Security Notes

⚠️ Important Security Information:

  • Private keys are stored in memory only and cleared when the bot restarts
  • Never share your bot token or private keys
  • Each user's data is isolated in memory
  • For production use, consider adding encryption for stored private keys

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors