This commit is contained in:
The3D 2020-08-20 17:09:23 +02:00
parent dc64b7f992
commit 2d769f4480
3 changed files with 42 additions and 1 deletions

View File

@ -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) {

View File

@ -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",

View File

@ -658,6 +658,10 @@ export const calcExpectedUserDataAfterRepay = (
'0'
);
}
else{
expectedUserData.stableBorrowRate = userDataBeforeAction.stableBorrowRate;
expectedUserData.stableRateLastUpdated = txTimestamp;
}
} else {
expectedUserData.currentStableDebt = stableBorrowBalance;
expectedUserData.principalStableDebt = userDataBeforeAction.principalStableDebt;