Skip to content

Commit

Permalink
馃毟 AssetHeader: get maxUtilization from Previewer
Browse files Browse the repository at this point in the history
  • Loading branch information
sebipap committed Mar 19, 2024
1 parent ed37d0d commit 8f94a45
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions components/asset/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,11 @@ const AssetHeaderInfo: FC<Props> = ({ symbol }) => {
[push, query, symbol],
);

const borrowableUtilization = useMemo(() => {
if (!marketAccount) return;
return Number(WEI_PER_ETHER - marketAccount.reserveFactor) / 1e18;
}, [marketAccount]);

return (
<>
<Grid
Expand Down Expand Up @@ -194,11 +199,14 @@ const AssetHeaderInfo: FC<Props> = ({ symbol }) => {
))}
</Grid>
</Grid>
{totalUtilization && totalUtilization > 0.9 && (
{totalUtilization && borrowableUtilization && totalUtilization > borrowableUtilization && (
<Alert sx={{ width: '100%' }} severity="info">
<Typography variant="body2">
{t(
"The Global Utilization is above 90%, and the remaining liquidity is established as a Liquidity Reserve that can't be borrowed and is only available for withdrawals.",
"The Global Utilization is above {{maxUtilization}}, and the remaining liquidity is established as a Liquidity Reserve that can't be borrowed and is only available for withdrawals.",
{
maxUtilization: toPercentage(borrowableUtilization, 0),
},
)}
</Typography>
<Typography variant="body2">
Expand Down

0 comments on commit 8f94a45

Please sign in to comment.