Repository navigation
Conversation
The collateral swap modal offered assets with a Loan-to-Value of 0 as swap targets, even though such an asset is not enabled as collateral after the swap. The destination list now filters with the repo's own effective-LTV helper, which mirrors on-chain getUserReserveLtv, so an asset that counts as collateral inside the user's e-mode category is still offered while a truly zero-LTV asset is not. The check lives in collateralSwapDestination.ts with a regression test. Fixes aave#2522
|
@tydavid5 is attempting to deploy a commit to the Aave Team on Vercel. A member of the Team first needs to authorize it. |
This branch has not been deployed
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.
The collateral swap modal offers assets with a Loan-to-Value of 0 as swap targets. That is what this issue reports: swapping sDAI collateral to EURe leaves the user holding an asset that will not be enabled as collateral after the swap, since validateAutomaticUseAsCollateral returns false for a zero effective LTV.
This filters the destination list through the effective-LTV check the codebase already uses, hasNonZeroEffectiveLtv, which mirrors on-chain getUserReserveLtv. So an asset with base LTV 0 that still counts as collateral inside the user's e-mode category keeps showing up, and a genuinely zero-LTV asset does not. The check lives in its own module, collateralSwapDestination.ts, with a regression test covering the zero-LTV case, the e-mode cases, and the no-user fallback.
Verified locally: jest 10/10 (6 new tests plus the 4 existing ZeroLTVBlockingGuard tests), prettier clean, full tsc typecheck clean.
Fixes #2522
General Changes
Developer Notes
Verified locally: jest 10/10 (6 new tests plus the 4 existing ZeroLTVBlockingGuard tests), prettier clean, full tsc typecheck clean.
Author Checklist
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