mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
Added reserveFactor to getReserveConfigurationData
This commit is contained in:
parent
de8ae523c8
commit
af362141fd
|
@ -249,6 +249,7 @@ interface ILendingPool {
|
||||||
uint256 ltv,
|
uint256 ltv,
|
||||||
uint256 liquidationThreshold,
|
uint256 liquidationThreshold,
|
||||||
uint256 liquidationBonus,
|
uint256 liquidationBonus,
|
||||||
|
uint256 reserveFactor,
|
||||||
address interestRateStrategyAddress,
|
address interestRateStrategyAddress,
|
||||||
bool usageAsCollateralEnabled,
|
bool usageAsCollateralEnabled,
|
||||||
bool borrowingEnabled,
|
bool borrowingEnabled,
|
||||||
|
|
|
@ -500,6 +500,7 @@ contract LendingPool is VersionedInitializable, ILendingPool {
|
||||||
uint256 ltv,
|
uint256 ltv,
|
||||||
uint256 liquidationThreshold,
|
uint256 liquidationThreshold,
|
||||||
uint256 liquidationBonus,
|
uint256 liquidationBonus,
|
||||||
|
uint256 reserveFactor,
|
||||||
address interestRateStrategyAddress,
|
address interestRateStrategyAddress,
|
||||||
bool usageAsCollateralEnabled,
|
bool usageAsCollateralEnabled,
|
||||||
bool borrowingEnabled,
|
bool borrowingEnabled,
|
||||||
|
@ -515,6 +516,7 @@ contract LendingPool is VersionedInitializable, ILendingPool {
|
||||||
reserve.configuration.getLtv(),
|
reserve.configuration.getLtv(),
|
||||||
reserve.configuration.getLiquidationThreshold(),
|
reserve.configuration.getLiquidationThreshold(),
|
||||||
reserve.configuration.getLiquidationBonus(),
|
reserve.configuration.getLiquidationBonus(),
|
||||||
|
reserve.configuration.getReserveFactor(),
|
||||||
reserve.interestRateStrategyAddress,
|
reserve.interestRateStrategyAddress,
|
||||||
reserve.configuration.getLtv() != 0,
|
reserve.configuration.getLtv() != 0,
|
||||||
reserve.configuration.getBorrowingEnabled(),
|
reserve.configuration.getBorrowingEnabled(),
|
||||||
|
@ -872,13 +874,18 @@ contract LendingPool is VersionedInitializable, ILendingPool {
|
||||||
|
|
||||||
function _mintToReserveTreasury(ReserveLogic.ReserveData storage reserve, address user, address debtTokenAddress) internal {
|
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);
|
uint256 currentPrincipalBalance = DebtTokenBase(debtTokenAddress).principalBalanceOf(user);
|
||||||
//calculating the interest accrued since the last borrow and minting the equivalent amount to the reserve factor
|
//calculating the interest accrued since the last borrow and minting the equivalent amount to the reserve factor
|
||||||
if(currentPrincipalBalance > 0){
|
if(currentPrincipalBalance > 0){
|
||||||
|
|
||||||
uint256 balanceIncrease = IERC20(debtTokenAddress).balanceOf(user).sub(currentPrincipalBalance);
|
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);
|
IAToken(reserve.aTokenAddress).mintToReserve(amountForReserveFactor);
|
||||||
}
|
}
|
||||||
|
|
|
@ -571,7 +571,7 @@ contract LendingPoolConfigurator is VersionedInitializable {
|
||||||
payable(proxyAddress)
|
payable(proxyAddress)
|
||||||
);
|
);
|
||||||
|
|
||||||
(uint256 decimals, , , , , , , , , ) = pool.getReserveConfigurationData(asset);
|
(uint256 decimals, , , , , , , , , , ) = pool.getReserveConfigurationData(asset);
|
||||||
|
|
||||||
bytes memory params = abi.encodeWithSignature(
|
bytes memory params = abi.encodeWithSignature(
|
||||||
'initialize(uint8,string,string)',
|
'initialize(uint8,string,string)',
|
||||||
|
|
|
@ -91,7 +91,7 @@ contract WalletBalanceProvider {
|
||||||
uint256[] memory balances = new uint256[](reserves.length);
|
uint256[] memory balances = new uint256[](reserves.length);
|
||||||
|
|
||||||
for (uint256 j = 0; j < reserves.length; j++) {
|
for (uint256 j = 0; j < reserves.length; j++) {
|
||||||
(, , , , , , , , bool isActive, ) = pool.getReserveConfigurationData(reserves[j]);
|
(, , , , , , , , , bool isActive, ) = pool.getReserveConfigurationData(reserves[j]);
|
||||||
|
|
||||||
if (!isActive) {
|
if (!isActive) {
|
||||||
balances[j] = 0;
|
balances[j] = 0;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user