Skip to content

Commit

Permalink
fix transfer debt (#2134)
Browse files Browse the repository at this point in the history
Co-authored-by: Sophia <littlejohn.sophia@gmail.com>
  • Loading branch information
onnovisser and sophialittlejohn authored May 16, 2024
1 parent 9ea0249 commit 1fe41c7
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions centrifuge-app/src/pages/Loan/TransferDebtForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ export function TransferDebtForm({ loan }: { loan: LoanType }) {
borrowAmount = borrow.amount
}

const outstandingPrincipal = selectedLoan.totalBorrowed.sub(selectedLoan.repaid.principal)
let principal: BN = new BN(borrowAmount)
let interest = new BN(0)
if (principal.gt(outstandingPrincipal)) {
interest = principal.sub(outstandingPrincipal)
principal = outstandingPrincipal
const { outstandingInterest } = selectedLoan
let interest = new BN(borrowAmount)
let principal = new BN(0)
if (interest.gt(outstandingInterest)) {
interest = outstandingInterest
principal = interest.sub(outstandingInterest)
}
let repay: any = { principal, interest }
if (isExternalLoan(selectedLoan)) {
Expand Down

0 comments on commit 1fe41c7

Please sign in to comment.