Skip to content

nedsion/base-swap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

18 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Crypto Swap Manager - Uniswap V2/V3 Bot

A Python-based desktop application for automated cryptocurrency trading on Uniswap V2/V3 using the Base Chain network. This bot provides a GUI interface for monitoring and executing token swaps with configurable trading strategies.

Features

  • πŸ”„ Automated Swap Execution: Buy and sell tokens automatically based on pool activity
  • πŸ“Š Real-time Pool Monitoring: Track multiple token pools simultaneously
  • πŸ’Ό Multi-Wallet Support: Manage multiple wallets with private key integration
  • πŸ“ˆ Transaction History: Detailed logging and tracking of all trades
  • 🎯 Follow Pool Strategy: Mirror trading activity from specific pools
  • ⏱️ Configurable Timing: Set custom sleep intervals between transactions
  • πŸ–₯️ PyQt5 GUI: User-friendly desktop interface with real-time updates

Supported Protocols

  • Uniswap V2 (Primary)
  • Uniswap V3 (Router integration)
  • Base Chain Network (Mainnet)

Project Structure

β”œβ”€β”€ main.py                        # Main GUI application
β”œβ”€β”€ worker.py                      # Trading bot worker threads
β”œβ”€β”€ helper.py                      # Web3 and utility functions
β”œβ”€β”€ uniswap_api.py                # Uniswap API interactions
β”œβ”€β”€ parsec_finance.py             # Parsec Finance API integration
β”œβ”€β”€ log_updater.py                # GUI update handlers
β”œβ”€β”€ config.py                      # Configuration and contract addresses
β”œβ”€β”€ config.json                    # User configuration (Telegram, ETH deposit)
β”œβ”€β”€ requirements.txt               # Python dependencies
β”œβ”€β”€ private_key.txt               # Private keys (DO NOT COMMIT)
β”œβ”€β”€ brett__abi.json               # BRETT token ABI
β”œβ”€β”€ swap__abi.json                # Swap contract ABI
β”œβ”€β”€ uniswapv3_router__abi.json    # Uniswap V3 Router ABI
β”œβ”€β”€ data/                          # Transaction history logs
β”œβ”€β”€ debug/                         # Debug information
└── output/                        # Output files

Installation

Prerequisites

  • Python 3.8 or higher
  • Windows OS (configured for PowerShell)
  • Base Chain RPC access
  • Private key(s) for wallets you want to use

Setup

  1. Clone the repository
git clone <repository-url>
cd "fvck swap"
  1. Install dependencies
pip install -r requirements.txt
  1. Configure the application

Edit config.json:

{
    "BOT_TOKEN": "YOUR_TELEGRAM_BOT_TOKEN",
    "GROUP_ID": "YOUR_TELEGRAM_GROUP_ID",
    "ETH_DEPOSIT": 0
}
  1. Add your private keys

Create or edit private_key.txt and add your wallet private keys (one per line):

YOUR_PRIVATE_KEY_HERE

⚠️ SECURITY WARNING: Never commit private_key.txt or share your private keys!

Configuration

Contract Addresses (Base Chain)

The following contracts are pre-configured in config.py:

  • Swap Contract: 0x6BDED42c6DA8FBf0d2bA55B2fa120C5e0c8D7891
  • Uniswap V3 Router: 0x2626664c2603336E57B271c5C0b26F421741e481
  • Uniswap V2 Router: 0x4752ba5dbc23f44d87826276bf6fd6b1c372ad24
  • Uniswap V2 Factory: 0x8909Dc15e40173Ff4699343b6eB8132c65e18eC6
  • WETH: 0x4200000000000000000000000000000000000006
  • BRETT Token: 0x532f27101965dd16442E59d40670FaF5eBB142E4

Base Chain Provider

Default RPC: https://mainnet.base.org/

Usage

Starting the Application

python main.py

GUI Features

  1. Device Table: Monitor wallet addresses, balances, and transaction counts
  2. Pool Table: Track token pools with buy/sell volume and last transaction details
  3. Control Buttons:
    • Import CSV with wallet/pool configurations
    • Start/Stop trading operations
    • Real-time status updates

Trading Modes

  • Buy Mode: Automatically purchase tokens when conditions are met
  • Sell Mode: Automatically sell tokens based on strategy
  • Follow Pool Mode: Mirror transactions from a specified pool

API Integrations

Uniswap API

  • Fetches transaction history from Uniswap interface
  • Calculates total buy/sell volumes
  • Tracks recent swap activities

Parsec Finance

  • Additional market data and analytics
  • Token price tracking
  • Volume analysis

BaseScan API

  • Contract ABI retrieval
  • Transaction verification
  • Block explorer integration

Data Management

Transaction Logs

All transactions are automatically saved in the data/ folder with the naming convention:

{wallet_address}_{action}_{timestamp}.json

CSV Import Format

Import wallet configurations using CSV with columns:

  • Wallet addresses
  • Pool addresses
  • Token contracts
  • Trading parameters

Dependencies

Key packages:

  • web3==6.17.1 - Ethereum blockchain interaction
  • PyQt5 - GUI framework
  • pandas - Data manipulation
  • requests - HTTP requests
  • eth-account==0.11.2 - Account management
  • aiohttp==3.9.4 - Async HTTP client

See requirements.txt for complete list.

Security Best Practices

  1. βœ… Never commit private_key.txt to version control
  2. βœ… Use environment variables for sensitive data
  3. βœ… Keep your private keys encrypted when not in use
  4. βœ… Test with small amounts first
  5. βœ… Monitor transactions closely
  6. βœ… Use separate wallets for testing

Troubleshooting

Common Issues

Connection Error

  • Verify Base Chain RPC is accessible
  • Check your internet connection
  • Try alternative RPC endpoints

Transaction Failed

  • Ensure sufficient ETH balance for gas fees
  • Verify token contract address
  • Check slippage settings

GUI Not Responding

  • Check that all dependencies are installed
  • Verify PyQt5 is properly configured
  • Review logs in console output

Development

Flag System

The application uses .flag file to control bot operations:

  • 0 = Stopped
  • 1 = Running

Worker Threads

Each wallet operates in its own worker thread with:

  • Independent transaction monitoring
  • Configurable sleep intervals
  • Automatic error recovery

Disclaimer

⚠️ IMPORTANT: This software is for educational purposes only.

  • Cryptocurrency trading carries significant risk
  • Use at your own risk
  • No guarantees of profit
  • The developers are not responsible for any financial losses
  • Always test with small amounts first
  • Understand the risks before trading

License

This project is provided as-is without any warranty. Use at your own risk.

Support

For issues and questions:

  • Check the debug logs in the debug/ folder
  • Review transaction history in data/ folder
  • Verify configuration in config.json

Remember: Never share your private keys or commit them to version control!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages