From f268201e0991bc74045a5f793851c5fad7014b9f Mon Sep 17 00:00:00 2001 From: Tyler Shipe Date: Tue, 24 Aug 2021 13:04:43 -0400 Subject: [PATCH] tweak decimal precision on stats --- hooks/useMangoStats.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hooks/useMangoStats.tsx b/hooks/useMangoStats.tsx index 82e5c23d..5e825432 100644 --- a/hooks/useMangoStats.tsx +++ b/hooks/useMangoStats.tsx @@ -2,6 +2,7 @@ import { useEffect, useState } from 'react' import { I80F48 } from '@blockworks-foundation/mango-client' import useMangoStore from '../stores/useMangoStore' import useMangoGroupConfig from './useMangoGroupConfig' +import { tokenPrecision } from '../utils' const useMangoStats = () => { const [stats, setStats] = useState([ @@ -50,8 +51,12 @@ const useMangoStats = () => { return { time: new Date(), name: token.symbol, - totalDeposits: totalDeposits.toFixed(2), - totalBorrows: totalBorrows.toFixed(2), + totalDeposits: totalDeposits.toFixed( + tokenPrecision[token.symbol] || 2 + ), + totalBorrows: totalBorrows.toFixed( + tokenPrecision[token.symbol] || 2 + ), depositInterest: rootBank .getDepositRate(mangoGroup) .mul(I80F48.fromNumber(100)),