Automated liquidity management bot for Shadow.so with Telegram interface and MetaMask integration.
- β Continuous Pool Monitoring - Automatically tracks multiple liquidity pools
- β Smart Rebalancing - Detects approaching out-of-range conditions
- β Complete Workflow - Remove β Rebalance β Re-add liquidity automatically
- β MetaMask Integration - Seamless transaction confirmations
- β Real-time Notifications - Telegram alerts for all activities
Connection (Choose ONE):
/connect [password] [word1] ... [word12]β First-time setup with 12-word seed phrase/connect_password [password]β Quick reconnect (only password needed after first setup)
Disconnection:
/disconnectβ Close browser (keeps credentials & data for fast reconnect)/disconnect clearβ Clear EVERYTHING (requires seed phrase next time)
Pool Management:
/add [pool_link] [range_type] [token] [amount]β Add pool for monitoring/remove [link]β Remove liquidity (100% withdrawal)/listβ List all monitored pools with status/statusβ Force status check and update
Settings:
/set_threshold [value]β Set rebalance trigger threshold (default: 90%)/set_balance_tolerance [value]β Set balance tolerance (default: 2%)
Other:
/helpβ Show available commands
π‘ TIP: After first setup with /connect, use /connect_password for faster reconnection without entering your 12-word seed phrase!
- β User Whitelisting - Only authorized users can control the bot
- β Admin Notifications - Real-time alerts for errors and activities
- β Comprehensive Logging - Detailed logs with rotation
- β Error Recovery - Automatic browser restart and error handling
- Python 3.10+ (recommended 3.11)
- Google Chrome or Microsoft Edge installed
- Telegram Bot Token from @BotFather
- MetaMask wallet with seed phrase and password
When you first use the bot, you need to provide your MetaMask credentials:
/connect your_password word1 word2 word3 word4 word5 word6 word7 word8 word9 word10 word11 word12
β
The bot stores your credentials securely in the user_profile directory
β
MetaMask extension data is saved in the browser profile
β
You won't need to enter the 12-word seed phrase again!
For all future connections, simply use:
/connect_password your_password
This quick command:
- β Uses your stored credentials
- β Opens MetaMask with just your password
- β No need to type 12 words every time!
Use /connect [password] [12 words] when:
- π First time setting up the bot
- π After using
/disconnect clear(clears everything) - ποΈ If you deleted the
user_profiledirectory
Use /connect_password [password] when:
- β¨ MetaMask is already set up in browser profile
- π After a normal
/disconnect(keeps credentials) - β‘ You want to reconnect quickly
Normal Disconnect (Recommended):
/disconnect
- Closes the browser
- β Keeps your credentials saved
- β Keeps MetaMask profile intact
- β
Use
/connect_passwordto reconnect quickly
Full Reset:
/disconnect clear
- β Clears ALL data including credentials
- β Removes MetaMask profile
β οΈ Next connection will require full 12-word seed phrase again
-
Clone and setup:
git clone <repository> cd shadow-liquidity-bot python -m venv .venv .\.venv\Scripts\Activate.ps1 pip install -r requirements.txt
-
Install Playwright browsers:
playwright install
-
Configure environment:
copy .env.example .env
Edit
.envand set:TELEGRAM_BOT_TOKEN=your_bot_token_here ALLOWED_USER_IDS=your_telegram_user_id ADMIN_CHAT_IDS=your_telegram_user_id ENABLE_NOTIFICATIONS=true MONITOR_INTERVAL=60
-
Run the bot:
python main.py
TELEGRAM_BOT_TOKEN- Your Telegram bot tokenALLOWED_USER_IDS- Comma-separated list of authorized user IDsADMIN_CHAT_IDS- User IDs to receive notifications
MONITOR_INTERVAL=60- Pool monitoring frequency (seconds)REBALANCE_THRESHOLD=90- Trigger threshold percentageBALANCE_TOLERANCE=2- Token balance tolerance percentageHEADLESS=false- Run browser in headless modeENABLE_NOTIFICATIONS=true- Enable Telegram notifications
MAX_BROWSER_RETRIES=3- Browser restart attemptsTRANSACTION_TIMEOUT=120- Transaction timeout (seconds)MAX_REBALANCE_RETRIES=2- Rebalancing retry attempts
- Continuously checks pool status every 60 seconds
- Detects when price approaches range boundaries
- Monitors multiple pools simultaneously
When a pool approaches the threshold:
- Remove Liquidity - Withdraws 100% from the pool
- Check Balances - Analyzes token balance ratios
- Rebalance Tokens - Swaps tokens if needed to balance values
- Re-add Liquidity - Deposits balanced liquidity back to pool
- π Rebalancing started
- β Rebalancing completed
- β Errors and failures
- π Monitoring summaries
# Using batch file (Windows)
build.bat
# Or manually
python build_exe.pydist/ShadowLiquidityBot.exe- Standalone executable- No Python installation required on target machine
- Copy
.envfile alongside the executable - Move
metamask_extensiondirectory todist
logs/shadow_bot.log- Main application loglogs/errors.log- Error-specific loglogs/rebalancing.log- Rebalancing activity log
- Telegram notifications for all activities
- Console output with timestamps
- Structured logging with rotation
- Bot not responding: Check
TELEGRAM_BOT_TOKEN - Browser launch failed: Run
playwright install - MetaMask connection issues: Verify extension path
- Pool monitoring not working: Check credentials with
/connect
Set environment variables:
HEADLESS=false
LOG_LEVEL=DEBUG- Credential Storage - Encrypted local storage
- User Whitelisting - Only authorized users
- Admin Notifications - Real-time security alerts
- Error Handling - Graceful failure recovery
- Efficient Monitoring - 60-second intervals
- Resource Management - Browser process optimization
- Error Recovery - Automatic restart capabilities
- Scalable - Handles multiple pools simultaneously
The bot includes:
- Automatic error recovery
- Browser restart on failures
- Comprehensive logging
- Real-time status monitoring
For ongoing support and updates, monitor the logs and Telegram notifications.