gateway
gateway copied to clipboard
Uniswap connector improvements and inconsistencies
Overview
Several improvements and inconsistencies identified in the Uniswap connector that should be addressed for better consistency and functionality.
Issues Identified
1. Slippage Parameter Inconsistency
- Issue: Certain endpoints in the Swagger documentation have the slippage parameter, but the connector ignores them and uses the slippage specified in the config file instead
- Impact: API consumers may expect slippage parameter to be honored but it's silently ignored
- Recommendation: Either remove slippage from Swagger docs for endpoints that don't use it, or implement proper slippage parameter handling
2. Pool/Pair Address Derivation Inconsistency
- Issue: Inconsistent approach to pool/pair address derivation across different endpoint types
- Router endpoints compute pool addresses dynamically
- AMM endpoints retrieve addresses from the pool config file
- Impact: Different behavior patterns that may confuse developers and make maintenance harder
- Recommendation: Standardize the approach - either compute addresses consistently or use config file consistently
3. sqrtPriceLimit Not Enforced in CLMM Swap
- Issue: The sqrtPriceLimit parameter isn't enforced in CLMM swap operations - only the expected output amount is specified
- Impact: Price protection mechanisms may not work as expected
- Priority: Low (noted as "fairly ok and acceptable")
- Recommendation: Document this behavior or consider implementing proper price limit enforcement
4. Transaction Receipt Waiting Pattern
- Issue: Most endpoints still use
tx.wait()for receipt and set status to 1 in responses - Impact: May cause slower response times, especially on mainnet
- Priority: Low (noted as "should be fine on most networks, especially L2s")
- Recommendation: Consider making this configurable or documenting the behavior
Acceptance Criteria
- [ ] Review and standardize slippage parameter handling across all Uniswap endpoints
- [ ] Standardize pool/pair address derivation approach
- [ ] Document sqrtPriceLimit behavior in CLMM swaps
- [ ] Review transaction receipt waiting patterns for optimization opportunities
- [ ] Update Swagger documentation to reflect actual parameter usage
Additional Context
These issues were identified by @vic-en while building another connector. Addressing them would improve the consistency and predictability of the Uniswap connector.
Sponsor: Hummingbot Foundation Source: Uniswap connector pot Developer bounty amount: 250K HBOT
I can work on this
https://github.com/hummingbot/gateway/pull/540