Skip to content

Commit 26e0a4a

Browse files
committed
initial commit
1 parent 3679d81 commit 26e0a4a

12 files changed

Lines changed: 1501 additions & 1 deletion

File tree

.gitignore

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# Logs
2+
*.log
3+
*.logs
4+
log/
5+
tmp/
6+
*.tmp
7+
.DS_Store # macOS
8+
Thumbs.db # Windows
9+
ehthumbs.db # Windows
10+
.vscode/ # VS Code settings
11+
.idea/ # IntelliJ / PyCharm / Android Studio settings
12+
.project # Eclipse settings
13+
.settings/ # Eclipse settings
14+
.classpath # Eclipse settings
15+
*.iml # IntelliJ project files
16+
.buildpath # Eclipse build path
17+
18+
# OS generated files
19+
.DS_Store
20+
.DS_Store?
21+
._*
22+
.Spotlight-V100
23+
.Trashes
24+
Icon?
25+
ehthumbs.db
26+
Thumbs.db
27+
28+
# Misc
29+
.cache/
30+
.pytest_cache/ # Python pytest cache
31+
__pycache__/ # Python bytecode
32+
*.pyc # Python compiled files
33+
*.ipynb_checkpoints/ # Jupyter Notebook checkpoints
34+
.env # Environment variables
35+
.env.* # Semua file .env*
36+
!.env.example
37+
coverage/ # Python test coverage
38+
htmlcov/ # Python test coverage (HTML)
39+
40+
# Dependencies
41+
node_modules/ # Node.js dependencies
42+
vendor/ # PHP Composer dependencies
43+
44+
# Build artifacts
45+
build/
46+
dist/
47+
target/ # Java Maven/Gradle target
48+
out/ # Java IntelliJ output
49+
50+
# Compressed files
51+
*.zip
52+
*.tar
53+
*.tar.gz
54+
*.rar
55+
56+
# Executables / Binaries
57+
*.exe
58+
*.dll
59+
*.so
60+
*.o
61+
*.out
62+
63+
# Database files
64+
*.db
65+
*.sqlite
66+
*.sqlite3
67+
*.sql
68+
data.db
69+
70+
*.pem
71+
*.key
72+
*.p12
73+
*.jks
74+
*.cer
75+
*.crt
76+
*.csr
77+
*.conf.local
78+
config.ini
79+
80+
*.bak
81+
*.swp # Vim swap files
82+
*~ # Emacs backup files
83+
*.sublime-project
84+
*.sublime-workspace
85+
86+
.env
87+
private_keys.txt
88+
unregistered.txt
89+
proxy.txt
90+
91+
venv/ # Virtual environment
92+
.venv/ # Virtual environment
93+
pip-log.txt
94+
.Python
95+
.tox/

README.md

Lines changed: 139 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,139 @@
1-
# plume-mainnet-interaction
1+
# plumeee Auto B0t - plumeee Airdrop Season 2 on mainnet
2+
An automated trading b0t designed for the plumeee network, with capabilities including token wrapping, swapping, unwrapping, and staking. The bot supports parallel execution using ProcessPoolExecutor, featuring randomized start delays to reduce RPC node load and concurrency issues.
3+
4+
# Prerequisites
5+
- **Python 3.8 or higher**
6+
- **Stable internet connection to access plumeee RPC nodes**
7+
- **A private_key.txt file in the root directory containing your Ethereum private keys (one per line)**
8+
- **A configured .env file containing b0t parameters (sample provided below)**
9+
10+
# Key Features
11+
- Support for multiple private key accounts `[ FREE / PRO VERSION ]`
12+
- Wrap plumee to Wplumee and vice versa `[ FREE / PRO VERSION ]`
13+
- Swap plumee <-> PUSD tokens via multicall `[ FREE / PRO VERSION ]`
14+
- Swap plumee <-> pETH, WETH, USDC, USDT and vice versa `[ PRO VERSION ]`
15+
- Swap plumee or Wplumee <-> nCREDIT, nALPHA, nELIXIR, nBASIS, nPAYFI and vice versa `[ PRO VERSION ]`
16+
- Interaction with Relay.link and Rooster-protocol.xyz `[ FREE / PRO VERSION ]`
17+
- Extended integration with Relay, RoosterProtocol, Ambient, Stargate, Izumi, and more `[ PRO VERSION ]`
18+
- Automated staking on validators selected for optimal rates `[ PRO VERSION ]`
19+
- Manual staking on specific validators `[ FREE / PRO VERSION ]`
20+
- Cross-chain bridging from Ethereum, Arbitrum, Linea, Zero, Zora, Optimism, Binance Smart Chain, and Polygon `[ PRO VERSION ]`
21+
- Bridging back to plumeee Network from ETH, Base, Linea, Optimism `[ PRO VERSION ]`
22+
- Automatic daily spin and auto-use of raffle tickets on portal.plumee.org `[ PRO VERSION ]`
23+
- Robust error handling with automatic retries `[ FREE / PRO VERSION ]`
24+
- Randomized delays between steps and staggered start times for concurrency optimization `[ FREE / PRO VERSION ]`
25+
- Detailed per-account and per-transaction logging `[ FREE / PRO VERSION ]`
26+
- Graceful shutdown support on interrupt (Ctrl+C) leveraging multiprocessing events `[ FREE / PRO VERSION ]`
27+
28+
## Project Structure [ FREE VERSION ]
29+
```yaml
30+
├── main.py # Primary entry point to launch the b0t
31+
├── src/
32+
│ ├── core.py # plumeeSwapB0t class and main logic
33+
│ ├── logger.py # Custom Logger module
34+
│ ├── config.py # Configuration and environment variable parsing
35+
│ ├── abi.py # Smart contract ABIs
36+
│ └── utils.py # Utility functions (e.g., random delays)
37+
├── private_key.txt # File containing one private key per line
38+
├── requirements.txt # Python dependencies
39+
└── README.md # Project documentation (this file)
40+
```
41+
42+
## Usage Instructions
43+
### 1. Install / clone this repository:
44+
```bash
45+
git clone https://github.com/airdropservices/plumee-mainnet-services.git
46+
cd plumee-mainnet-services
47+
```
48+
### 2. (Optional but recommended) Create a virtual environment:
49+
```bash
50+
python -m venv venv
51+
```
52+
Then activate the virtual environment:
53+
#### Windows:
54+
```bash
55+
venv\Scripts\activate
56+
```
57+
#### macOS/Linux:
58+
```bash
59+
source venv/bin/activate
60+
```
61+
### 3. Install dependencies:
62+
```bash
63+
pip install -r requirements.txt
64+
```
65+
### 4. Prepare `private_key.txt`:
66+
Store your Ethereum private keys here:
67+
```text
68+
0x8j64fda56d6778xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
69+
0x8j64fda56d6778xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
70+
```
71+
72+
### 5. Configure `.env` with your preferences:
73+
```yaml
74+
WRAP_TO_Wplume=false
75+
UNWRAP_TO_plumee=false
76+
SWAP_TO_PUSD=false
77+
SWAP_PUSD_TO_Wplume=false
78+
ENABLE_STAKING=false
79+
80+
AMOUNT_TO_WRAP_plume=[0.05, 0.15]
81+
AMOUNT_TO_UNWRAP_Wplume=[0.01, 0.05]
82+
AMOUNT_TO_SWAP_Wplumee_PUSD=[0.005, 0.01]
83+
AMOUNT_TO_SWAP_PUSD_Wplume=[0.01, 0.05]
84+
AMOUNT_TO_STAKE_plumee=1
85+
86+
MIN_PUSD_EXPECTED=0.000001
87+
MIN_Wplume_EXPECTED=0.0000000001
88+
89+
STAKE_VALIDATOR_ID=3
90+
NUM_REPETITIONS=1
91+
SLIPPAGE_TOLERANCE=0.01
92+
93+
MIN_START_DELAY=5
94+
MAX_START_DELAY=15
95+
DELAY_BETWEEN_INTERACTIONS_SEC=[5, 10]
96+
TX_TIMEOUT=300
97+
MAX_RETRIES=3
98+
RETRY_DELAY_SEC=5
99+
WAIT_TIME_FOR_LOOP=100
100+
MAX_WORKERS=4
101+
```
102+
#### Note: You can adjust these values to tailor the b0t behavior.
103+
104+
### 6. Run the b0t:
105+
```bash
106+
python main.py
107+
```
108+
The b0t will initiate each account's trading cycle with randomized start delays and operate in continuous looping cycles based on your configuration.
109+
110+
### Graceful Shutdown
111+
The b0t supports safe interruption (Ctrl+C), terminating all threads/processes cleanly while preserving state if applicable.
112+
113+
## Development & Maintenance
114+
> Modular codebase inside the src/ directory,
115+
> Custom Logger supports debug-level logging for detailed troubleshooting,
116+
> Extendable with PRO version features for advanced trading and bridging,
117+
118+
## Why Upgrade to PRO Version?
119+
Unlock the full power of plumeeSwapBot with the PRO Version and take your trading experience to the next level:
120+
121+
- 🚀 **Advanced Trading Pairs:** Gain access to swaps involving pETH, WETH, USDC, USDT, and exclusive token pairs like nCREDIT, nALPHA, nELIXIR, nBASIS, nPAYFI — providing deeper liquidity and better opportunities.
122+
123+
- 🔗 **Seamless Cross-Chain Bridges:** Easily bridge assets between Ethereum, Arbitrum, Linea, Zero, Zora, Optimism, Binance Smart Chain, Polygon, and more — all integrated for effortless multi-chain arbitrage and fund movement.
124+
125+
- 🤖 **Automated Validator Optimization:** Let the bot automatically select the best staking validators based on yield and performance metrics — maximize your staking rewards hands-free.
126+
127+
- 🎰 **Daily Automated Spin & Rewards:** Enjoy daily spinning bonus rewards and raffle tickets automation on portal.plume.org, boosting your passive income without lifting a finger!
128+
129+
- 🔧 **Enhanced Protocol Integrations:** Tap into Relay, RoosterProtocol, Ambient, Stargate, Izumi, and other platforms to unlock advanced defi features unavailable in the free version.
130+
131+
-**Priority Support and Updates:** Get timely feature updates, optimizations, and priority support from the development team, ensuring you stay ahead in the fast-moving crypto space.
132+
133+
- Upgrade today and experience the unmatched power and versatility of the `plumeeSwapB0t PRO` — your trusted companion for next-level decentralized trading and staking.
134+
135+
# How to keep your PRO VERSION? Release Soon!
136+
137+
## License
138+
This project is open-source and free to modify for personal use.
139+
Use responsibly on live networks.

example.env

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
RPC_URL="https://rpc.plume.org"
2+
EXPLORER_URL="https://explorer.plume.org/tx/0x"
3+
WPLUME_ADDRESS="0xEa237441c92CAe6FC17Caaf9a7acB3f953be4bd1"
4+
PUSD_ADDRESS="0xdddd73f5df1f0dc31373357beac77545dc5a6f3f"
5+
SWAP_ROUTER_ADDRESS="0x35e44dc4702Fd51744001E248B49CBf9fcc51f0C"
6+
RELAY_ROUTER_ADDRESS="0xF5042e6fFAC5A625d4e7848E0b01373D8Eb9E222"
7+
APPROVAL_PROXY_ADDRESS="0xBBbfD134E9b44BfB5123898BA36b01dE7ab93d98"
8+
PERMIT_ROUTER_ADDRESS="0x000000000022D473030F116dDEE9F6B43aC78BA3"
9+
MAVERICK_POOL_WPLUME_PUSD="0x39ba3C1Dbe665452E86fde9C71FC64C78aa2445C"
10+
PLUME_STAKING_CONTRACT_ADDRESS="0x30c791E4654EdAc575FA1700eD8633CB2FEDE871"
11+
12+
WRAP_TO_WPLUME=false
13+
UNWRAP_TO_PLUME=false
14+
SWAP_TO_PUSD=false
15+
SWAP_PUSD_TO_WPLUME=false
16+
ENABLE_STAKING=false
17+
18+
AMOUNT_TO_WRAP_PLUME=[0.05, 0.15]
19+
AMOUNT_TO_UNWRAP_WPLUME=[0.01, 0.05]
20+
AMOUNT_TO_SWAP_WPLUME_PUSD=[0.005, 0.01]
21+
AMOUNT_TO_SWAP_PUSD_WPLUME=[0.01, 0.05]
22+
AMOUNT_TO_STAKE_PLUME=1
23+
24+
MIN_PUSD_EXPECTED=0.000001
25+
MIN_WPLUME_EXPECTED=0.0000000001
26+
27+
STAKE_VALIDATOR_ID=3
28+
NUM_REPETITIONS=1
29+
SLIPPAGE_TOLERANCE=0.01
30+
31+
MIN_START_DELAY=5
32+
MAX_START_DELAY=15
33+
DELAY_BETWEEN_INTERACTIONS_SEC=[5, 10]
34+
TX_TIMEOUT=300
35+
MAX_RETRIES=3
36+
RETRY_DELAY_SEC=5
37+
WAIT_TIME_FOR_LOOP=100
38+
MAX_WORKERS=4

main.py

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
import random, os, sys, time
2+
from concurrent.futures import ProcessPoolExecutor, as_completed
3+
from multiprocessing import Event, Manager
4+
5+
from src.config import settings
6+
from src.core import PlumeSwapBot
7+
from src.logger import Logger
8+
from src import utils as _utls
9+
10+
def run_bot_for_account(parameter, account_idx, min_delay, max_delay, stop_flag):
11+
local_logger = Logger()
12+
delay_seconds = random.uniform(min_delay, max_delay)
13+
local_logger.info(f"Account {account_idx} will start trading after delay of {delay_seconds:.2f} seconds.", account_index=account_idx)
14+
15+
waited = 0
16+
while waited < delay_seconds:
17+
if stop_flag.is_set():
18+
local_logger.warning(f"Account {account_idx} start delay interrupted by stop signal. Aborting.", account_index=account_idx)
19+
return
20+
time.sleep(0.5)
21+
waited += 0.5
22+
23+
try:
24+
bot_instance = PlumeSwapBot(parameter=parameter, account_index=account_idx)
25+
bot_instance.execute_trade()
26+
local_logger.success(f"Bot successfully completed its trading cycle for Account {account_idx}.", account_index=account_idx)
27+
28+
except KeyboardInterrupt:
29+
stop_flag.set()
30+
except Exception as e:
31+
local_logger.critical(f"A critical error occurred for Account {account_idx}, skipping: {e}", account_index=account_idx)
32+
33+
if __name__ == "__main__":
34+
os.system("cls" if os.name == "nt" else "clear")
35+
_utls.plume_mainnet_banner_v2()
36+
main_logger = Logger()
37+
parameter_list = PlumeSwapBot._load_parameter_keys("private_key.txt")
38+
39+
if not parameter_list:
40+
main_logger.critical("No private keys found in private_key.txt. Exiting program.")
41+
sys.exit(1)
42+
43+
max_workers = int(settings.get("MAX_WORKERS", 4))
44+
WAIT_TIME_FOR_LOOP = float(settings.get("WAIT_TIME_FOR_LOOP", 3600))
45+
MIN_START_DELAY = float(settings.get("MIN_START_DELAY", 0))
46+
MAX_START_DELAY = float(settings.get("MAX_START_DELAY", 30))
47+
48+
with Manager() as manager:
49+
stop_flag = manager.Event()
50+
51+
main_logger.info(f"Starting bot for {len(parameter_list)} accounts with max {max_workers} concurrent workers.")
52+
53+
while True:
54+
stop_flag.clear()
55+
try:
56+
with ProcessPoolExecutor(max_workers=max_workers) as executor:
57+
futures = []
58+
for idx, key in enumerate(parameter_list):
59+
account_idx = idx + 1
60+
futures.append(
61+
executor.submit(run_bot_for_account, key, account_idx, MIN_START_DELAY, MAX_START_DELAY, stop_flag)
62+
)
63+
64+
for future in as_completed(futures):
65+
try:
66+
future.result()
67+
except KeyboardInterrupt:
68+
main_logger.warning("KeyboardInterrupt caught in a process. Setting stop flag and exiting.")
69+
stop_flag.set()
70+
executor.shutdown(wait=False)
71+
sys.exit(0)
72+
except Exception as e:
73+
main_logger.critical(f"Exception in bot process: {e}")
74+
75+
except KeyboardInterrupt:
76+
main_logger.warning("KeyboardInterrupt caught in main loop. Setting stop flag and exiting.")
77+
stop_flag.set()
78+
sys.exit(0)
79+
80+
main_logger.info(f"All accounts processed in this cycle. Waiting {WAIT_TIME_FOR_LOOP} seconds before next loop.")
81+
waited = 0
82+
while waited < WAIT_TIME_FOR_LOOP:
83+
if stop_flag.is_set():
84+
main_logger.warning("Stop signal received during global wait. Exiting.")
85+
sys.exit(0)
86+
time.sleep(1)
87+
waited += 1

private_key.txt

Whitespace-only changes.

requirements.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
python-dotenv
2+
web3>=5.31.1
3+
eth-account
4+
hexbytes>=0.2.0
5+
requests>=2.28.1
6+
colorama
7+
uvloop; platform_system != "Windows"
8+
winloop; platform_system == "Windows"

src/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)