11import { Box } from '@mui/material' ;
22import { ParentSize } from '@visx/responsive' ;
3- import type { ReserveWithId } from 'src/hooks/app-data-provider/useAppDataProvider' ;
3+ import { useMemo } from 'react' ;
4+ import {
5+ type ReserveWithId ,
6+ useAppDataContext ,
7+ } from 'src/hooks/app-data-provider/useAppDataProvider' ;
48
59import { GraphLegend } from './GraphLegend' ;
610import { InterestRateModelGraph } from './InterestRateModelGraph' ;
@@ -17,6 +21,13 @@ export type Fields = { name: Field; color: string; text: string }[];
1721export const InterestRateModelGraphContainer = ( {
1822 reserve,
1923} : InteresetRateModelGraphContainerProps ) : JSX . Element => {
24+ const { reserves : reservesLegacy } = useAppDataContext ( ) ;
25+ const reserveData = useMemo ( ( ) => {
26+ return reservesLegacy . find (
27+ ( r ) => r . underlyingAsset . toLowerCase ( ) === reserve . underlyingToken . address . toLowerCase ( )
28+ ) ;
29+ } , [ reservesLegacy , reserve ] ) ;
30+
2031 const CHART_HEIGHT = 155 ;
2132 const fields : Fields = [
2233 { name : 'variableBorrowRate' , text : 'Borrow APR, variable' , color : '#B6509E' } ,
@@ -41,7 +52,7 @@ export const InterestRateModelGraphContainer = ({
4152 height = { CHART_HEIGHT }
4253 fields = { fields }
4354 reserve = { {
44- baseVariableBorrowRate : String ( reserve . borrowInfo ?. reserveFactor . raw ) ,
55+ baseVariableBorrowRate : String ( reserveData ?. baseVariableBorrowRate ) ,
4556 optimalUsageRatio : String ( reserve . borrowInfo ?. optimalUsageRate . raw ) ,
4657 utilizationRate : String ( reserve . borrowInfo ?. utilizationRate . value ) ,
4758 variableRateSlope1 : String ( reserve . borrowInfo ?. variableRateSlope1 . raw ) ,
0 commit comments