Skip to content

Removed custom recipent in swaps; tests added.#451

Merged
liquid-8 merged 2 commits into
uniswap-python:dev/v4-finfrom
liquid-8:uniswap4_RC
May 4, 2026
Merged

Removed custom recipent in swaps; tests added.#451
liquid-8 merged 2 commits into
uniswap-python:dev/v4-finfrom
liquid-8:uniswap4_RC

Conversation

@liquid-8
Copy link
Copy Markdown
Member

@liquid-8 liquid-8 commented May 4, 2026

No description provided.

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 4, 2026

Greptile Summary

This PR removes the custom recipient parameter from all four v4 swap methods and switches from the TAKE action to TAKE_ALL, which always delivers tokens to msg.sender. The ABI value-count mismatch flagged in the previous review round is now fixed (three-value lists reduced to two), but the numeric ABI type in settle_all_params and take_all_params is still declared as uint128 across all four methods while constants.py defines both SETTLE_ALL and TAKE_ALL as ["address", "uint256"].

Confidence Score: 4/5

Safe to merge for typical token amounts; the uint128/uint256 mismatch only becomes a problem for quantities above 2^128.

No P0 or P1 findings. The remaining uint128 vs uint256 issue is P2 — byte-identical encoding for all realistic amounts. Test coverage gap is a quality concern only.

All four swap methods in uniswap/uniswap4.py share the same uint128 type annotation inconsistency with the constants ABI definition.

Important Files Changed

Filename Overview
uniswap/uniswap4.py Removed recipient parameter from all four swap methods and switched from TAKE to TAKE_ALL; ABI value-count mismatch from previous iteration is fixed, but numeric type is still uint128 where constants.py defines uint256.
tests/test_uniswap4.py New test module added with ganache-fork fixtures; only quote methods are tested — no coverage for the swap methods that were actually changed in this PR.

Sequence Diagram

sequenceDiagram
    participant Caller
    participant Uniswap4
    participant UniversalRouter
    participant PoolManager

    Caller->>Uniswap4: eth_to_token_swap_input(input, qty, qtycap, ...)
    Note over Uniswap4: Build actions:<br/>SWAP_EXACT_IN_SINGLE / SETTLE_ALL / TAKE_ALL
    Uniswap4->>Uniswap4: encode settle_all_params([address, uint128])
    Uniswap4->>Uniswap4: encode take_all_params([address, uint128])
    Uniswap4->>UniversalRouter: execute(V4_SWAP, inputs)
    UniversalRouter->>PoolManager: swap(poolKey, params)
    PoolManager-->>UniversalRouter: output tokens
    UniversalRouter->>Caller: TAKE_ALL sends tokens to msg.sender
Loading

Reviews (2): Last reviewed commit: "quick fix" | Re-trigger Greptile

Comment thread uniswap/uniswap4.py
Comment thread uniswap/uniswap4.py
Comment thread uniswap/uniswap4.py
Comment thread uniswap/uniswap4.py
Comment thread tests/test_uniswap4.py
@liquid-8 liquid-8 merged commit 73a517e into uniswap-python:dev/v4-fin May 4, 2026
1 of 5 checks passed
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.

1 participant