Skip to content

Commit

Permalink
fix validation
Browse files Browse the repository at this point in the history
  • Loading branch information
onnovisser authored and JP Angelle committed Sep 13, 2023
1 parent 43d91ac commit 60ea5ba
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions centrifuge-app/src/pages/Loan/ExternalFinanceForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export function ExternalFinanceForm({ loan }: { loan: LoanType }) {
settlementPrice(),
(val: any) => {
const num = val instanceof Decimal ? val.toNumber() : val
const financeAmount = num * (financeForm.values.faceValue || 1)
const financeAmount = (num * (financeForm.values.faceValue || 1)) / 100

return financeAmount > availableFinancing.toNumber()
? `Amount exceeds available reserve (${formatBalance(
Expand All @@ -159,7 +159,7 @@ export function ExternalFinanceForm({ loan }: { loan: LoanType }) {
},
(val: any) => {
const num = val instanceof Decimal ? val.toNumber() : val
const financeAmount = num * (financeForm.values.faceValue || 1)
const financeAmount = (num * (financeForm.values.faceValue || 1)) / 100

return financeAmount > maxBorrow.toNumber()
? `Amount exceeds max borrow (${formatBalance(maxBorrow, pool?.currency.symbol, 2)})`
Expand Down Expand Up @@ -254,7 +254,7 @@ export function ExternalFinanceForm({ loan }: { loan: LoanType }) {
settlementPrice(),
(val: any) => {
const num = val instanceof Decimal ? val.toNumber() : val
const repayAmount = num * (repayForm.values.faceValue || 1)
const repayAmount = (num * (repayForm.values.faceValue || 1)) / 100

return repayAmount > balance.toNumber()
? `Your wallet balance (${formatBalance(
Expand All @@ -267,7 +267,7 @@ export function ExternalFinanceForm({ loan }: { loan: LoanType }) {
},
(val: any) => {
const num = val instanceof Decimal ? val.toNumber() : val
const repayAmount = num * (repayForm.values.faceValue || 1)
const repayAmount = (num * (repayForm.values.faceValue || 1)) / 100

return repayAmount > debt.toNumber() ? 'Amount exceeds outstanding' : ''
}
Expand Down

0 comments on commit 60ea5ba

Please sign in to comment.