Fix position_manager_permit2_single() by liquid-8 · Pull Request #464 · uniswap-python/uniswap-python · GitHub
Skip to content

Fix position_manager_permit2_single()#464

Merged
liquid-8 merged 1 commit into
uniswap-python:dev/v4-finfrom
liquid-8:uniswap4_RC
Jun 4, 2026
Merged

Fix position_manager_permit2_single()#464
liquid-8 merged 1 commit into
uniswap-python:dev/v4-finfrom
liquid-8:uniswap4_RC

Conversation

@liquid-8

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

Copy link
Copy Markdown
Member

No description provided.

@codecov

codecov Bot commented Jun 4, 2026

Copy link
Copy Markdown

@greptile-apps

greptile-apps Bot commented Jun 4, 2026

Copy link
Copy Markdown

Greptile Summary

This PR fixes a bug in position_manager_permit2_single() where the function was incorrectly constructing the permit call — it was wrapping astuple(permit_single) inside an extra outer tuple alongside a redundant spender and sig_deadline, which doesn't match the ABI's permit(address, PermitSingle, bytes) signature. The fix removes those duplicate parameters and passes astuple(permit_single) directly, since PermitSingle already encodes both spender and sig_deadline as its own fields.

  • Bug fix: Removes spender and sig_deadline as standalone function parameters and stops wrapping them in an outer tuple alongside astuple(permit_single), aligning the call with the ABI definition permit(address owner, PermitSingle permitSingle, bytes signature).
  • Breaking signature change: Any existing callers of position_manager_permit2_single that relied on the old 6-argument form will need to be updated; however, the old form would have produced an ABI-encoding mismatch and reverted on-chain anyway.

Confidence Score: 5/5

Safe to merge — the change directly aligns the permit call with the on-chain ABI and removes arguments that were duplicated inside PermitSingle.

The fix is a targeted, well-justified correction. The old code wrapped astuple(permit_single) inside an extra outer tuple and repeated spender and sig_deadline as standalone arguments that were already encoded inside PermitSingle, causing an ABI mismatch that would always revert. The new call matches the ABI exactly: permit(address, PermitSingle, bytes). The change is narrow, the ABI confirms the expected shape, and the parallel batch function already used the correct pattern.

No files require special attention; the single changed method in uniswap4.py is straightforward and consistent with position_manager_permit2_batch.

Important Files Changed

Filename Overview
uniswap/uniswap4.py Fixes incorrect ABI encoding in position_manager_permit2_single() by removing redundant spender/sig_deadline params and passing astuple(permit_single) directly to match the on-chain permit(address, PermitSingle, bytes) signature.

Sequence Diagram

sequenceDiagram
    participant Caller
    participant uniswap4.py
    participant PositionManager (on-chain)
    participant Permit2 (on-chain)

    Caller->>uniswap4.py: position_manager_permit2_single(owner, permit_single, signature, payable_amount)
    note over uniswap4.py: astuple(permit_single)<br/>→ ((token, amount, expiration, nonce), spender, sig_deadline)
    uniswap4.py->>PositionManager (on-chain): permit(owner, PermitSingle, signature)
    PositionManager (on-chain)->>Permit2 (on-chain): forward permit call
    Permit2 (on-chain)-->>PositionManager (on-chain): success / err
    PositionManager (on-chain)-->>uniswap4.py: tx receipt
    uniswap4.py-->>Caller: HexBytes tx hash
Loading

Reviews (1): Last reviewed commit: "Fix position_manager_permit2_single()" | Re-trigger Greptile

@liquid-8 liquid-8 merged commit 97b6e6f into uniswap-python:dev/v4-fin Jun 4, 2026
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