mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
- Added return of is first borrowing on debt tokens mint()
This commit is contained in:
parent
ecd2c04001
commit
38bb760112
|
@ -857,34 +857,35 @@ contract LendingPool is VersionedInitializable, ILendingPool, LendingPoolStorage
|
|||
oracle
|
||||
);
|
||||
|
||||
uint256 reserveId = reserve.id;
|
||||
if (!userConfig.isBorrowing(reserveId)) {
|
||||
userConfig.setBorrowing(reserveId, true);
|
||||
}
|
||||
|
||||
reserve.updateState();
|
||||
|
||||
//caching the current stable borrow rate
|
||||
uint256 currentStableRate = 0;
|
||||
|
||||
|
||||
bool isFirstBorrowing = false;
|
||||
if (
|
||||
ReserveLogic.InterestRateMode(vars.interestRateMode) == ReserveLogic.InterestRateMode.STABLE
|
||||
) {
|
||||
currentStableRate = reserve.currentStableBorrowRate;
|
||||
|
||||
IStableDebtToken(reserve.stableDebtTokenAddress).mint(
|
||||
isFirstBorrowing = IStableDebtToken(reserve.stableDebtTokenAddress).mint(
|
||||
vars.onBehalfOf,
|
||||
vars.amount,
|
||||
currentStableRate
|
||||
);
|
||||
} else {
|
||||
IVariableDebtToken(reserve.variableDebtTokenAddress).mint(
|
||||
isFirstBorrowing = IVariableDebtToken(reserve.variableDebtTokenAddress).mint(
|
||||
vars.onBehalfOf,
|
||||
vars.amount,
|
||||
reserve.variableBorrowIndex
|
||||
);
|
||||
}
|
||||
|
||||
uint256 reserveId = reserve.id;
|
||||
if (isFirstBorrowing) {
|
||||
userConfig.setBorrowing(reserveId, true);
|
||||
}
|
||||
|
||||
reserve.updateInterestRates(
|
||||
vars.asset,
|
||||
vars.aTokenAddress,
|
||||
|
|
|
@ -97,7 +97,7 @@ contract StableDebtToken is IStableDebtToken, DebtTokenBase {
|
|||
address user,
|
||||
uint256 amount,
|
||||
uint256 rate
|
||||
) external override onlyLendingPool {
|
||||
) external override onlyLendingPool returns(bool) {
|
||||
MintLocalVars memory vars;
|
||||
|
||||
//cumulates the user debt
|
||||
|
@ -148,6 +148,8 @@ contract StableDebtToken is IStableDebtToken, DebtTokenBase {
|
|||
vars.newStableRate,
|
||||
vars.currentAvgStableRate
|
||||
);
|
||||
|
||||
return currentBalance == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -62,7 +62,7 @@ interface IStableDebtToken {
|
|||
address user,
|
||||
uint256 amount,
|
||||
uint256 rate
|
||||
) external;
|
||||
) external returns(bool);
|
||||
|
||||
/**
|
||||
* @dev burns debt of the target user.
|
||||
|
|
Loading…
Reference in New Issue
Block a user