Skip to content

Commit

Permalink
fix: Handle missing interest rates in collateral stats calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
MrRoudyk committed Dec 12, 2024
1 parent 84f1f46 commit 3b3d240
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions apps/dashboard_app/helpers/protocol_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,12 @@ def get_collateral_stats(
float(loan_entity.collateral.values.get(token_address, 0.0))
for loan_entity in state.loan_entities.values()
)
/ TOKEN_SETTINGS[token].decimal_factor
* float(state.interest_rate_models.collateral[token_address])
/ float(TOKEN_SETTINGS[token].decimal_factor)
* float(
state.interest_rate_models.collateral.get(
token_address, 1.0
)
)
)
token_collaterals[token] += round(collateral, 4)
except TypeError:
Expand Down Expand Up @@ -225,8 +229,8 @@ def get_debt_stats(
float(loan_entity.debt[token_address])
for loan_entity in state.loan_entities.values()
)
/ TOKEN_SETTINGS[token].decimal_factor
* float(state.interest_rate_models.debt[token_address])
/ float(TOKEN_SETTINGS[token].decimal_factor)
* float(state.interest_rate_models.debt.get(token_address, 1.0))
)
token_debts[token] = round(debt, 4)
except TypeError:
Expand Down

0 comments on commit 3b3d240

Please sign in to comment.