feat: add Curve swap and LP flows for ethereum mainnet#2
Merged
tsubasakong merged 12 commits intomainfrom Mar 26, 2026
Merged
Conversation
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
defiswap and LP flows plus legacyethwrappers for Curve on Ethereum mainnetTest Plan
cd rlusd-cli && npm testcd rlusd-cli && npm run typecheck && npm run lint && npm run buildcd rlusd-skills && npm testnode dist/bin/rlusd.js --json defi venues --chain ethereum-mainnetnode dist/bin/rlusd.js --json defi quote swap --chain ethereum-mainnet --venue curve --from RLUSD --to USDC --amount 100node dist/bin/rlusd.js --json defi lp preview --chain ethereum-mainnet --venue curve --operation add --rlusd-amount 100 --usdc-amount 100node dist/bin/rlusd.js --json eth swap quote --venue curve --chain ethereum --amount 100 --for USDCMade with Cursor