mirror of
https://github.com/Instadapp/assembly.git
synced 2024-07-29 22:37:06 +00:00
add message for min debt on payback
This commit is contained in:
parent
cfd957648f
commit
c913be69ad
|
@ -136,7 +136,7 @@ export default defineComponent({
|
|||
const maxBalance = computed(() => min(balance.value, debt.value).toFixed())
|
||||
const { toggle, isMaxAmount } = useMaxAmountActive(amount, maxBalance)
|
||||
|
||||
const { validateAmount, validateLiquidation, validateIsLoggedIn, validateReflexerDebt } = useValidators()
|
||||
const { validateAmount, validateLiquidation, validateIsLoggedIn, validateReflexerPaybackDebt } = useValidators()
|
||||
const errors = computed(() => {
|
||||
const hasAmountValue = !isZero(amount.value)
|
||||
|
||||
|
@ -145,7 +145,7 @@ export default defineComponent({
|
|||
amount: { message: validateAmount(amountParsed.value, maxBalance.value), show: hasAmountValue },
|
||||
liquidation: { message: validateLiquidation(status.value, liquidation.value), show: hasAmountValue },
|
||||
auth: { message: validateIsLoggedIn(!!account.value), show: true },
|
||||
minDebt: { message: validateReflexerDebt(changedDebt.value), show: hasAmountValue },
|
||||
minDebt: { message: validateReflexerPaybackDebt(changedDebt.value), show: hasAmountValue },
|
||||
}
|
||||
})
|
||||
const { errorMessages, isValid } = useValidation(errors)
|
||||
|
|
|
@ -114,7 +114,7 @@ export function useValidators() {
|
|||
function validateReflexerDebt(
|
||||
debtParsed,
|
||||
minDebt = reflexerMinDebt.value,
|
||||
vaultId
|
||||
vaultId,
|
||||
) {
|
||||
if (lt(debtParsed, minDebt) && gt(debtParsed, "0")) {
|
||||
const vaultText = vaultId
|
||||
|
@ -122,7 +122,28 @@ export function useValidators() {
|
|||
? `on vault #${vaultId}`
|
||||
: `on new vault`
|
||||
: "";
|
||||
return `Minimum debt requirement is ${minDebt} RAI ${vaultText}`;
|
||||
|
||||
return `Minimum debt requirement is ${minDebt} RAI ${vaultText}` ;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function validateReflexerPaybackDebt(
|
||||
debtParsed,
|
||||
minDebt = reflexerMinDebt.value,
|
||||
vaultId,
|
||||
) {
|
||||
console.log(debtParsed, minDebt);
|
||||
|
||||
if (lt(debtParsed, minDebt) && gt(debtParsed, "0")) {
|
||||
const vaultText = vaultId
|
||||
? vaultId !== "0"
|
||||
? `on vault #${vaultId}`
|
||||
: `on new vault`
|
||||
: "";
|
||||
|
||||
return `Minimum debt requirement is ${minDebt} RAI ${vaultText} + accumulated interest, supply additional ${debtParsed} RAI` ;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -164,5 +185,6 @@ export function useValidators() {
|
|||
validateLiquityTroveExists,
|
||||
validateReflexerDebtCeiling,
|
||||
validateReflexerDebt,
|
||||
validateReflexerPaybackDebt,
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user