mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
Fixed merge issues
This commit is contained in:
parent
cf39045573
commit
ab88aa64bf
|
@ -188,7 +188,7 @@ contract LendingPool is VersionedInitializable, ILendingPool {
|
||||||
ReserveLogic.ReserveData storage reserve = _reserves[vars.asset];
|
ReserveLogic.ReserveData storage reserve = _reserves[vars.asset];
|
||||||
UserConfiguration.Map storage userConfig = _usersConfig[vars.user];
|
UserConfiguration.Map storage userConfig = _usersConfig[vars.user];
|
||||||
|
|
||||||
address oracle = addressesProvider.getPriceOracle();
|
address oracle = _addressesProvider.getPriceOracle();
|
||||||
uint256 amountInETH = IPriceOracleGetter(oracle).getAssetPrice(vars.asset).mul(vars.amount).div(
|
uint256 amountInETH = IPriceOracleGetter(oracle).getAssetPrice(vars.asset).mul(vars.amount).div(
|
||||||
10**reserve.configuration.getDecimals()
|
10**reserve.configuration.getDecimals()
|
||||||
);
|
);
|
||||||
|
@ -202,7 +202,7 @@ contract LendingPool is VersionedInitializable, ILendingPool {
|
||||||
MAX_STABLE_RATE_BORROW_SIZE_PERCENT,
|
MAX_STABLE_RATE_BORROW_SIZE_PERCENT,
|
||||||
_reserves,
|
_reserves,
|
||||||
_usersConfig[vars.user],
|
_usersConfig[vars.user],
|
||||||
reservesList,
|
_reservesList,
|
||||||
oracle
|
oracle
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -220,7 +220,7 @@ contract LendingPool is VersionedInitializable, ILendingPool {
|
||||||
}
|
}
|
||||||
|
|
||||||
address aToken = reserve.aTokenAddress;
|
address aToken = reserve.aTokenAddress;
|
||||||
reserve.updateInterestRates(asset, aToken, 0, amount);
|
reserve.updateInterestRates(vars.asset, aToken, 0, vars.amount);
|
||||||
|
|
||||||
uint256 reserveIndex = reserve.index;
|
uint256 reserveIndex = reserve.index;
|
||||||
if (!userConfig.isBorrowing(reserveIndex)) {
|
if (!userConfig.isBorrowing(reserveIndex)) {
|
||||||
|
@ -308,7 +308,7 @@ contract LendingPool is VersionedInitializable, ILendingPool {
|
||||||
* @param asset the address of the reserve on which the user borrowed
|
* @param asset the address of the reserve on which the user borrowed
|
||||||
* @param rateMode the rate mode that the user wants to swap
|
* @param rateMode the rate mode that the user wants to swap
|
||||||
**/
|
**/
|
||||||
function swapBorrowRateMode(address asset, uint256 rateMode) external override nonReentrant {
|
function swapBorrowRateMode(address asset, uint256 rateMode) external override {
|
||||||
ReserveLogic.ReserveData storage reserve = _reserves[asset];
|
ReserveLogic.ReserveData storage reserve = _reserves[asset];
|
||||||
|
|
||||||
(uint256 stableDebt, uint256 variableDebt) = Helpers.getUserCurrentDebt(msg.sender, reserve);
|
(uint256 stableDebt, uint256 variableDebt) = Helpers.getUserCurrentDebt(msg.sender, reserve);
|
||||||
|
@ -516,14 +516,14 @@ contract LendingPool is VersionedInitializable, ILendingPool {
|
||||||
if (debtType == 0) { // To not fetch balance/allowance if no debt needs to be opened
|
if (debtType == 0) { // To not fetch balance/allowance if no debt needs to be opened
|
||||||
IERC20(asset).transferFrom(receiverAddress, vars.aTokenAddress, vars.amountPlusPremium);
|
IERC20(asset).transferFrom(receiverAddress, vars.aTokenAddress, vars.amountPlusPremium);
|
||||||
reserve.cumulateToLiquidityIndex(IERC20(vars.aTokenAddress).totalSupply(), vars.premium);
|
reserve.cumulateToLiquidityIndex(IERC20(vars.aTokenAddress).totalSupply(), vars.premium);
|
||||||
reserve.updateInterestRates(asset, vars.premium, 0);
|
reserve.updateInterestRates(asset, vars.aTokenAddress, vars.premium, 0);
|
||||||
} else {
|
} else {
|
||||||
vars.receiverBalance = IERC20(asset).balanceOf(receiverAddress);
|
vars.receiverBalance = IERC20(asset).balanceOf(receiverAddress);
|
||||||
vars.receiverAllowance = IERC20(asset).allowance(receiverAddress, address(this));
|
vars.receiverAllowance = IERC20(asset).allowance(receiverAddress, address(this));
|
||||||
if (vars.receiverBalance >= vars.amountPlusPremium && vars.receiverAllowance >= vars.amountPlusPremium) {
|
if (vars.receiverBalance >= vars.amountPlusPremium && vars.receiverAllowance >= vars.amountPlusPremium) {
|
||||||
IERC20(asset).transferFrom(receiverAddress, vars.aTokenAddress, vars.amountPlusPremium);
|
IERC20(asset).transferFrom(receiverAddress, vars.aTokenAddress, vars.amountPlusPremium);
|
||||||
reserve.cumulateToLiquidityIndex(IERC20(vars.aTokenAddress).totalSupply(), vars.premium);
|
reserve.cumulateToLiquidityIndex(IERC20(vars.aTokenAddress).totalSupply(), vars.premium);
|
||||||
reserve.updateInterestRates(asset, vars.premium, 0);
|
reserve.updateInterestRates(asset, vars.aTokenAddress, vars.premium, 0);
|
||||||
} else {
|
} else {
|
||||||
if (debtType == 1 || debtType == 2) {
|
if (debtType == 1 || debtType == 2) {
|
||||||
// If the transfer didn't succeed, the receiver either didn't return the funds, or didn't approve the transfer.
|
// If the transfer didn't succeed, the receiver either didn't return the funds, or didn't approve the transfer.
|
||||||
|
@ -545,6 +545,7 @@ contract LendingPool is VersionedInitializable, ILendingPool {
|
||||||
);
|
);
|
||||||
reserve.updateInterestRates(
|
reserve.updateInterestRates(
|
||||||
asset,
|
asset,
|
||||||
|
vars.aTokenAddress,
|
||||||
vars.premium,
|
vars.premium,
|
||||||
0
|
0
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user