fix(ton-trading-bot): replace hardcoded /3 price conversion with sdk.ton.getPrice() - #67
Merged
Merged
Conversation
Adding .gitkeep for PR creation (default mode). This file will be removed when the task is complete. Issue: xlabtg#59
Use sdk.ton.getPrice() to convert reserve_in_usd to TON instead of hardcoded division by 3, in both ton_trading_get_token_listings and ton_trading_get_token_info. Fallback to 3 if getPrice() returns null. Fixes xlabtg#59 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
konard
marked this pull request as ready for review
March 27, 2026 00:52
This reverts commit c21d602.
Author
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
🤖 Models used:
📎 Log file uploaded as Gist (674KB)Now working session is ended, feel free to review and add any feedback on the solution draft. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the hardcoded
/ 3USD-to-TON price conversion by usingsdk.ton.getPrice(), which is already available in the plugin.Two locations were affected:
ton_trading_get_token_listings: The.filter()step computedreserve_in_usd / 3to estimate TON liquidity. Fixed by fetchingsdk.ton.getPrice()in parallel withres.json()(viaPromise.all) before the filter, then dividing by the real price.ton_trading_get_token_info: UsedreserveUsd / 3to computereserveTonfor liquidity warnings. Fixed by callingawait sdk.ton.getPrice()and using the real price.Both locations fall back to
3ifgetPrice()returnsnull, preserving existing behavior in edge cases.Test plan
npm test)/3divisions replaced; verified withgrepFixes #59
🤖 Generated with Claude Code