Added multi-hop quotes support#433
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev/v4-fin #433 +/- ##
=============================================
Coverage ? 58.44%
=============================================
Files ? 12
Lines ? 1865
Branches ? 0
=============================================
Hits ? 1090
Misses ? 775
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Greptile SummaryThis PR adds multi-hop quote support to the Uniswap V4 Python SDK by introducing a
Confidence Score: 3/5Not safe to merge — both new multi-hop quote methods will fail at runtime due to missing astuple() conversion, and exact-output quotes will produce wrong results due to incorrect path ordering. Two independent P1 bugs affect every code path introduced by this PR: (1) PathKey instances are passed directly to web3.py without astuple(), raising a TypeError on the first call; and (2) encode_path_keys_output emits the path in forward order instead of backward order, causing quoteExactOutput to route incorrectly or revert on-chain. Neither issue is speculative — both are present defects that prevent the new functionality from working. uniswap/uniswap4.py — specifically encode_path_keys_output (line 1515) and both multi-hop contract call sites (lines 1555–1561, 1604–1610). Important Files Changed
Sequence DiagramsequenceDiagram
participant Caller
participant Uniswap4
participant QuoterContract
Note over Caller,QuoterContract: Multi-hop Exact Input (A to B to C)
Caller->>Uniswap4: get_quote_exact_input(token0=A, token1=C, qty, path)
Uniswap4->>Uniswap4: encode_path_keys_input(path, currency_in=A)
Note right of Uniswap4: Produces [PathKey(B), PathKey(C)] correct order
Uniswap4->>QuoterContract: quoteExactInput((A, [PathKey(B), PathKey(C)], qty))
Note right of Uniswap4: PathKey instances not astuple()-converted, TypeError
QuoterContract-->>Caller: amountOut
Note over Caller,QuoterContract: Multi-hop Exact Output (A to B to C)
Caller->>Uniswap4: get_quote_exact_output(token0=A, token1=C, qty, path)
Uniswap4->>Uniswap4: encode_path_keys_output(path, currency_out=C)
Note right of Uniswap4: BUG insert(0) while reversed yields [PathKey(A), PathKey(B)] wrong
Note right of Uniswap4: Expected [PathKey(B), PathKey(A)] correct
Uniswap4->>QuoterContract: quoteExactOutput((C, [PathKey(A), PathKey(B)], qty))
Note right of Uniswap4: Wrong order and no astuple, incorrect result
QuoterContract-->>Caller: amountIn wrong
Reviews (1): Last reviewed commit: "Added multi-hop quotes support" | Re-trigger Greptile |
No description provided.