Skip to content

Commit

Permalink
💄 floating-chart: fit extreme utilizations
Browse files Browse the repository at this point in the history
  • Loading branch information
cruzdanilo committed Jun 5, 2024
1 parent cace4a7 commit 50800cc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion components/charts/UtilizationRateChart/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ const colorscale = [...Array(60)].map(
`hsl(${360 * (1 - (i === length - 1 ? 1 : i / (length - 1)))} 100% 50%)`,
] satisfies [number, string],
);
const max = (a: bigint, b?: bigint) => (b == null || a > b ? a : b);

function UtilizationRateChart({ type, symbol }: Props) {
const { t } = useTranslation();
const { palette } = useTheme();

const globalUtilization = useGlobalUtilization(symbol);
const { data, loading } = useUtilizationRate(symbol, 0n, 95n * 10n ** 16n);
const { data, loading } = useUtilizationRate(symbol, 0n, max(95n * 10n ** 16n, globalUtilization));
const { borrowAPR } = useFloatingPoolAPR(symbol);
const currentUtilization = useCurrentUtilizationRate('floating', symbol);
const ref = useRef<HTMLDivElement>(null);
Expand Down

0 comments on commit 50800cc

Please sign in to comment.