Added reserveFactor to getReserveConfigurationData

This commit is contained in:
The3D 2020-09-10 13:16:32 +02:00
parent de8ae523c8
commit af362141fd
4 changed files with 11 additions and 3 deletions

View File

@ -249,6 +249,7 @@ interface ILendingPool {
uint256 ltv,
uint256 liquidationThreshold,
uint256 liquidationBonus,
uint256 reserveFactor,
address interestRateStrategyAddress,
bool usageAsCollateralEnabled,
bool borrowingEnabled,

View File

@ -500,6 +500,7 @@ contract LendingPool is VersionedInitializable, ILendingPool {
uint256 ltv,
uint256 liquidationThreshold,
uint256 liquidationBonus,
uint256 reserveFactor,
address interestRateStrategyAddress,
bool usageAsCollateralEnabled,
bool borrowingEnabled,
@ -515,6 +516,7 @@ contract LendingPool is VersionedInitializable, ILendingPool {
reserve.configuration.getLtv(),
reserve.configuration.getLiquidationThreshold(),
reserve.configuration.getLiquidationBonus(),
reserve.configuration.getReserveFactor(),
reserve.interestRateStrategyAddress,
reserve.configuration.getLtv() != 0,
reserve.configuration.getBorrowingEnabled(),
@ -872,13 +874,18 @@ contract LendingPool is VersionedInitializable, ILendingPool {
function _mintToReserveTreasury(ReserveLogic.ReserveData storage reserve, address user, address debtTokenAddress) internal {
uint256 reserveFactor = reserve.configuration.getReserveFactor();
if(reserveFactor == 0) {
return;
}
uint256 currentPrincipalBalance = DebtTokenBase(debtTokenAddress).principalBalanceOf(user);
//calculating the interest accrued since the last borrow and minting the equivalent amount to the reserve factor
if(currentPrincipalBalance > 0){
uint256 balanceIncrease = IERC20(debtTokenAddress).balanceOf(user).sub(currentPrincipalBalance);
uint256 amountForReserveFactor = balanceIncrease.percentMul(reserve.configuration.getReserveFactor());
uint256 amountForReserveFactor = balanceIncrease.percentMul(reserveFactor);
IAToken(reserve.aTokenAddress).mintToReserve(amountForReserveFactor);
}

View File

@ -571,7 +571,7 @@ contract LendingPoolConfigurator is VersionedInitializable {
payable(proxyAddress)
);
(uint256 decimals, , , , , , , , , ) = pool.getReserveConfigurationData(asset);
(uint256 decimals, , , , , , , , , , ) = pool.getReserveConfigurationData(asset);
bytes memory params = abi.encodeWithSignature(
'initialize(uint8,string,string)',

View File

@ -91,7 +91,7 @@ contract WalletBalanceProvider {
uint256[] memory balances = new uint256[](reserves.length);
for (uint256 j = 0; j < reserves.length; j++) {
(, , , , , , , , bool isActive, ) = pool.getReserveConfigurationData(reserves[j]);
(, , , , , , , , , bool isActive, ) = pool.getReserveConfigurationData(reserves[j]);
if (!isActive) {
balances[j] = 0;