Skip to content

Add SunPump Trading skill#9

Open
M2M-TRC8004-Registry wants to merge 5 commits intoBofAI:mainfrom
M2M-TRC8004-Registry:add-sunpump-skill
Open

Add SunPump Trading skill#9
M2M-TRC8004-Registry wants to merge 5 commits intoBofAI:mainfrom
M2M-TRC8004-Registry:add-sunpump-skill

Conversation

@M2M-TRC8004-Registry
Copy link
Copy Markdown
Contributor

Summary

  • Adds sunpump-skill for buying and selling meme tokens on SunPump (TRON bonding-curve launchpad)
  • Tokens priced via bonding curve, auto-migrate to SunSwap V2 at ~$69,420 market cap
  • Check token balances and current bonding curve prices
  • Buy and sell tokens with slippage protection

Scripts

  • balance.js — Check token balances
  • price.js — Query current bonding curve prices
  • buy.js — Buy tokens on the bonding curve
  • sell.js — Sell tokens back to the curve

Source: https://github.com/M2M-TRC8004-Registry/sunpump-skill

@boboliu-1010
Copy link
Copy Markdown
Collaborator

Thanks for the contribution! Equipping agents with the ability to trade on bonding curves is an exciting and trending use case, and our team is very interested in it.

Given that we are currently optimizing the context limits for tool calls in the main framework, we plan to review this PR in detail and consider it for a merge in the next phase.

Before then, we recommend adding and strengthening the following in your code:

Explicit parameter configurations for Slippage Tolerance.
What is the skill's exception handling or transition logic when a token reaches the market cap threshold and migrates to SunSwap V2? Looking forward to seeing your changes!

- Add explicit slippage parameters (default/min/max/warn) to sunpump_contracts.json
- Add validateSlippage() to utils.js enforcing configurable bounds
- Update buy.js, sell.js to use validateSlippage() instead of hardcoded default
- Enrich migration error output with reason, SunSwap router address, and action guidance
- Add migration context to price.js for read-only queries on migrated tokens
- Document slippage configuration and migration handling in SKILL.md
@boboliu-1010
Copy link
Copy Markdown
Collaborator

Thanks for the update. I re-checked the latest head.

I still see two issues before approval:

  1. price.js is documented as the first-step quote flow, but it still initializes via getTronWeb(), so even this read-only pricing path requires TRON_PRIVATE_KEY.
  2. The setup instructions still say cd sunpump && npm install, but the actual directory in this PR is sunpump-skill.

Please fix those and I can re-review.

…ctory paths

- Add getTronWebReadOnly() to utils.js for key-free read-only queries
- price.js: switch to getTronWebReadOnly() (no TRON_PRIVATE_KEY needed)
- balance.js: use getTronWebReadOnly() when explicit wallet address provided
- Fix all 'cd sunpump' references to 'cd sunpump-skill' in SKILL.md and README.md
- Fix 'sunpump/scripts/' path and 'sunpump directory' references in SKILL.md
- Fix directory tree in README.md from 'sunpump/' to 'sunpump-skill/'
@boboliu-1010
Copy link
Copy Markdown
Collaborator

Thanks for the latest updates. I re-checked the current head and the code-level issues I previously flagged appear to be addressed.

At this point, my remaining concern is runtime validation rather than code structure. Since this skill performs real trading flows, could you provide a reproducible E2E test transcript covering:

  1. price.js quote output,
  2. balance.js for the test wallet,
  3. one small buy or sell on Nile or mainnet with clearly stated environment,
  4. a post-trade verification showing the resulting balance or position change.

Please also include the exact commands used and whether each step was tested live or only dry-run.

The SunPump launcher's getTokenState returns:
  0 = not registered
  1 = active on bonding curve
  2 = pending migration
  3 = migrated to SunSwap V2

All three trading scripts (buy.js, sell.js, price.js) incorrectly treated
any non-zero state as migrated. This blocked purchases and sales on tokens
that are still actively trading on the bonding curve.

- buy.js/sell.js: gate on state !== 1 instead of state !== 0
- price.js: corrected state label map, migration warning only on state 3
- sunpump_contracts.json: updated getTokenState description
@M2M-TRC8004-Registry
Copy link
Copy Markdown
Contributor Author

Wallet used: TY9XnxhqrTe7tGw8djK5XLPmvVSTw95Zfi

1. price.js

node scripts/price.js <token> --buy 1

State: 1 (active on bonding curve), buy estimate: 1 TRX → 30,177.73 tokens, fee: 0.01 TRX

2. balance.js

TRON_PRIVATE_KEY=<key> node scripts/balance.js <token>

139.498 TRX, 0 tokens

3. buy.js

TRON_PRIVATE_KEY=<key> node scripts/buy.js <token> 1

Transaction

4. Post-trade verification

TRON_PRIVATE_KEY=<key> node scripts/balance.js <token>

Token balance: 0 → 30,177.73 (matches estimate exactly)


Note: A bug was found during validation — getTokenState returns 1 for active bonding-curve tokens, not 0. All three trading scripts incorrectly treated state 1 as migrated, blocking all buys and sells on active tokens. Fixed in commit 5f3d7f4.

@boboliu-1010
Copy link
Copy Markdown
Collaborator

The overall structure looks solid. SKILL.md, README.md, package.json, scripts/, and resources/ are all present, so this PR is close to being ready for validation.

One engineering detail needs clarification first: this PR does not include a package-lock.json. Please confirm whether that is intentional or an omission. If this skill is going into QA and repeated testing, adding the lockfile would make installs and dependency resolution much more reproducible.

Copy link
Copy Markdown
Collaborator

@boboliu-1010 boboliu-1010 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Static review did not surface a clear blocker in this PR. The state handling and migration checks look internally consistent after the follow-up fixes. Remaining risk is mostly runtime behavior against live contracts, so I would still recommend a small on-chain smoke test before merge, especially around token decimals, quotes, and migrated-token behavior.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants