Skip to content

Feat/aave shield#2902

Open
foodaka wants to merge 9 commits intomainfrom
feat/aave-shield
Open

Feat/aave shield#2902
foodaka wants to merge 9 commits intomainfrom
feat/aave-shield

Conversation

@foodaka
Copy link
Collaborator

@foodaka foodaka commented Mar 16, 2026

General Changes

  • Fixes XYZ bug
  • Adds XYZ feature

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.

  • End-to-end tests are passing without any errors
  • Code changes do not significantly increase the application bundle size
  • If there are new 3rd-party packages, they do not introduce potential security threats
  • If there are new environment variables being added, they have been added to the .env.example file as well as the pertinant .github/actions/* files
  • There are no CI changes, or they have been approved by the DevOps and Engineering team(s)

mgrabina and others added 8 commits March 13, 2026 10:30
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.
Copilot AI review requested due to automatic review settings March 16, 2026 13:18
@vercel
Copy link

vercel bot commented Mar 16, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
interface Ready Ready Preview, Comment Mar 16, 2026 2:26pm

Request Review

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 readOnlyMode when 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;
@github-actions
Copy link

@github-actions
Copy link

📦 Next.js Bundle Analysis for aave-ui

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

mgrabina
mgrabina previously approved these changes Mar 16, 2026
return null;
}

if (readOnlyMode) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will block us from impersonate users for testing what rates they see for their current positions setup

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree, moved to the fallback error b1c1edf

@github-actions
Copy link

@github-actions
Copy link

📦 Next.js Bundle Analysis for aave-ui

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

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.

3 participants