Skip to content

Commit

Permalink
Fix total nav
Browse files Browse the repository at this point in the history
  • Loading branch information
kattylucy committed Feb 11, 2025
1 parent 417ae5e commit bff4d13
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions centrifuge-app/src/components/Dashboard/assets/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,14 @@ export const useLoanCalculations = (transformedLoans: TransformedLoan[]) => {
}, Dec(0))
}, [uniquePools])

const total = useMemo(() => {
return onchainReserve.add(offchainReserve).add(totalAssets)
}, [onchainReserve, offchainReserve, totalAssets])

const totalNAV = useMemo(() => {
return total.sub(pendingFees)
}, [total, pendingFees])
return uniquePools.reduce((sum, loan) => {
const navTotal = loan.pool.nav?.total || '0'
const navAmount = new CurrencyBalance(navTotal, loan.pool.currency.decimals).toDecimal()
return sum.add(navAmount)
}, Dec(0))
}, [uniquePools])

return {
totalLoans,
totalAssets,
Expand Down

0 comments on commit bff4d13

Please sign in to comment.