Skip to content

Commit

Permalink
fix: format interestRates (#186)
Browse files Browse the repository at this point in the history
  • Loading branch information
sakulstra authored Jan 9, 2025
1 parent f481827 commit 894a76c
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/govv3/checks/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,11 @@ export async function deepDiff({
accessChain: string[];
type?: string;
}): Promise<string> {
if (type && accessChain.length === 1 && ['_reserves', 'assets', 'assetsSources'].includes(type)) {
if (
type &&
accessChain.length === 1 &&
['_reserves', 'assets', 'assetsSources', '_interestRateData'].includes(type)
) {
accessChain[0] = await addAssetSymbol(client, accessChain[0] as Address);
}
if (typeof before !== 'object' || typeof after !== 'object') {
Expand Down Expand Up @@ -263,10 +267,20 @@ async function enhanceValue({
if (asset) return prettifyNumber({decimals: asset.decimals, value, showDecimals: true});
}
// values to be rendered with ray decimals
if (key && ['_reserves', '_eModeCategories'].includes(type)) {
if (key && ['_reserves', '_eModeCategories', '_interestRateData'].includes(type)) {
if (['liquidityIndex', 'variableBorrowIndex'].includes(key))
return prettifyNumber({decimals: 27, value, showDecimals: true});
if (['liquidationThreshold', 'reserveFactor', 'liquidationProtocolFee', 'ltv'].includes(key))
if (
[
'liquidationThreshold',
'reserveFactor',
'liquidationProtocolFee',
'ltv',
'optimalUsageRatio',
'variableRateSlope1',
'variableRateSlope2',
].includes(key)
)
return prettifyNumber({decimals: 2, value, suffix: '%', showDecimals: true});
if (
['currentLiquidityRate', 'currentVariableBorrowRate', 'currentStableBorrowRate'].includes(
Expand Down

0 comments on commit 894a76c

Please sign in to comment.