Skip to content

Commit

Permalink
fix(ui-ux): allow adding of dusd collateral with active dusd loan (#4131
Browse files Browse the repository at this point in the history
)
  • Loading branch information
lykalabrada authored Nov 9, 2023
1 parent c074dcf commit 13cf063
Showing 1 changed file with 7 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -390,25 +390,14 @@ export function AddOrRemoveCollateralScreen({ route }: Props): JSX.Element {
};
} else if (
hasLoan &&
vault.loanAmounts.some((loan) => loan.symbol === "DUSD")
vault.loanAmounts.some((loan) => loan.symbol === "DUSD") &&
vault.collateralAmounts.every((col) => col.symbol === "DUSD") &&
!["DFI", "DUSD"].includes(selectedCollateralItem.token.symbol)
) {
const has100PercentDusdCol = vault.collateralAmounts.every(
(col) => col.symbol === "DUSD",
);
if (
(isFeatureAvailable("loop_dusd") &&
has100PercentDusdCol &&
!["DFI", "DUSD"].includes(selectedCollateralItem.token.symbol)) ||
(!has100PercentDusdCol &&
selectedCollateralItem.token.symbol === "DUSD") ||
(selectedCollateralItem.token.symbol === "DFI" &&
isDFILessThanHalfOfRequiredCollateral)
) {
return {
testID: "full_dusd_col_affected_vault_error",
message: addOrRemoveCollateralErrors.DusdAffectVault,
};
}
return {
testID: "full_dusd_col_affected_vault_error",
message: addOrRemoveCollateralErrors.DusdAffectVault,
};
}
};
const getRemoveCollateralErrorMessage = ():
Expand Down

0 comments on commit 13cf063

Please sign in to comment.