Conversation
Adds a toggleable "Aave Shield" feature that blocks swap operations when price impact exceeds 25%. Enabled by default, persisted in localStorage, and accessible from the settings menu on both desktop and mobile. When Shield blocks a swap, the action button shows "Blocked by Shield" and an error banner explains the reason and how to disable it. Covers all 5 swap types: Swap, CollateralSwap, DebtSwap, RepayWithCollateral, and WithdrawAndSwap (both Paraswap and CoW Protocol providers).
Limit orders are off-chain intents that only execute at the user's specified price, so price impact is not meaningful. Also guard against empty/zero USD amounts that could falsely trigger the shield.
The loading issue was caused by empty/zero USD amounts falsely triggering 100% price impact. The zero-amount guard fixes this for both market and limit orders without needing to exclude limits.
Capture the new shield state before calling toggleShield() so the analytics event doesn't depend on closure timing. Also fix the zero-amount guard: a quote returning buyAmountUSD=0 with nonzero sell is a real scenario (total value loss from fees), not missing data. Only skip when sell amount is unpopulated.
…tages Show error (red) instead of warning (yellow) when price impact exceeds 30%. Bold the percentage values in both warning and confirmation text for better visibility.
Reword the warning, confirmation checkbox, and add a "review before confirming" line to make the risk clearer to users.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
This PR updates the Swap UX around high price impact messaging and improves behavior when the app is in watch-wallet (read-only) mode, with corresponding locale updates.
Changes:
- Updated the High Price Impact warning copy and added the new string to locale bundles.
- Extended Swap user context to account for
readOnlyModewhen deriving wallet-type context. - Added a read-only mode blocking error path in Swap error rendering.
Reviewed changes
Copilot reviewed 4 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/locales/es/messages.js | Updates compiled Spanish message bundle to include the new High Price Impact warning string. |
| src/locales/en/messages.po | Adds the new High Price Impact warning string and removes the old one. |
| src/locales/en/messages.js | Updates compiled English message bundle to include the new High Price Impact warning string. |
| src/components/transactions/Swap/warnings/postInputs/HighPriceImpactWarning.tsx | Replaces the warning caption copy shown after high price impact is detected. |
| src/components/transactions/Swap/hooks/useUserContext.ts | Reads readOnlyMode from web3 context and adjusts SCW/Safe detection flow accordingly. |
| src/components/transactions/Swap/errors/SwapErrors.tsx | Surfaces a blocking error when attempting Swap flows in watch-wallet mode. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (user && connectedChainId) { | ||
| setState({ user }); | ||
|
|
||
| if (readOnlyMode) return; |
|
📦 Next.js Bundle Analysis for aave-uiThis analysis was generated by the Next.js Bundle Analysis action. 🤖 This PR introduced no changes to the JavaScript bundle! 🙌 |
| return null; | ||
| } | ||
|
|
||
| if (readOnlyMode) { |
There was a problem hiding this comment.
This will block us from impersonate users for testing what rates they see for their current positions setup
There was a problem hiding this comment.
agree, moved to the fallback error b1c1edf
|
📦 Next.js Bundle Analysis for aave-uiThis analysis was generated by the Next.js Bundle Analysis action. 🤖 This PR introduced no changes to the JavaScript bundle! 🙌 |
General Changes
Developer Notes
Add any notes here that may be helpful for reviewers.
Reviewer Checklist
Please ensure you, as the reviewer(s), have gone through this checklist to ensure that the code changes are ready to ship safely and to help mitigate any downstream issues that may occur.
.env.examplefile as well as the pertinant.github/actions/*files