mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
Fixes #19
This commit is contained in:
parent
dc64b7f992
commit
2d769f4480
|
@ -215,6 +215,9 @@ contract StableDebtToken is IStableDebtToken, DebtTokenBase {
|
||||||
if (_amount == currentBalance) {
|
if (_amount == currentBalance) {
|
||||||
usersData[_user].currentRate = 0;
|
usersData[_user].currentRate = 0;
|
||||||
usersData[_user].lastUpdateTimestamp = 0;
|
usersData[_user].lastUpdateTimestamp = 0;
|
||||||
|
} else {
|
||||||
|
//solium-disable-next-line
|
||||||
|
usersData[_user].lastUpdateTimestamp = uint40(block.timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (balanceIncrease > _amount) {
|
if (balanceIncrease > _amount) {
|
||||||
|
|
|
@ -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": [
|
"actions": [
|
||||||
{
|
{
|
||||||
"name": "mint",
|
"name": "mint",
|
||||||
|
|
|
@ -658,6 +658,10 @@ export const calcExpectedUserDataAfterRepay = (
|
||||||
'0'
|
'0'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
expectedUserData.stableBorrowRate = userDataBeforeAction.stableBorrowRate;
|
||||||
|
expectedUserData.stableRateLastUpdated = txTimestamp;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
expectedUserData.currentStableDebt = stableBorrowBalance;
|
expectedUserData.currentStableDebt = stableBorrowBalance;
|
||||||
expectedUserData.principalStableDebt = userDataBeforeAction.principalStableDebt;
|
expectedUserData.principalStableDebt = userDataBeforeAction.principalStableDebt;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user