-
Notifications
You must be signed in to change notification settings - Fork 455
All Swaps Modals Refactor + CoW Protocol Adapters support #2739
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mgrabina
wants to merge
46
commits into
main
Choose a base branch
from
feat/cow-swap-adapters
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
61ade69 to
e8fb88d
Compare
e8fb88d to
515287a
Compare
515287a to
0744de1
Compare
ee84766 to
ef4092a
Compare
ef4092a to
71e1637
Compare
b43732a to
8b52a92
Compare
af756ac to
d3359cc
Compare
d3359cc to
55bc7f5
Compare
79d0c47 to
8d3b5c1
Compare
8d3b5c1 to
9a21671
Compare
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
Why
Architecture
Key changes
src/components/transactions/Swap/with a clear separation:modals/(entry + content),inputs/,warnings/,details/,actions/,hooks/,helpers/,types/,constants/,analytics/.helpers/shared/provider.helpers.ts#getSwitchProviderchooses CoW when supported, else falls back to ParaSwap.hooks/useSwapQuoteorchestrates quotes and normalizes results across providers.hooks/useFlowSelectorderives HF impact and selects flash‑loan vs simple flow.hooks/useSwapOrderAmountscomputes normalized sell/buy amounts, applies partner fee, slippage, and handles inversion.hooks/useSwapGasEstimationprovides consistent gas hints and toggles Gas Station.actions/approval/useSwapTokenApproval.tshandles ERC‑20 approvals, EIP‑2612 permits, and Aave credit delegation, including USDT reset logic.Architecture and docs
src/components/transactions/Swap/README.mdsrc/components/transactions/Swap/docs/swap-modal-architecture.pngmodals/request/BaseSwapModalContent.tsx(composition root, hook order, state ownership)hooks/*(quotes, flow selection, amounts, slippage, gas, reserves, native max)actions/*(CoW/ParaSwap, protocol flows, responsibilities, flash‑loan notes)helpers/shared/provider.helpers.ts(provider selection policy)types/state.types.ts,types/params.types.ts,types/tokens.types.ts,types/quote.types.ts,types/shared.types.ts(field‑level TSDoc)Important logic clarifications
isInvertedSwapandprocessedSideso orders/quotes are correctly built:UX behavior
safeSlippagederived for guards; CoW suggested slippage surfaces warnings if user input is too low.Testing notes