Skip to content

Restrict repay asset selection when user has LTV=0 collateral #2873

@hz002

Description

@hz002

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or requestnew issueThis issue has not been triaged by the core team yet

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions