diff --git a/contracts/tokenization/StableDebtToken.sol b/contracts/tokenization/StableDebtToken.sol index 961ba5cd..7663183e 100644 --- a/contracts/tokenization/StableDebtToken.sol +++ b/contracts/tokenization/StableDebtToken.sol @@ -215,6 +215,9 @@ contract StableDebtToken is IStableDebtToken, DebtTokenBase { if (_amount == currentBalance) { usersData[_user].currentRate = 0; usersData[_user].lastUpdateTimestamp = 0; + } else { + //solium-disable-next-line + usersData[_user].lastUpdateTimestamp = uint40(block.timestamp); } if (balanceIncrease > _amount) { diff --git a/test/helpers/scenarios/borrow-repay-stable.json b/test/helpers/scenarios/borrow-repay-stable.json index aa79bf66..9d2348e9 100644 --- a/test/helpers/scenarios/borrow-repay-stable.json +++ b/test/helpers/scenarios/borrow-repay-stable.json @@ -88,7 +88,41 @@ ] }, { - "description": "User 1 repays the DAI borrow after one year", + "description": "User 1 repays the half of the DAI borrow after one year", + "actions": [ + { + "name": "mint", + "description": "Mint 10 DAI to cover the interest", + "args": { + "reserve": "DAI", + "amount": "10", + "user": "1" + }, + "expected": "success" + }, + { + "name": "approve", + "args": { + "reserve": "DAI", + "user": "1" + }, + "expected": "success" + }, + { + "name": "repay", + "args": { + "reserve": "DAI", + "amount": "50", + "user": "1", + "onBehalfOf": "1", + "borrowRateMode": "stable" + }, + "expected": "success" + } + ] + }, + { + "description": "User 1 repays the rest of the DAI borrow after one year", "actions": [ { "name": "mint", diff --git a/test/helpers/utils/calculations.ts b/test/helpers/utils/calculations.ts index 293c04ac..257573be 100644 --- a/test/helpers/utils/calculations.ts +++ b/test/helpers/utils/calculations.ts @@ -658,6 +658,10 @@ export const calcExpectedUserDataAfterRepay = ( '0' ); } + else{ + expectedUserData.stableBorrowRate = userDataBeforeAction.stableBorrowRate; + expectedUserData.stableRateLastUpdated = txTimestamp; + } } else { expectedUserData.currentStableDebt = stableBorrowBalance; expectedUserData.principalStableDebt = userDataBeforeAction.principalStableDebt;