Skip to content

feat: dollar tokens Phase 3 foundation (re-targeted to Development)#150

Merged
TuCopFi merged 11 commits into
Developmentfrom
feat/dollars-spend-foundation
Jun 4, 2026
Merged

feat: dollar tokens Phase 3 foundation (re-targeted to Development)#150
TuCopFi merged 11 commits into
Developmentfrom
feat/dollars-spend-foundation

Conversation

@TuCopFi

@TuCopFi TuCopFi commented Jun 4, 2026

Copy link
Copy Markdown
Member

Summary

Re-opens Phase 3 foundation against Development. The original PR #149 was mistakenly stacked on top of feat/integrate-usdc-usdm-usat-phase1 (PR #148's branch) and got merged into that feature branch instead of Development, so the 11 Phase 3 commits never reached Development.

PR #148 (Phase 1 + Phase 2) is already in Development as expected.

Same code as PR #149, same verification status. No changes needed; this is a re-target.

What this PR contains

New module src/dollarsSpend/ (foundation only - no UI integration):

  • types.ts - SpendStep, MultiSwapPlan, DollarTokenBalanceSnapshot, SPEND_ORDER (USAT > USDm > USDC > USDT), DOLARES_VIRTUAL_TOKEN_ID
  • planSpend.ts - pure planner walking spend order with dust filter (9 unit tests)
  • slice.ts - Redux state for in-flight multi-swap (8 unit tests)
  • useMultiSwapQuote.ts - fetches N Squid quotes in parallel for upfront totals (4 unit tests)
  • saga.ts - executeMultiSwapSaga orchestrator: per-step quote refetch + dispatch swapStart + race(swapSuccess/swapError) on swapId (3 saga tests)
  • selectors.ts - inFlight, hasInFlight, inFlightProgress (5 unit tests)
  • useDollarBalanceSnapshots.ts - builds the planner's input array from the wallet token state (3 unit tests)
  • index.ts - barrel re-exports

Auxiliary:

  • src/swap/useSwapQuote.ts - extract fetchSwapQuote as a named export (lightweight price-discovery function)
  • src/redux/reducersList.ts + src/redux/sagas.ts - register slice + saga
  • src/redux/migrations.ts + src/redux/store.ts - migration 247 + persistConfig.version bump
  • test/RootStateSchema.json + test/schemas.ts - regenerated, v247Schema added
  • knip.ts - ignore dollarsSpend barrel until Phase 3.2 UI consumes it

Verification (verified locally before push)

  • yarn build:ts - pass
  • yarn lint - pass
  • yarn test - 374 suites pass, 4029 tests pass, 96 snapshots pass, 0 failures
  • yarn knip --no-gitignore - dollarsSpend barrel ignored

Known follow-ups for Phase 3.2 (UI integration, separate PR)

  • TokenBottomSheet collapseDollars prop
  • SwapScreen + GoldBuyEnterAmount + SendEnterAmount route the virtual tokenId through the planner
  • MultiSwapProgressSheet + PartialSuccessSheet for in-flight + partial-failure states
  • New i18n keys (dollarsSpend.*)
  • Mainnet QA of the full chain
  • Architectural item: the orchestrator saga passes preparedTransactions: [] because the light fetchSwapQuote does not build them; Phase 3.2 must either (a) extend fetchSwapQuote to call prepareSwapTransactions per step, or (b) have the UI use the full useSwapQuote to prebuild quotes including preparedTransactions for each step and pass them via the action payload.

@TuCopFi TuCopFi merged commit bb87221 into Development Jun 4, 2026
9 checks passed
@TuCopFi TuCopFi deleted the feat/dollars-spend-foundation branch June 12, 2026 06:27
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