Skip to content

Docstrings clarification, comments on universal_router_execute() usage#463

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

Docstrings clarification, comments on universal_router_execute() usage#463
liquid-8 merged 2 commits 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

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.87%. Comparing base (68779ff) to head (f609454).
⚠️ Report is 26 commits behind head on dev/v4-fin.

Additional details and impacted files
@@             Coverage Diff             @@
##           dev/v4-fin     #463   +/-   ##
===========================================
  Coverage       76.87%   76.87%           
===========================================
  Files              12       12           
  Lines            2249     2249           
===========================================
  Hits             1729     1729           
  Misses            520      520           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@greptile-apps

greptile-apps Bot commented Jun 4, 2026

Copy link
Copy Markdown

Greptile Summary

This PR adds a docstring to universal_router_execute, appends # NOTE: lines inside two existing docstrings, clarifies inline comments in the multi-action test, replaces hardcoded ABI type strings with centralised v4_actions_abis lookups, and removes the unused gas positional parameter from _get_tx_params.

  • uniswap4.py: ABI strings for SETTLE_ALL/TAKE_ALL switch from the hardcoded uint128 to the centralised uint256 definition (ABI-encoding-identical for in-range values); the dead gas=250000 parameter is dropped from _get_tx_params; two # NOTE: lines are embedded literally inside docstrings.
  • tests/test_uniswap4.py: Explanatory comments are added around the commands/actions/params setup, but one comment incorrectly states WRAP_ETH has "1 action" when it is given an empty list (0 actions).

Confidence Score: 4/5

Safe to merge — all changes are documentation and minor refactoring with no functional regressions.

The ABI refactoring is correct and the gas parameter removal is clean since it was never read by the function body. The only concrete mistakes are a contradictory comment in the test and # NOTE: lines embedded as literal text inside docstrings, both of which affect readability rather than runtime behaviour.

The two comment/docstring issues are in tests/test_uniswap4.py (wrong action count) and uniswap/uniswap4.py (# NOTE: inside docstrings); no other files need attention.

Important Files Changed

Filename Overview
tests/test_uniswap4.py Inline comments added to explain the multi-action Universal Router test; one comment incorrectly states WRAP_ETH has 1 action when it actually has 0 (empty list).
uniswap/uniswap4.py Docstring added to universal_router_execute, a NOTE added to get_price_impact, hardcoded ABI strings replaced with centralised v4_actions_abis lookups (changing uint128 to uint256 for SETTLE_ALL/TAKE_ALL, semantically identical in ABI encoding for in-range values), and the unused gas positional parameter removed from _get_tx_params.

Sequence Diagram

sequenceDiagram
    participant Caller
    participant universal_router_execute
    participant UniversalRouter

    Caller->>universal_router_execute: "commands=[WRAP_ETH, V4_SWAP], actions=[[], [SWAP_EXACT_IN_SINGLE, SETTLE_ALL, TAKE_ALL]], ether_amount"
    universal_router_execute->>universal_router_execute: "validate lengths (commands == actions == params)"
    universal_router_execute->>universal_router_execute: ABI-encode each command's inputs using v4_actions_abis[action_key]
    universal_router_execute->>UniversalRouter: execute(encoded_commands, encoded_inputs, deadline) value: ether_amount
    UniversalRouter-->>Caller: tx receipt / HexBytes
Loading

Reviews (1): Last reviewed commit: "Docstrings clarification, comments on un..." | Re-trigger Greptile

Comment thread tests/test_uniswap4.py Outdated
Comment thread uniswap/uniswap4.py Outdated
Comment thread tests/test_uniswap4.py Outdated
Comment thread uniswap/uniswap4.py
@liquid-8 liquid-8 merged commit 759d5cf 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