@@ -221,10 +221,17 @@ else:
221221GRADUATED_MINT=$( echo " $TRENDING " | python3 -c "
222222import json, sys
223223tokens = json.load(sys.stdin)
224+ # Prefer graduated tokens with higher SOL reserves — pools with extreme
225+ # base/quote ratios can trigger on-chain overflow at buy.rs:400.
226+ best = None
224227for t in tokens:
225228 if t.get('complete') and t.get('pump_swap_pool'):
226- print(t['mint'])
227- break
229+ if best is None:
230+ best = t
231+ elif t.get('market_cap', 0) > best.get('market_cap', 0):
232+ best = t
233+ if best:
234+ print(best['mint'])
228235else:
229236 print('')
230237" 2> /dev/null)
@@ -259,22 +266,22 @@ if [[ "$SKIP_TRADING" == true ]]; then
259266else
260267 echo " === Group 5: Bonding Curve Trading ==="
261268 if [[ -n " $ACTIVE_MINT " ]]; then
262- BUY_OUT=$( uv run pumpfun buy " $ACTIVE_MINT " 0.001 --confirm 2>&1 )
269+ BUY_OUT=$( uv run pumpfun buy " $ACTIVE_MINT " 0.001 --slippage 50 -- confirm 2>&1 )
263270 BUY_EXIT=$?
264271 if [[ $BUY_EXIT -eq 0 ]]; then
265272 record " BC Trade" " buy 0.001 --confirm" " PASS"
266273 echo " Buy OK. Waiting 5s for RPC state..."
267274 sleep 5
268275
269- SELL_OUT=$( uv run pumpfun sell " $ACTIVE_MINT " all --confirm 2>&1 )
276+ SELL_OUT=$( uv run pumpfun sell " $ACTIVE_MINT " all --slippage 50 -- confirm 2>&1 )
270277 SELL_EXIT=$?
271278 if [[ $SELL_EXIT -eq 0 ]]; then
272279 record " BC Trade" " sell all --confirm" " PASS"
273280 else
274281 # Retry once after delay
275282 echo " Sell failed, retrying in 5s..."
276283 sleep 5
277- SELL_OUT=$( uv run pumpfun sell " $ACTIVE_MINT " all --confirm 2>&1 )
284+ SELL_OUT=$( uv run pumpfun sell " $ACTIVE_MINT " all --slippage 50 -- confirm 2>&1 )
278285 SELL_EXIT=$?
279286 if [[ $SELL_EXIT -eq 0 ]]; then
280287 record " BC Trade" " sell all --confirm" " PASS" " Needed retry (RPC lag)"
@@ -297,20 +304,133 @@ else
297304
298305 echo " === Group 6: PumpSwap AMM Trading ==="
299306 if [[ -n " $GRADUATED_MINT " ]]; then
300- AMM_OUT=$( uv run pumpfun buy " $GRADUATED_MINT " 0.001 --force-amm --confirm 2>&1 )
301- AMM_EXIT=$?
302- if [[ $AMM_EXIT -eq 0 ]]; then
303- record " PumpSwap" " buy --force-amm --confirm" " PASS" " BUG-1 may be fixed!"
304- elif echo " $AMM_OUT " | grep -q " 6023" ; then
305- record " PumpSwap" " buy --force-amm --confirm" " ISSUE" " Error 6023 — known BUG-1"
306- else
307- record " PumpSwap" " buy --force-amm --confirm" " FAIL" " $( echo " $AMM_OUT " | head -1 | cut -c1-60) "
307+ # Build a list of graduated mints to try (some pools have on-chain overflow bugs)
308+ ALL_GRADUATED=$( echo " $TRENDING " | python3 -c "
309+ import json, sys
310+ tokens = json.load(sys.stdin)
311+ for t in tokens:
312+ if t.get('complete') and t.get('pump_swap_pool'):
313+ print(t['mint'])
314+ " 2> /dev/null)
315+
316+ AMM_BUY_OK=false
317+ AMM_MINT=" "
318+ AMM_OVERFLOW_ONLY=true
319+ while IFS= read -r CANDIDATE; do
320+ [[ -z " $CANDIDATE " ]] && continue
321+ AMM_OUT=$( uv run pumpfun buy " $CANDIDATE " 0.001 --slippage 50 --force-amm --confirm 2>&1 )
322+ AMM_EXIT=$?
323+ if [[ $AMM_EXIT -eq 0 ]]; then
324+ AMM_BUY_OK=true
325+ AMM_MINT=" $CANDIDATE "
326+ break
327+ elif echo " $AMM_OUT " | grep -q " 6023" ; then
328+ echo " Pool overflow (6023) on ${CANDIDATE: 0: 12} …, trying next"
329+ continue
330+ else
331+ # Non-overflow failure — record and stop
332+ AMM_OVERFLOW_ONLY=false
333+ record " PumpSwap" " buy --force-amm --confirm" " FAIL" " $( echo " $AMM_OUT " | head -1 | cut -c1-60) "
334+ break
335+ fi
336+ done <<< " $ALL_GRADUATED"
337+
338+ if [[ " $AMM_BUY_OK " == " true" ]]; then
339+ record " PumpSwap" " buy --force-amm --confirm" " PASS"
340+ echo " PumpSwap buy OK. Waiting 5s for RPC state..."
341+ sleep 5
342+
343+ AMM_SELL_OUT=$( uv run pumpfun sell " $AMM_MINT " all --slippage 50 --confirm 2>&1 )
344+ AMM_SELL_EXIT=$?
345+ if [[ $AMM_SELL_EXIT -eq 0 ]]; then
346+ record " PumpSwap" " sell all --confirm" " PASS"
347+ else
348+ echo " PumpSwap sell failed, retrying in 5s..."
349+ sleep 5
350+ AMM_SELL_OUT=$( uv run pumpfun sell " $AMM_MINT " all --slippage 50 --confirm 2>&1 )
351+ AMM_SELL_EXIT=$?
352+ if [[ $AMM_SELL_EXIT -eq 0 ]]; then
353+ record " PumpSwap" " sell all --confirm" " PASS" " Needed retry (RPC lag)"
354+ else
355+ record " PumpSwap" " sell all --confirm" " FAIL" " Failed after retry"
356+ fi
357+ fi
358+ elif [[ " $AMM_OVERFLOW_ONLY " == " true" ]]; then
359+ record " PumpSwap" " buy --force-amm --confirm" " ISSUE" " All graduated pools hit error 6023"
308360 fi
309361 else
310362 record " PumpSwap" " buy --force-amm" " ISSUE" " No graduated mint found"
311363 fi
312364 echo " Done."
313365
366+ # --- Group 6b: Token Launch ---
367+
368+ echo " === Group 6b: Token Launch ==="
369+ # Generate a minimal test image
370+ python3 -c " from PIL import Image; Image.new('RGB',(100,100),'blue').save('/tmp/e2e_test_token.png')" 2> /dev/null
371+ LAUNCH_IMG=" "
372+ [[ -f /tmp/e2e_test_token.png ]] && LAUNCH_IMG=" --image /tmp/e2e_test_token.png"
373+
374+ LAUNCH_OUT=$( uv run pumpfun --json launch --name " E2E Test $( date +%s) " --ticker " E2ET" --desc " Automated e2e test token" $LAUNCH_IMG 2>&1 )
375+ LAUNCH_EXIT=$?
376+ echo " $LAUNCH_OUT " > " $LAST_OUTPUT_FILE "
377+ if [[ $LAUNCH_EXIT -eq 0 ]]; then
378+ LAUNCHED_MINT=$( echo " $LAUNCH_OUT " | python3 -c " import json,sys; print(json.load(sys.stdin).get('mint',''))" 2> /dev/null)
379+ if [[ -n " $LAUNCHED_MINT " ]]; then
380+ record " Launch" " launch" " PASS"
381+ echo " Launched: $LAUNCHED_MINT "
382+ else
383+ record " Launch" " launch" " FAIL" " Invalid --json payload (missing mint)"
384+ LAUNCHED_MINT=" "
385+ fi
386+ else
387+ LAUNCH_ERR=$( echo " $LAUNCH_OUT " | grep -m1 " Error:" | cut -c1-60)
388+ [[ -z " $LAUNCH_ERR " ]] && LAUNCH_ERR=" exit=$LAUNCH_EXIT "
389+ record " Launch" " launch" " FAIL" " $LAUNCH_ERR "
390+ LAUNCHED_MINT=" "
391+ fi
392+
393+ # Launch + buy
394+ LAUNCH_BUY_OUT=$( uv run pumpfun --json launch --name " E2E Buy Test $( date +%s) " --ticker " E2EB" --desc " Automated e2e launch+buy" $LAUNCH_IMG --buy 0.001 2>&1 )
395+ LAUNCH_BUY_EXIT=$?
396+ echo " $LAUNCH_BUY_OUT " > " $LAST_OUTPUT_FILE "
397+ if [[ $LAUNCH_BUY_EXIT -eq 0 ]]; then
398+ LAUNCHED_BUY_MINT=$( echo " $LAUNCH_BUY_OUT " | python3 -c " import json,sys; print(json.load(sys.stdin).get('mint',''))" 2> /dev/null)
399+ if [[ -n " $LAUNCHED_BUY_MINT " ]]; then
400+ record " Launch" " launch --buy 0.001" " PASS"
401+ echo " Launched+bought: $LAUNCHED_BUY_MINT "
402+ else
403+ record " Launch" " launch --buy 0.001" " FAIL" " Invalid --json payload (missing mint)"
404+ LAUNCHED_BUY_MINT=" "
405+ fi
406+
407+ # Sell from the launched token to test full cycle
408+ if [[ -n " $LAUNCHED_BUY_MINT " ]]; then
409+ echo " Waiting 5s for RPC state..."
410+ sleep 5
411+ LSELL_OUT=$( uv run pumpfun sell " $LAUNCHED_BUY_MINT " all --slippage 50 --confirm 2>&1 )
412+ LSELL_EXIT=$?
413+ if [[ $LSELL_EXIT -eq 0 ]]; then
414+ record " Launch" " sell launched token" " PASS"
415+ else
416+ sleep 5
417+ LSELL_OUT=$( uv run pumpfun sell " $LAUNCHED_BUY_MINT " all --slippage 50 --confirm 2>&1 )
418+ LSELL_EXIT=$?
419+ if [[ $LSELL_EXIT -eq 0 ]]; then
420+ record " Launch" " sell launched token" " PASS" " Needed retry"
421+ else
422+ record " Launch" " sell launched token" " FAIL" " Failed after retry"
423+ fi
424+ fi
425+ fi
426+ else
427+ LAUNCH_BUY_ERR=$( echo " $LAUNCH_BUY_OUT " | grep -m1 " Error:" | cut -c1-60)
428+ [[ -z " $LAUNCH_BUY_ERR " ]] && LAUNCH_BUY_ERR=" exit=$LAUNCH_BUY_EXIT "
429+ record " Launch" " launch --buy 0.001" " FAIL" " $LAUNCH_BUY_ERR "
430+ fi
431+ rm -f /tmp/e2e_test_token.png
432+ echo " Done."
433+
314434 # --- Group 7: Extras ---
315435
316436 echo " === Group 7: Extras ==="
0 commit comments