Skip to content

Commit 894a76c

Browse files
authored
fix: format interestRates (#186)
1 parent f481827 commit 894a76c

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

src/govv3/checks/state.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,11 @@ export async function deepDiff({
109109
accessChain: string[];
110110
type?: string;
111111
}): Promise<string> {
112-
if (type && accessChain.length === 1 && ['_reserves', 'assets', 'assetsSources'].includes(type)) {
112+
if (
113+
type &&
114+
accessChain.length === 1 &&
115+
['_reserves', 'assets', 'assetsSources', '_interestRateData'].includes(type)
116+
) {
113117
accessChain[0] = await addAssetSymbol(client, accessChain[0] as Address);
114118
}
115119
if (typeof before !== 'object' || typeof after !== 'object') {
@@ -263,10 +267,20 @@ async function enhanceValue({
263267
if (asset) return prettifyNumber({decimals: asset.decimals, value, showDecimals: true});
264268
}
265269
// values to be rendered with ray decimals
266-
if (key && ['_reserves', '_eModeCategories'].includes(type)) {
270+
if (key && ['_reserves', '_eModeCategories', '_interestRateData'].includes(type)) {
267271
if (['liquidityIndex', 'variableBorrowIndex'].includes(key))
268272
return prettifyNumber({decimals: 27, value, showDecimals: true});
269-
if (['liquidationThreshold', 'reserveFactor', 'liquidationProtocolFee', 'ltv'].includes(key))
273+
if (
274+
[
275+
'liquidationThreshold',
276+
'reserveFactor',
277+
'liquidationProtocolFee',
278+
'ltv',
279+
'optimalUsageRatio',
280+
'variableRateSlope1',
281+
'variableRateSlope2',
282+
].includes(key)
283+
)
270284
return prettifyNumber({decimals: 2, value, suffix: '%', showDecimals: true});
271285
if (
272286
['currentLiquidityRate', 'currentVariableBorrowRate', 'currentStableBorrowRate'].includes(

0 commit comments

Comments
 (0)