Skip to content

feat: add Curve swap and LP flows for ethereum mainnet#2

Merged
tsubasakong merged 12 commits intomainfrom
vk/ab15-add-curve-for-et
Mar 26, 2026
Merged

feat: add Curve swap and LP flows for ethereum mainnet#2
tsubasakong merged 12 commits intomainfrom
vk/ab15-add-curve-for-et

Conversation

@tsubasakong
Copy link
Copy Markdown
Collaborator

Summary

  • add a shared DeFi venue layer with top-level defi swap and LP flows plus legacy eth wrappers for Curve on Ethereum mainnet
  • wire Curve RLUSD/USDC pool metadata, deterministic prepared plans, execution helpers, and command coverage across swap, LP, and policy surfaces
  • update runtime and skills docs, then finish the verification matrix with passing tests, build checks, and smoke-command evidence

Test Plan

  • cd rlusd-cli && npm test
  • cd rlusd-cli && npm run typecheck && npm run lint && npm run build
  • cd rlusd-skills && npm test
  • smoke-test node dist/bin/rlusd.js --json defi venues --chain ethereum-mainnet
  • smoke-test node dist/bin/rlusd.js --json defi quote swap --chain ethereum-mainnet --venue curve --from RLUSD --to USDC --amount 100
  • smoke-test node dist/bin/rlusd.js --json defi lp preview --chain ethereum-mainnet --venue curve --operation add --rlusd-amount 100 --usdc-amount 100
  • smoke-test node dist/bin/rlusd.js --json eth swap quote --venue curve --chain ethereum --amount 100 --for USDC
  • smoke-test unsupported Curve pair returns structured error instead of falling back to Uniswap

Made with Cursor

…on plan to `rlusd-cli/docs/plans/2026-03-26-curve-eth-mainnet-defi-integration.md`.

I locked one design choice into the plan so execution can proceed without another round-trip: LP add is dual-asset (`--rlusd-amount` + `--usdc-amount`) and LP remove is one-coin (`--lp-amount` + `--receive-token RLUSD|USDC`). I also made exact Curve ABI verification the first protocol checkpoint before adapter code lands.

Plan complete and saved to `docs/plans/2026-03-26-curve-eth-mainnet-defi-integration.md`. Two execution options:

1. Subagent-Driven (this session) - I dispatch a fresh subagent per task, review between tasks, and iterate here.
2. Parallel Session (separate) - open a new session on this worktree and execute the plan task-by-task with the plan runner workflow.

Which approach do you want?
Make top-level DeFi and legacy swap routing explicit so agents cannot rely on hidden defaults when preparing or executing venue-specific flows.

Made-with: Cursor
Freeze the RLUSD-USDC Curve pool config and resolver contract so agent flows can target a single verified ethereum-mainnet venue without discovery or implicit defaults.

Made-with: Cursor
…rve as preview

The top-level defi subcommands used requiredOption("--chain") which broke
the global --chain flag (Commander doesn't propagate parent options to
satisfy child requiredOptions). Switch to optional --chain with fallback
through program.opts().chain and config.default_chain.

Also change curve venue status from "active" to "preview" so discovery
consumers don't route swap requests to a venue that only supports
uniswap today. Update README examples to include the now-required --venue
flag.

Made-with: Cursor
Centralize DeFi quote routing and prepared-plan execution so new venues can plug into the CLI without duplicating command logic.

Made-with: Cursor
…al metadata

resolveCurvePool() now detects when the config override points at a
non-canonical address and emits a warning that coin list, coin indices,
and LP-token assumptions are still derived from the verified RLUSD/USDC
pool. Adds tests for the override path, no-warn-on-canonical path, and
non-ethereum chain rejection in config set.

Made-with: Cursor
Add Curve-only LP preview, prepare, and execute flows to the top-level defi command so liquidity plans use the shared venue adapter and execution path.

Made-with: Cursor
Add legacy eth lp wrappers and route venue-aware eth swap flows through the shared DeFi helpers so legacy commands follow the same Curve and Uniswap constraints as top-level defi.

Made-with: Cursor
Document the top-level DeFi command surface so consumers use explicit chain and venue flags and understand the prepared Curve swap and LP flows.

Made-with: Cursor
…ceive-token case

add_liquidity and remove_liquidity_one_coin were hardcoding 0n for their
min output parameters, allowing arbitrarily worse execution if the pool
moved between preview and execution. Both now compute a slippage-adjusted
minimum (matching the swap path pattern). The --receive-token flag was
also case-sensitive; it now normalizes via toUpperCase().

Made-with: Cursor
Clarify which top-level DeFi flows return prepared plans versus preview data and document explicit flags as the recommended automation path without overstating runtime requirements.

Made-with: Cursor
Remove dead symbols in the Curve and legacy swap paths so the verification matrix can pass cleanly without changing runtime behavior.

Made-with: Cursor
@tsubasakong tsubasakong merged commit 574a0ed into main Mar 26, 2026
4 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