Skip to content

Commit

Permalink
♻️ borrow-apr: use borrow apr from account-data
Browse files Browse the repository at this point in the history
  • Loading branch information
franm91 committed Apr 17, 2024
1 parent e94cfb6 commit 382d5eb
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions components/asset/FloatingPool/FloatingPoolInfo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,25 @@ type FloatingPoolInfoProps = {

const FloatingPoolInfo: FC<FloatingPoolInfoProps> = ({ symbol }) => {
const { t } = useTranslation();
const { depositAPR, borrowAPR } = useFloatingPoolAPR(symbol);
const { depositAPR } = useFloatingPoolAPR(symbol);
const { marketAccount } = useAccountData(symbol);

const { rates } = useRewards();
const { deposited, borrowed } = useMemo(() => {
const { deposited, borrowed, borrowAPR } = useMemo(() => {
if (!marketAccount) return {};

const {
totalFloatingDepositAssets: totalDeposited,
totalFloatingBorrowAssets: totalBorrowed,
floatingBorrowRate,
decimals,
usdPrice,
} = marketAccount;

return {
deposited: Number((totalDeposited * usdPrice) / WAD) / 10 ** decimals,
borrowed: Number((totalBorrowed * usdPrice) / WAD) / 10 ** decimals,
borrowAPR: floatingBorrowRate,
};
}, [marketAccount]);

Expand Down Expand Up @@ -74,7 +77,7 @@ const FloatingPoolInfo: FC<FloatingPoolInfoProps> = ({ symbol }) => {
label: t('Borrow APR'),
value:
borrowAPR !== undefined && marketAccount?.assetSymbol ? (
<ItemCell key={symbol} value={toPercentage(borrowAPR)} symbol={marketAccount.assetSymbol} />
<ItemCell key={symbol} value={toPercentage(Number(borrowAPR) / 1e18)} symbol={marketAccount.assetSymbol} />
) : undefined,
tooltipTitle: t(
'The borrowing interest APR related to the current utilization rate in the Variable Rate Pool.',
Expand Down

0 comments on commit 382d5eb

Please sign in to comment.