Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for #315 (v2 Polygon) #316

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix on _updateIndexes()
  • Loading branch information
eboadom committed Oct 14, 2022
commit 761ea29084bb36dc88e45caf76c5b007b0199a56
3 changes: 1 addition & 2 deletions contracts/protocol/libraries/logic/ReserveLogic.sol
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,6 @@ library ReserveLogic {
) internal returns (uint256, uint256) {
uint256 newLiquidityIndex = liquidityIndex;
uint256 newVariableBorrowIndex = variableBorrowIndex;
uint256 currentVariableBorrowRate = reserve.currentVariableBorrowRate;
uint256 currentLiquidityRate = reserve.currentLiquidityRate;

// Only cumulating on the supply side if there is any income being produced
Expand All @@ -365,7 +364,7 @@ library ReserveLogic {
// Variable borrow side only gets updated if there is any accrual of variable debt
if (scaledVariableDebt != 0) {
uint256 cumulatedVariableBorrowInterest =
MathUtils.calculateCompoundedInterest(currentVariableBorrowRate, timestamp);
MathUtils.calculateCompoundedInterest(reserve.currentVariableBorrowRate, timestamp);
newVariableBorrowIndex = cumulatedVariableBorrowInterest.rayMul(variableBorrowIndex);
require(
newVariableBorrowIndex <= type(uint128).max,
Expand Down