Fix / Uniswap router BUY orders and improve gas handling#471
Merged
rapcmia merged 4 commits intodevelopmentfrom Jul 1, 2025
Merged
Fix / Uniswap router BUY orders and improve gas handling#471rapcmia merged 4 commits intodevelopmentfrom
rapcmia merged 4 commits intodevelopmentfrom
Conversation
- Fixed BUY order calculations to properly handle EXACT_OUTPUT trades - Added balance checks before swap execution with clear error messages - Set fixed gas limit of 300,000 for all Uniswap V3 swaps - Removed minimum gas price constraint to use market rates - Allow all Ethereum networks configured in ethereum.yml - Dynamically fetch networks from configuration instead of hardcoded lists - Added comprehensive tests for BUY/SELL operations and gas parameters 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Removed EXACT_INPUT workaround for BUY orders as AlphaRouter now works correctly - Removed BUY order sanity check as it's no longer needed - Removed test README.md file 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Removed calldata decoding and validation logic - Removed amount validation checks for BUY orders - Trust AlphaRouter's output without additional verification 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
rapcmia
approved these changes
Jul 1, 2025
Contributor
rapcmia
left a comment
There was a problem hiding this comment.
- Test this PR with hummingbot dev branch using source ok
- Run amm_price_example v2 script ok
- Run fastify
GET /connectors/uniswap/quote-swapok - Compare price on uniswap mainnet ok
2 tasks
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
This PR fixes critical issues with Uniswap V3 router integration, specifically addressing BUY order failures and gas parameter optimization.
Changes
🐛 Bug Fixes
✨ Improvements
ethereum.ymlare now automatically supported🧪 Testing
Technical Details
The main issue was that BUY orders were incorrectly calculating amounts. When a user wants to BUY 0.001 WETH with USDC, the system was treating this as an EXACT_INPUT trade instead of EXACT_OUTPUT, resulting in very small output amounts (1e-15 WETH).
Before
After
Breaking Changes
None - All changes are backward compatible.
Related Issues
Fixes issues with Uniswap V3 BUY orders returning incorrect amounts and transactions failing due to insufficient gas.