Added getter for userconfiguration

This commit is contained in:
The3D 2020-10-12 14:37:53 +02:00
parent 645ea913b0
commit b450a04642
3 changed files with 19 additions and 3 deletions

View File

@ -3,6 +3,7 @@ pragma solidity ^0.6.8;
import {LendingPoolAddressesProvider} from '../configuration/LendingPoolAddressesProvider.sol';
import {ReserveConfiguration} from '../libraries/configuration/ReserveConfiguration.sol';
import {UserConfiguration} from '../libraries/configuration/UserConfiguration.sol';
import {ReserveLogic} from '../libraries/logic/ReserveLogic.sol';
pragma experimental ABIEncoderV2;
@ -359,6 +360,8 @@ interface ILendingPool {
view
returns (ReserveConfiguration.Map memory);
function getUserConfiguration(address user) external view returns (UserConfiguration.Map memory);
function getReserveNormalizedIncome(address reserve) external view returns (uint256);
function getReserveNormalizedVariableDebt(address reserve) external view returns (uint256);

View File

@ -720,6 +720,20 @@ contract LendingPool is VersionedInitializable, ILendingPool, LendingPoolStorage
return _reserves[asset].configuration;
}
/**
* @dev returns the configuration of the user for the specific reserve
* @param user the user
* @return the configuration of the user
**/
function getUserConfiguration(address user)
external
override
view
returns (UserConfiguration.Map memory)
{
return _usersConfig[user];
}
/**
* @dev returns the normalized income per unit of asset
* @param asset the address of the reserve
@ -969,5 +983,4 @@ contract LendingPool is VersionedInitializable, ILendingPool, LendingPoolStorage
_reservesCount++;
}
}
}

View File

@ -68,7 +68,7 @@ library GenericLogic {
balanceDecreaseAllowedLocalVars memory vars;
(, vars.liquidationThreshold, , vars.decimals) = reservesData[asset].configuration.getParams();
(, vars.liquidationThreshold, , vars.decimals, ) = reservesData[asset].configuration.getParams();
if (vars.liquidationThreshold == 0) {
return true; //if reserve is not used as collateral, no reasons to block the transfer
@ -177,7 +177,7 @@ library GenericLogic {
vars.currentReserveAddress = reserves[vars.i];
ReserveLogic.ReserveData storage currentReserve = reservesData[vars.currentReserveAddress];
(vars.ltv, vars.liquidationThreshold, , vars.decimals) = currentReserve
(vars.ltv, vars.liquidationThreshold, , vars.decimals, ) = currentReserve
.configuration
.getParams();