Skip to content

PositionManager full support; PoolManager full support; contracts-related methods naming improvements.#426

Merged
liquid-8 merged 2 commits intouniswap-python:dev/v4-finfrom
liquid-8:uniswap4_RC
Mar 17, 2026
Merged

PositionManager full support; PoolManager full support; contracts-related methods naming improvements.#426
liquid-8 merged 2 commits intouniswap-python:dev/v4-finfrom
liquid-8:uniswap4_RC

Conversation

@liquid-8
Copy link
Member

No description provided.

@greptile-apps
Copy link

greptile-apps bot commented Mar 17, 2026

Greptile Summary

This PR adds full PositionManager write methods, full PoolManager read/write methods, and renames existing contract-related methods with _stateview, _position_manager, or _pool_manager suffixes for clarity. It also introduces new supporting dataclasses (PermitDetails, PermitBatch, ModifyLiquidityParams, SwapParams) and fixes several token-ordering bugs.

Key concerns:

  • util.py log retrieval regression: The refactored get_logs call passes the block range dict as argument_filters (the wrong parameter) and converts block numbers to plain decimal strings — this will silently return no results or raise an exception, breaking pool discovery entirely.
  • unlock_callback_position_manager should be removed: PositionManager.unlockCallback is gated to msg.sender == poolManager and is invoked by the PoolManager internally; wrapping it as a user-facing transaction method is misleading and will always revert.
  • Python 3.7/3.8 incompatibility: PermitBatch.details: list[PermitDetails] uses Python 3.9+ built-in generic syntax, while pyproject.toml specifies python = "^3.7.2". Should use List[PermitDetails] from typing.
  • PermitDetails.token_id naming: The field represents an ERC-20 token address (Permit2 calls it token), not an NFT integer token ID, causing potential confusion at call sites.

Confidence Score: 2/5

  • Not safe to merge — the util.py log regression breaks pool discovery and the types.py change is incompatible with the declared Python version floor.
  • Two P1 bugs exist: a broken get_logs call that will silently fail for all users relying on V4pools, and a Python 3.9+ syntax annotation that crashes on Python 3.7/3.8 at import time. The unlock_callback_position_manager method is also a logic error that will always revert. The naming improvements and new PoolManager/PositionManager method additions are otherwise solid.
  • uniswap/util.py (broken log retrieval), uniswap/types.py (Python version incompatibility), uniswap/uniswap4.py (unlock_callback_position_manager logic issue)

Important Files Changed

Filename Overview
uniswap/uniswap4.py Large addition of PositionManager write methods and PoolManager read/write methods; also includes naming improvements (adding _stateview, _position_manager, _pool_manager suffixes). Contains a logic error in unlock_callback_position_manager (callback-only function exposed as user transaction) and asymmetric API design in the permit2 helpers.
uniswap/types.py Adds PermitDetails, PermitBatch, ModifyLiquidityParams, and SwapParams dataclasses. Has two issues: list[PermitDetails] uses Python 3.9+ syntax incompatible with the declared python = "^3.7.2" requirement, and PermitDetails.token_id is a misleading name for what is actually an ERC-20 token address.
uniswap/util.py Refactors get_logs call in V4pools: introduces a regression where block range is passed as argument_filters (wrong parameter slot) and block numbers are converted to decimal strings rather than kept as integers, which will break log retrieval. Also adds error details to exception handlers.

Sequence Diagram

sequenceDiagram
    participant User as EOA / Python client
    participant PM as PositionManager
    participant PoolMgr as PoolManager

    Note over User, PoolMgr: Correct flow — user calls unlock on PoolManager
    User->>PoolMgr: unlock_pool_manager(data)
    PoolMgr->>PM: unlockCallback(data)
    PM-->>PoolMgr: (callback result)
    PoolMgr-->>User: tx receipt

    Note over User, PoolMgr: ❌ Wrong — unlock_callback_position_manager wraps the callback directly
    User->>PM: unlockCallback(data)
    PM--xUser: revert (msg.sender != poolManager)

    Note over User, PoolMgr: Modify liquidity flow
    User->>PM: modify_liquidities_position_manager(unlock_data, deadline, value)
    PM->>PoolMgr: unlock(unlock_data)
    PoolMgr->>PM: unlockCallback(unlock_data)
    PM->>PoolMgr: modifyLiquidity(poolKey, params, hookData)
    PM-->>User: tx receipt
Loading

Last reviewed commit: 3492c3f

@liquid-8 liquid-8 merged commit e3287ec into uniswap-python:dev/v4-fin Mar 17, 2026
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