Restrict repay asset selection when user has LTV=0 collateral
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 536
- Forks
- 496
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 9
Description
Is your feature request related to a problem? Please describe.
Currently, when a user has a collateral with LTV=0, the repay function allows selecting any asset. According to the contract, this can cause invalid transactions because the LTV=0 asset must be repaid or withdrawn first:
if (hasZeroLtvCollateral) {
require(
getUserReserveLtv(
reservesData[asset],
eModeCategories[userEModeCategory],
userEModeCategory
) == 0,
Errors.LtvValidationFailed()
);
}
This check ensures a multi-collateral position handles the zero-LTV asset first. Without restricting selection, users may see failed transactions.
Describe the solution you'd like
Limit the repay asset selection in the UI or SDK so that if the user has an LTV=0 collateral, only the zero-LTV asset can be used for repay.
Describe alternatives you've considered
• Showing a warning but allowing all assets (may still cause transaction failure).
• Automatically selecting the LTV=0 asset if present.
Additional context
This is an example error tx you can check: https://etherscan.io/tx/0xd0b25ffaaeb76fc5e2fb4700cd4ac554e65ec41673fef523aa881b0501b7626c
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing repay asset selection in the UI or SDK and compare its behavior with the Solidity LTV validation shown in the issue. Done means a user with LTV=0 collateral can select only the zero-LTV asset for repayment, while unaffected positions retain their existing selection behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100