From b45b9b915caa15b9208563a93ea0b477a7a9f6a8 Mon Sep 17 00:00:00 2001 From: Frederik Gartenmeister Date: Fri, 13 Sep 2024 14:59:48 +0200 Subject: [PATCH] adapt docs and use correct reserve amount (#2448) --- .../NavManagement/NavManagementAssetTable.tsx | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/centrifuge-app/src/pages/NavManagement/NavManagementAssetTable.tsx b/centrifuge-app/src/pages/NavManagement/NavManagementAssetTable.tsx index 83cbdd0c42..5189e2c540 100644 --- a/centrifuge-app/src/pages/NavManagement/NavManagementAssetTable.tsx +++ b/centrifuge-app/src/pages/NavManagement/NavManagementAssetTable.tsx @@ -195,6 +195,11 @@ export function NavManagementAssetTable({ poolId }: { poolId: string }) { // eslint-disable-next-line react-hooks/exhaustive-deps }, [initialValues, isEditing, isLoading]) + + // NOTE: This assumes that pool.reserve.total comes from onchain state AND NOT from the runtime-apis + const totalAum = pool.nav.aum.toDecimal().add(pool.reserve.total.toDecimal()) + + // NOTE: current pending here in the app does include both pending + disbursed fees const pendingFees = React.useMemo(() => { return new CurrencyBalance( poolFees?.map((f) => f.amounts.pending).reduce((acc, f) => acc.add(f), new BN(0)) ?? new BN(0), @@ -214,7 +219,6 @@ export function NavManagementAssetTable({ poolId }: { poolId: string }) { }, new CurrencyBalance(0, pool.currency.decimals)) }, [externalLoans, pool?.nav, form.values.feed]) - const totalAum = pool.nav.aum.toDecimal().add(pool.reserve.available.toDecimal()) const pendingNav = totalAum.add(changeInValuation.toDecimal()).sub(pendingFees.toDecimal()) // Only for single tranche pools @@ -319,7 +323,13 @@ export function NavManagementAssetTable({ poolId }: { poolId: string }) { return ( <> - + @@ -411,28 +421,18 @@ export function NavManagementAssetTable({ poolId }: { poolId: string }) { ) } -export function NavOverviewCard({ poolId, changeInValuation }: { poolId: string; changeInValuation: number }) { +export function NavOverviewCard({ poolId, changeInValuation, totalAum, pendingFees, pendingNav }: { poolId: string; changeInValuation: number; totalAum: number; pendingFees: number; pendingNav: number}) { const pool = usePool(poolId) - const poolFees = usePoolFees(poolId) const today = new Date() today.setHours(0, 0, 0, 0) - const pendingFees = React.useMemo(() => { - return new CurrencyBalance( - poolFees?.map((f) => f.amounts.pending).reduce((acc, f) => acc.add(f), new BN(0)) ?? new BN(0), - pool.currency.decimals - ) - }, [poolFees, pool.currency.decimals]) - - const totalAum = pool.nav.aum.toDecimal().add(pool.reserve.available.toDecimal()) - return ( ) }