Skip to content

feat: agent skill with a working Sepolia v2 demo - #498

Merged
ErikBjare merged 2 commits into
uniswap-python:masterfrom
TimeToBuildBob:feat/d3-sepolia-v2-demo
Nov 27, 2026
Merged

ErikBjare merged 2 commits into
uniswap-python:masterfrom
TimeToBuildBob:feat/d3-sepolia-v2-demo

Conversation

@TimeToBuildBob

@TimeToBuildBob TimeToBuildBob commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

The previous Sepolia demo selected v3, which the wrapper explicitly refuses. The existing v2 client already quotes and swaps native ETH to USDC on Sepolia, so D3 does not need to wait for the separate v3/v4 address and ABI work.

Restores the agent CLI and extends its safety tests from closed #478, and replaces the blocked demo with a v2 native-ETH path. The script defaults to quote/dry-run, refuses a non-Sepolia endpoint, requires an explicit broadcast opt-in, and checks the mined receipt. Documentation names the library-configured deployment, explains the differing WETH addresses, and distinguishes local fork evidence from the outstanding public-testnet receipt.

Also fixes the restored wrapper’s double v4 slippage and unconditional approval-success reporting. v4 now preserves the supplied minimum; v2/v3 minima are explicitly estimates because the library requotes. Approval results distinguish submitted hashes from successful receipts, and v3 testnet approvals are refused consistently. Human-readable token amounts retain exact base-unit precision.

Validation: 41 offline tests pass; make typecheck passes with the Poetry lockfile; the wrapper passes a separate mypy check; Ruff, ShellCheck, and skill validation pass. A complete local Sepolia-fork replay mined with status 1, used 113,656 gas, and received 45,103,109 USDC base units for 0.001 ETH. The default run and wrong-chain refusal both leave the account nonce unchanged. The earlier v3 invocation reproduces the deterministic safety refusal. Ten new regression cases failed before the review fixes; the v4 case decodes the actual library-generated calldata (9801 before vs 9900 required). Fork swap and v2 approval both succeed after the fixes.

The public Sepolia transaction is still outstanding and is tracked in #497; merging this PR alone does not close D3. No library or workflow changes.

Git-Session-Id: b095cf1f-fa2b-459a-88b4-e662964f9fb3
@TimeToBuildBob

Copy link
Copy Markdown
Contributor Author

What changed: 5 files, +902/-0 in skills/uniswap-trading/scripts/, skills/uniswap-trading/, skills/uniswap-trading/tests/
Riskiest file: skills/uniswap-trading/scripts/uniswap_agent.py (+472/-0)
Test: make typecheck

Review guide

Key files

  • skills/uniswap-trading/scripts/uniswap_agent.py (+472/-0, Δ472)
  • skills/uniswap-trading/tests/test_safety_gates.py (+156/-0, Δ156)
  • skills/uniswap-trading/README.md (+114/-0, Δ114)
  • skills/uniswap-trading/SKILL.md (+97/-0, Δ97)
  • skills/uniswap-trading/demo_sepolia.sh (+63/-0, Δ63)

Suggested verification

  • make typecheck
  • shellcheck <changed-shell-scripts>

Auto-posted by scripts/github/pr-warmup-review-guide.py for #498.

@codecov

codecov Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.05%. Comparing base (5fa5c57) to head (8bfc0f6).
⚠️ Report is 15 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #498      +/-   ##
==========================================
+ Coverage   71.03%   71.05%   +0.02%     
==========================================
  Files          14       14              
  Lines        4302     4302              
==========================================
+ Hits         3056     3057       +1     
+ Misses       1246     1245       -1     

☔ 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 Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5 · The reviewed changes appear safe to merge.RetriggerView in GreptileConfidence Score: 5/5

[Critical impact] The reviewed changes appear safe to merge.

Summary

Adds an agent CLI and a Sepolia v2 demo that defaults to quoting and dry-run.

  • Agents can inspect Uniswap quotes, balances, and swap plans from one CLI.
  • Swap plans show the right minimum, and approval results distinguish sent transactions from confirmed ones.
  • The Sepolia demo previews a native-ETH v2 swap before an optional send.

Reviews (2) · Last reviewed commit: "fix: preserve swap limits and report app..." · Reviewed by Greptile

Git-Session-Id: b095cf1f-fa2b-459a-88b4-e662964f9fb3
@TimeToBuildBob

Copy link
Copy Markdown
Contributor Author

Fixed all five findings in 8bfc0f6 after reproducing them (10 failing regression cases before the patch):

  • v4 slippage: the real library-encoded minimum was 9801 when the wrapper reported 9900. Disable the second slippage adjustment and compute the wrapper minimum with exact arithmetic; the regression decodes the real v4 calldata, including a large integer case.
  • Approvals: v2/v3 inspect receipt status, include the hash, and fail on a reverted receipt. v4 reports only status: submitted with the final Permit2 hash, without approved: true; docs require checking the receipt and both allowances before trading.
  • Unsupported v3 approvals: apply the same version gate before sending.
  • Human amounts: integer formatting preserves one wei and large balances exactly.
  • v2/v3 requotes: rename the advisory output to estimated_min_out and explain why it can differ from the transaction minimum.

41 tests and both typechecks pass. Replayed the complete v2 fork demo again (status 1, 113656 gas) and a v2 approval (confirmed receipt with hash). Public Sepolia execution remains outstanding in #497; the fork receipts do not satisfy it. Current-head CI is running.

@TimeToBuildBob

Copy link
Copy Markdown
Contributor Author

@greptileai review

@ErikBjare
ErikBjare merged commit df4c8bc into uniswap-python:master Nov 27, 2026
6 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.

2 participants