Skip to content

Validate slippage range (0-100) in buy and sell commands #1

Closed

Description

@smypmsa

Problem

--slippage accepts any integer with no bounds checking:

  • --slippage -5 → formula produces impossible min_tokens_out, guaranteed on-chain rejection
  • --slippage 999 → large negative integer → struct.error crash with Python traceback

Fix

Add validation in src/pumpfun_cli/commands/trade.py in both buy() and sell(), after _validate_mint():

if slippage < 0 or slippage > 100:
    error("Slippage must be between 0 and 100.", hint="Got: {slippage}")

Files to change

  • src/pumpfun_cli/commands/trade.py — add validation in buy() and sell()
  • tests/test_commands/test_trade_cmd.py — add tests for out-of-range slippage

How to test

uv run pytest tests/test_commands/test_trade_cmd.py -v

Activity

  1. smypmsa commented on Mar 17, 2026

    @smypmsa
    MemberAuthor

    @zhaog100 there is no bounty. It's an open source project. Feel free to contribute.

  2. 0xmortuex commented on Mar 17, 2026

    @0xmortuex
    Contributor

    I'd like to work on this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions