Updated ReserveMap and UserMap

This commit is contained in:
The3D 2020-11-24 16:17:27 +01:00
parent 093e692573
commit 126458c7aa
17 changed files with 83 additions and 83 deletions

View File

@ -353,14 +353,14 @@ interface ILendingPool {
* @param asset The address of the underlying asset of the reserve
* @return The configuration of the reserve
**/
function getConfiguration(address asset) external view returns (DataTypes.ReserveBitmap memory);
function getConfiguration(address asset) external view returns (DataTypes.ReserveConfigurationMap memory);
/**
* @dev Returns the configuration of the user across all the reserves
* @param user The user address
* @return The configuration of the user
**/
function getUserConfiguration(address user) external view returns (DataTypes.UserBitmap memory);
function getUserConfiguration(address user) external view returns (DataTypes.UserConfigurationMap memory);
/**
* @dev Returns the normalized income normalized income of the reserve

View File

@ -12,8 +12,8 @@ import {IVariableDebtToken} from '../protocol/tokenization/interfaces/IVariableD
import {DataTypes} from '../protocol/libraries/types/DataTypes.sol';
contract AaveProtocolDataProvider {
using ReserveConfiguration for DataTypes.ReserveBitmap;
using UserConfiguration for DataTypes.UserBitmap;
using ReserveConfiguration for DataTypes.ReserveConfigurationMap;
using UserConfiguration for DataTypes.UserConfigurationMap;
address constant MKR = 0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2;
address constant ETH = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
@ -80,7 +80,7 @@ contract AaveProtocolDataProvider {
bool isFrozen
)
{
DataTypes.ReserveBitmap memory configuration =
DataTypes.ReserveConfigurationMap memory configuration =
ILendingPool(ADDRESSES_PROVIDER.getLendingPool()).getConfiguration(asset);
(ltv, liquidationThreshold, liquidationBonus, decimals, reserveFactor) = configuration
@ -143,7 +143,7 @@ contract AaveProtocolDataProvider {
DataTypes.ReserveData memory reserve =
ILendingPool(ADDRESSES_PROVIDER.getLendingPool()).getReserveData(asset);
DataTypes.UserBitmap memory userConfig =
DataTypes.UserConfigurationMap memory userConfig =
ILendingPool(ADDRESSES_PROVIDER.getLendingPool()).getUserConfiguration(user);
currentATokenBalance = IERC20Detailed(reserve.aTokenAddress).balanceOf(user);

View File

@ -21,8 +21,8 @@ import {DataTypes} from '../protocol/libraries/types/DataTypes.sol';
contract UiPoolDataProvider is IUiPoolDataProvider {
using WadRayMath for uint256;
using ReserveConfiguration for DataTypes.ReserveBitmap;
using UserConfiguration for DataTypes.UserBitmap;
using ReserveConfiguration for DataTypes.ReserveConfigurationMap;
using UserConfiguration for DataTypes.UserConfigurationMap;
address public constant MOCK_USD_ADDRESS = 0x10F7Fc1F91Ba351f9C629c5947AD69bD03C05b96;
@ -57,7 +57,7 @@ contract UiPoolDataProvider is IUiPoolDataProvider {
ILendingPool lendingPool = ILendingPool(provider.getLendingPool());
IPriceOracleGetter oracle = IPriceOracleGetter(provider.getPriceOracle());
address[] memory reserves = lendingPool.getReservesList();
DataTypes.UserBitmap memory userConfig = lendingPool.getUserConfiguration(user);
DataTypes.UserConfigurationMap memory userConfig = lendingPool.getUserConfiguration(user);
AggregatedReserveData[] memory reservesData = new AggregatedReserveData[](reserves.length);
UserReserveData[] memory userReservesData =

View File

@ -15,8 +15,8 @@ import {IERC20} from '../dependencies/openzeppelin/contracts/IERC20.sol';
import {DataTypes} from '../protocol/libraries/types/DataTypes.sol';
contract WETHGateway is IWETHGateway, Ownable {
using ReserveConfiguration for DataTypes.ReserveBitmap;
using UserConfiguration for DataTypes.UserBitmap;
using ReserveConfiguration for DataTypes.ReserveConfigurationMap;
using UserConfiguration for DataTypes.UserConfigurationMap;
IWETH internal immutable WETH;
ILendingPool internal immutable POOL;

View File

@ -23,7 +23,7 @@ contract WalletBalanceProvider {
using Address for address payable;
using Address for address;
using SafeERC20 for IERC20;
using ReserveConfiguration for DataTypes.ReserveBitmap;
using ReserveConfiguration for DataTypes.ReserveConfigurationMap;
address constant MOCK_ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
@ -93,7 +93,7 @@ contract WalletBalanceProvider {
uint256[] memory balances = new uint256[](reservesWithEth.length);
for (uint256 j = 0; j < reserves.length; j++) {
DataTypes.ReserveBitmap memory configuration = pool.getConfiguration(reservesWithEth[j]);
DataTypes.ReserveConfigurationMap memory configuration = pool.getConfiguration(reservesWithEth[j]);
(bool isActive, , , ) = configuration.getFlagsMemory();

View File

@ -623,7 +623,7 @@ contract LendingPool is VersionedInitializable, ILendingPool, LendingPoolStorage
external
view
override
returns (DataTypes.ReserveBitmap memory)
returns (DataTypes.ReserveConfigurationMap memory)
{
return _reserves[asset].configuration;
}
@ -637,7 +637,7 @@ contract LendingPool is VersionedInitializable, ILendingPool, LendingPoolStorage
external
view
override
returns (DataTypes.UserBitmap memory)
returns (DataTypes.UserConfigurationMap memory)
{
return _usersConfig[user];
}
@ -730,13 +730,13 @@ contract LendingPool is VersionedInitializable, ILendingPool, LendingPoolStorage
if (from != to) {
if (balanceFromBefore.sub(amount) == 0) {
DataTypes.UserBitmap storage fromConfig = _usersConfig[from];
DataTypes.UserConfigurationMap storage fromConfig = _usersConfig[from];
fromConfig.setUsingAsCollateral(reserveId, false);
emit ReserveUsedAsCollateralDisabled(asset, from);
}
if (balanceToBefore == 0 && amount != 0) {
DataTypes.UserBitmap storage toConfig = _usersConfig[to];
DataTypes.UserConfigurationMap storage toConfig = _usersConfig[to];
toConfig.setUsingAsCollateral(reserveId, true);
emit ReserveUsedAsCollateralEnabled(asset, to);
}
@ -825,7 +825,7 @@ contract LendingPool is VersionedInitializable, ILendingPool, LendingPoolStorage
function _executeBorrow(ExecuteBorrowParams memory vars) internal {
DataTypes.ReserveData storage reserve = _reserves[vars.asset];
DataTypes.UserBitmap storage userConfig = _usersConfig[vars.onBehalfOf];
DataTypes.UserConfigurationMap storage userConfig = _usersConfig[vars.onBehalfOf];
address oracle = _addressesProvider.getPriceOracle();

View File

@ -97,7 +97,7 @@ contract LendingPoolCollateralManager is
) external override returns (uint256, string memory) {
DataTypes.ReserveData storage collateralReserve = _reserves[collateral];
DataTypes.ReserveData storage principalReserve = _reserves[principal];
DataTypes.UserBitmap storage userConfig = _usersConfig[user];
DataTypes.UserConfigurationMap storage userConfig = _usersConfig[user];
LiquidationCallLocalVars memory vars;

View File

@ -25,7 +25,7 @@ import {DataTypes} from '../libraries/types/DataTypes.sol';
contract LendingPoolConfigurator is VersionedInitializable {
using SafeMath for uint256;
using ReserveConfiguration for DataTypes.ReserveBitmap;
using ReserveConfiguration for DataTypes.ReserveConfigurationMap;
/**
* @dev emitted when a reserve is initialized.
@ -250,7 +250,7 @@ contract LendingPoolConfigurator is VersionedInitializable {
interestRateStrategyAddress
);
DataTypes.ReserveBitmap memory currentConfig = pool.getConfiguration(asset);
DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset);
currentConfig.setDecimals(underlyingAssetDecimals);
@ -316,7 +316,7 @@ contract LendingPoolConfigurator is VersionedInitializable {
external
onlyPoolAdmin
{
DataTypes.ReserveBitmap memory currentConfig = pool.getConfiguration(asset);
DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset);
currentConfig.setBorrowingEnabled(true);
currentConfig.setStableRateBorrowingEnabled(stableBorrowRateEnabled);
@ -331,7 +331,7 @@ contract LendingPoolConfigurator is VersionedInitializable {
* @param asset the address of the reserve
**/
function disableBorrowingOnReserve(address asset) external onlyPoolAdmin {
DataTypes.ReserveBitmap memory currentConfig = pool.getConfiguration(asset);
DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset);
currentConfig.setBorrowingEnabled(false);
@ -354,7 +354,7 @@ contract LendingPoolConfigurator is VersionedInitializable {
uint256 liquidationThreshold,
uint256 liquidationBonus
) external onlyPoolAdmin {
DataTypes.ReserveBitmap memory currentConfig = pool.getConfiguration(asset);
DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset);
//validation of the parameters: the LTV can
//only be lower or equal than the liquidation threshold
@ -396,7 +396,7 @@ contract LendingPoolConfigurator is VersionedInitializable {
* @param asset the address of the reserve
**/
function enableReserveStableRate(address asset) external onlyPoolAdmin {
DataTypes.ReserveBitmap memory currentConfig = pool.getConfiguration(asset);
DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset);
currentConfig.setStableRateBorrowingEnabled(true);
@ -410,7 +410,7 @@ contract LendingPoolConfigurator is VersionedInitializable {
* @param asset the address of the reserve
**/
function disableReserveStableRate(address asset) external onlyPoolAdmin {
DataTypes.ReserveBitmap memory currentConfig = pool.getConfiguration(asset);
DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset);
currentConfig.setStableRateBorrowingEnabled(false);
@ -424,7 +424,7 @@ contract LendingPoolConfigurator is VersionedInitializable {
* @param asset the address of the reserve
**/
function activateReserve(address asset) external onlyPoolAdmin {
DataTypes.ReserveBitmap memory currentConfig = pool.getConfiguration(asset);
DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset);
currentConfig.setActive(true);
@ -440,7 +440,7 @@ contract LendingPoolConfigurator is VersionedInitializable {
function deactivateReserve(address asset) external onlyPoolAdmin {
_checkNoLiquidity(asset);
DataTypes.ReserveBitmap memory currentConfig = pool.getConfiguration(asset);
DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset);
currentConfig.setActive(false);
@ -454,7 +454,7 @@ contract LendingPoolConfigurator is VersionedInitializable {
* @param asset the address of the reserve
**/
function freezeReserve(address asset) external onlyPoolAdmin {
DataTypes.ReserveBitmap memory currentConfig = pool.getConfiguration(asset);
DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset);
currentConfig.setFrozen(true);
@ -468,7 +468,7 @@ contract LendingPoolConfigurator is VersionedInitializable {
* @param asset the address of the reserve
**/
function unfreezeReserve(address asset) external onlyPoolAdmin {
DataTypes.ReserveBitmap memory currentConfig = pool.getConfiguration(asset);
DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset);
currentConfig.setFrozen(false);
@ -483,7 +483,7 @@ contract LendingPoolConfigurator is VersionedInitializable {
* @param reserveFactor the new reserve factor of the reserve
**/
function setReserveFactor(address asset, uint256 reserveFactor) external onlyPoolAdmin {
DataTypes.ReserveBitmap memory currentConfig = pool.getConfiguration(asset);
DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset);
currentConfig.setReserveFactor(reserveFactor);
@ -535,7 +535,7 @@ contract LendingPoolConfigurator is VersionedInitializable {
InitializableImmutableAdminUpgradeabilityProxy proxy =
InitializableImmutableAdminUpgradeabilityProxy(payable(proxyAddress));
DataTypes.ReserveBitmap memory configuration = pool.getConfiguration(asset);
DataTypes.ReserveConfigurationMap memory configuration = pool.getConfiguration(asset);
(, , , uint256 decimals, ) = configuration.getParamsMemory();

View File

@ -9,13 +9,13 @@ import {DataTypes} from '../libraries/types/DataTypes.sol';
contract LendingPoolStorage {
using ReserveLogic for DataTypes.ReserveData;
using ReserveConfiguration for DataTypes.ReserveBitmap;
using UserConfiguration for DataTypes.UserBitmap;
using ReserveConfiguration for DataTypes.ReserveConfigurationMap;
using UserConfiguration for DataTypes.UserConfigurationMap;
ILendingPoolAddressesProvider internal _addressesProvider;
mapping(address => DataTypes.ReserveData) internal _reserves;
mapping(address => DataTypes.UserBitmap) internal _usersConfig;
mapping(address => DataTypes.UserConfigurationMap) internal _usersConfig;
// the list of the available reserves, structured as a mapping for gas savings reasons
mapping(uint256 => address) internal _reservesList;

View File

@ -41,7 +41,7 @@ library ReserveConfiguration {
* @param self the reserve configuration
* @param ltv the new ltv
**/
function setLtv(DataTypes.ReserveBitmap memory self, uint256 ltv) internal pure {
function setLtv(DataTypes.ReserveConfigurationMap memory self, uint256 ltv) internal pure {
require(ltv <= MAX_VALID_LTV, Errors.RC_INVALID_LTV);
self.data = (self.data & LTV_MASK) | ltv;
@ -52,7 +52,7 @@ library ReserveConfiguration {
* @param self the reserve configuration
* @return the loan to value
**/
function getLtv(DataTypes.ReserveBitmap storage self) internal view returns (uint256) {
function getLtv(DataTypes.ReserveConfigurationMap storage self) internal view returns (uint256) {
return self.data & ~LTV_MASK;
}
@ -61,7 +61,7 @@ library ReserveConfiguration {
* @param self the reserve configuration
* @param threshold the new liquidation threshold
**/
function setLiquidationThreshold(DataTypes.ReserveBitmap memory self, uint256 threshold)
function setLiquidationThreshold(DataTypes.ReserveConfigurationMap memory self, uint256 threshold)
internal
pure
{
@ -77,7 +77,7 @@ library ReserveConfiguration {
* @param self the reserve configuration
* @return the liquidation threshold
**/
function getLiquidationThreshold(DataTypes.ReserveBitmap storage self)
function getLiquidationThreshold(DataTypes.ReserveConfigurationMap storage self)
internal
view
returns (uint256)
@ -90,7 +90,7 @@ library ReserveConfiguration {
* @param self the reserve configuration
* @param bonus the new liquidation bonus
**/
function setLiquidationBonus(DataTypes.ReserveBitmap memory self, uint256 bonus) internal pure {
function setLiquidationBonus(DataTypes.ReserveConfigurationMap memory self, uint256 bonus) internal pure {
require(bonus <= MAX_VALID_LIQUIDATION_BONUS, Errors.RC_INVALID_LIQ_BONUS);
self.data =
@ -103,7 +103,7 @@ library ReserveConfiguration {
* @param self the reserve configuration
* @return the liquidation bonus
**/
function getLiquidationBonus(DataTypes.ReserveBitmap storage self)
function getLiquidationBonus(DataTypes.ReserveConfigurationMap storage self)
internal
view
returns (uint256)
@ -116,7 +116,7 @@ library ReserveConfiguration {
* @param self the reserve configuration
* @param decimals the decimals
**/
function setDecimals(DataTypes.ReserveBitmap memory self, uint256 decimals) internal pure {
function setDecimals(DataTypes.ReserveConfigurationMap memory self, uint256 decimals) internal pure {
require(decimals <= MAX_VALID_DECIMALS, Errors.RC_INVALID_DECIMALS);
self.data = (self.data & DECIMALS_MASK) | (decimals << RESERVE_DECIMALS_START_BIT_POSITION);
@ -127,7 +127,7 @@ library ReserveConfiguration {
* @param self the reserve configuration
* @return the decimals of the asset
**/
function getDecimals(DataTypes.ReserveBitmap storage self) internal view returns (uint256) {
function getDecimals(DataTypes.ReserveConfigurationMap storage self) internal view returns (uint256) {
return (self.data & ~DECIMALS_MASK) >> RESERVE_DECIMALS_START_BIT_POSITION;
}
@ -136,7 +136,7 @@ library ReserveConfiguration {
* @param self the reserve configuration
* @param active the active state
**/
function setActive(DataTypes.ReserveBitmap memory self, bool active) internal pure {
function setActive(DataTypes.ReserveConfigurationMap memory self, bool active) internal pure {
self.data =
(self.data & ACTIVE_MASK) |
(uint256(active ? 1 : 0) << IS_ACTIVE_START_BIT_POSITION);
@ -147,7 +147,7 @@ library ReserveConfiguration {
* @param self the reserve configuration
* @return the active state
**/
function getActive(DataTypes.ReserveBitmap storage self) internal view returns (bool) {
function getActive(DataTypes.ReserveConfigurationMap storage self) internal view returns (bool) {
return (self.data & ~ACTIVE_MASK) != 0;
}
@ -156,7 +156,7 @@ library ReserveConfiguration {
* @param self the reserve configuration
* @param frozen the frozen state
**/
function setFrozen(DataTypes.ReserveBitmap memory self, bool frozen) internal pure {
function setFrozen(DataTypes.ReserveConfigurationMap memory self, bool frozen) internal pure {
self.data =
(self.data & FROZEN_MASK) |
(uint256(frozen ? 1 : 0) << IS_FROZEN_START_BIT_POSITION);
@ -167,7 +167,7 @@ library ReserveConfiguration {
* @param self the reserve configuration
* @return the frozen state
**/
function getFrozen(DataTypes.ReserveBitmap storage self) internal view returns (bool) {
function getFrozen(DataTypes.ReserveConfigurationMap storage self) internal view returns (bool) {
return (self.data & ~FROZEN_MASK) != 0;
}
@ -176,7 +176,7 @@ library ReserveConfiguration {
* @param self the reserve configuration
* @param enabled true if the borrowing needs to be enabled, false otherwise
**/
function setBorrowingEnabled(DataTypes.ReserveBitmap memory self, bool enabled) internal pure {
function setBorrowingEnabled(DataTypes.ReserveConfigurationMap memory self, bool enabled) internal pure {
self.data =
(self.data & BORROWING_MASK) |
(uint256(enabled ? 1 : 0) << BORROWING_ENABLED_START_BIT_POSITION);
@ -187,7 +187,7 @@ library ReserveConfiguration {
* @param self the reserve configuration
* @return the borrowing state
**/
function getBorrowingEnabled(DataTypes.ReserveBitmap storage self) internal view returns (bool) {
function getBorrowingEnabled(DataTypes.ReserveConfigurationMap storage self) internal view returns (bool) {
return (self.data & ~BORROWING_MASK) != 0;
}
@ -196,7 +196,7 @@ library ReserveConfiguration {
* @param self the reserve configuration
* @param enabled true if the stable rate borrowing needs to be enabled, false otherwise
**/
function setStableRateBorrowingEnabled(DataTypes.ReserveBitmap memory self, bool enabled)
function setStableRateBorrowingEnabled(DataTypes.ReserveConfigurationMap memory self, bool enabled)
internal
pure
{
@ -210,7 +210,7 @@ library ReserveConfiguration {
* @param self the reserve configuration
* @return the stable rate borrowing state
**/
function getStableRateBorrowingEnabled(DataTypes.ReserveBitmap storage self)
function getStableRateBorrowingEnabled(DataTypes.ReserveConfigurationMap storage self)
internal
view
returns (bool)
@ -223,7 +223,7 @@ library ReserveConfiguration {
* @param self the reserve configuration
* @param reserveFactor the reserve factor
**/
function setReserveFactor(DataTypes.ReserveBitmap memory self, uint256 reserveFactor)
function setReserveFactor(DataTypes.ReserveConfigurationMap memory self, uint256 reserveFactor)
internal
pure
{
@ -239,7 +239,7 @@ library ReserveConfiguration {
* @param self the reserve configuration
* @return the reserve factor
**/
function getReserveFactor(DataTypes.ReserveBitmap storage self) internal view returns (uint256) {
function getReserveFactor(DataTypes.ReserveConfigurationMap storage self) internal view returns (uint256) {
return (self.data & ~RESERVE_FACTOR_MASK) >> RESERVE_FACTOR_START_BIT_POSITION;
}
@ -248,7 +248,7 @@ library ReserveConfiguration {
* @param self the reserve configuration
* @return the state flags representing active, frozen, borrowing enabled, stableRateBorrowing enabled
**/
function getFlags(DataTypes.ReserveBitmap storage self)
function getFlags(DataTypes.ReserveConfigurationMap storage self)
internal
view
returns (
@ -273,7 +273,7 @@ library ReserveConfiguration {
* @param self the reserve configuration
* @return the state params representing ltv, liquidation threshold, liquidation bonus, the reserve decimals
**/
function getParams(DataTypes.ReserveBitmap storage self)
function getParams(DataTypes.ReserveConfigurationMap storage self)
internal
view
returns (
@ -300,7 +300,7 @@ library ReserveConfiguration {
* @param self the reserve configuration
* @return the state params representing ltv, liquidation threshold, liquidation bonus, the reserve decimals
**/
function getParamsMemory(DataTypes.ReserveBitmap memory self)
function getParamsMemory(DataTypes.ReserveConfigurationMap memory self)
internal
pure
returns (
@ -325,7 +325,7 @@ library ReserveConfiguration {
* @param self the reserve configuration
* @return the state flags representing active, frozen, borrowing enabled, stableRateBorrowing enabled
**/
function getFlagsMemory(DataTypes.ReserveBitmap memory self)
function getFlagsMemory(DataTypes.ReserveConfigurationMap memory self)
internal
pure
returns (

View File

@ -20,7 +20,7 @@ library UserConfiguration {
* @param borrowing true if the user is borrowing the reserve, false otherwise
**/
function setBorrowing(
DataTypes.UserBitmap storage self,
DataTypes.UserConfigurationMap storage self,
uint256 reserveIndex,
bool borrowing
) internal {
@ -37,7 +37,7 @@ library UserConfiguration {
* @param _usingAsCollateral true if the user is usin the reserve as collateral, false otherwise
**/
function setUsingAsCollateral(
DataTypes.UserBitmap storage self,
DataTypes.UserConfigurationMap storage self,
uint256 reserveIndex,
bool _usingAsCollateral
) internal {
@ -53,7 +53,7 @@ library UserConfiguration {
* @param reserveIndex the index of the reserve in the bitmap
* @return true if the user has been using a reserve for borrowing or as collateral, false otherwise
**/
function isUsingAsCollateralOrBorrowing(DataTypes.UserBitmap memory self, uint256 reserveIndex)
function isUsingAsCollateralOrBorrowing(DataTypes.UserConfigurationMap memory self, uint256 reserveIndex)
internal
pure
returns (bool)
@ -68,7 +68,7 @@ library UserConfiguration {
* @param reserveIndex the index of the reserve in the bitmap
* @return true if the user has been using a reserve for borrowing, false otherwise
**/
function isBorrowing(DataTypes.UserBitmap memory self, uint256 reserveIndex)
function isBorrowing(DataTypes.UserConfigurationMap memory self, uint256 reserveIndex)
internal
pure
returns (bool)
@ -83,7 +83,7 @@ library UserConfiguration {
* @param reserveIndex the index of the reserve in the bitmap
* @return true if the user has been using a reserve as collateral, false otherwise
**/
function isUsingAsCollateral(DataTypes.UserBitmap memory self, uint256 reserveIndex)
function isUsingAsCollateral(DataTypes.UserConfigurationMap memory self, uint256 reserveIndex)
internal
pure
returns (bool)
@ -97,7 +97,7 @@ library UserConfiguration {
* @param self the configuration object
* @return true if the user has been borrowing any reserve, false otherwise
**/
function isBorrowingAny(DataTypes.UserBitmap memory self) internal pure returns (bool) {
function isBorrowingAny(DataTypes.UserConfigurationMap memory self) internal pure returns (bool) {
return self.data & BORROWING_MASK != 0;
}
@ -106,7 +106,7 @@ library UserConfiguration {
* @param self the configuration object
* @return true if the user has been borrowing any reserve, false otherwise
**/
function isEmpty(DataTypes.UserBitmap memory self) internal pure returns (bool) {
function isEmpty(DataTypes.UserConfigurationMap memory self) internal pure returns (bool) {
return self.data == 0;
}
}

View File

@ -22,8 +22,8 @@ library GenericLogic {
using SafeMath for uint256;
using WadRayMath for uint256;
using PercentageMath for uint256;
using ReserveConfiguration for DataTypes.ReserveBitmap;
using UserConfiguration for DataTypes.UserBitmap;
using ReserveConfiguration for DataTypes.ReserveConfigurationMap;
using UserConfiguration for DataTypes.UserConfigurationMap;
uint256 public constant HEALTH_FACTOR_LIQUIDATION_THRESHOLD = 1 ether;
@ -57,7 +57,7 @@ library GenericLogic {
address user,
uint256 amount,
mapping(address => DataTypes.ReserveData) storage reservesData,
DataTypes.UserBitmap calldata userConfig,
DataTypes.UserConfigurationMap calldata userConfig,
mapping(uint256 => address) storage reserves,
uint256 reservesCount,
address oracle
@ -152,7 +152,7 @@ library GenericLogic {
function calculateUserAccountData(
address user,
mapping(address => DataTypes.ReserveData) storage reservesData,
DataTypes.UserBitmap memory userConfig,
DataTypes.UserConfigurationMap memory userConfig,
mapping(uint256 => address) storage reserves,
uint256 reservesCount,
address oracle

View File

@ -45,7 +45,7 @@ library ReserveLogic {
);
using ReserveLogic for DataTypes.ReserveData;
using ReserveConfiguration for DataTypes.ReserveBitmap;
using ReserveConfiguration for DataTypes.ReserveConfigurationMap;
/**
* @dev returns the ongoing normalized income for the reserve.

View File

@ -27,8 +27,8 @@ library ValidationLogic {
using WadRayMath for uint256;
using PercentageMath for uint256;
using SafeERC20 for IERC20;
using ReserveConfiguration for DataTypes.ReserveBitmap;
using UserConfiguration for DataTypes.UserBitmap;
using ReserveConfiguration for DataTypes.ReserveConfigurationMap;
using UserConfiguration for DataTypes.UserConfigurationMap;
uint256 public constant REBALANCE_UP_LIQUIDITY_RATE_THRESHOLD = 4000;
uint256 public constant REBALANCE_UP_USAGE_RATIO_THRESHOLD = 0.95 * 1e27; //usage ratio of 95%
@ -62,7 +62,7 @@ library ValidationLogic {
uint256 amount,
uint256 userBalance,
mapping(address => DataTypes.ReserveData) storage reservesData,
DataTypes.UserBitmap storage userConfig,
DataTypes.UserConfigurationMap storage userConfig,
mapping(uint256 => address) storage reserves,
uint256 reservesCount,
address oracle
@ -133,7 +133,7 @@ library ValidationLogic {
uint256 interestRateMode,
uint256 maxStableLoanPercent,
mapping(address => DataTypes.ReserveData) storage reservesData,
DataTypes.UserBitmap storage userConfig,
DataTypes.UserConfigurationMap storage userConfig,
mapping(uint256 => address) storage reserves,
uint256 reservesCount,
address oracle
@ -266,7 +266,7 @@ library ValidationLogic {
*/
function validateSwapRateMode(
DataTypes.ReserveData storage reserve,
DataTypes.UserBitmap storage userConfig,
DataTypes.UserConfigurationMap storage userConfig,
uint256 stableDebt,
uint256 variableDebt,
DataTypes.InterestRateMode currentRateMode
@ -354,7 +354,7 @@ library ValidationLogic {
address reserveAddress,
bool useAsCollateral,
mapping(address => DataTypes.ReserveData) storage reservesData,
DataTypes.UserBitmap storage userConfig,
DataTypes.UserConfigurationMap storage userConfig,
mapping(uint256 => address) storage reserves,
uint256 reservesCount,
address oracle
@ -400,7 +400,7 @@ library ValidationLogic {
function validateLiquidationCall(
DataTypes.ReserveData storage collateralReserve,
DataTypes.ReserveData storage principalReserve,
DataTypes.UserBitmap storage userConfig,
DataTypes.UserConfigurationMap storage userConfig,
uint256 userHealthFactor,
uint256 userStableDebt,
uint256 userVariableDebt
@ -454,7 +454,7 @@ library ValidationLogic {
function validateTransfer(
address from,
mapping(address => DataTypes.ReserveData) storage reservesData,
DataTypes.UserBitmap storage userConfig,
DataTypes.UserConfigurationMap storage userConfig,
mapping(uint256 => address) storage reserves,
uint256 reservesCount,
address oracle

View File

@ -5,7 +5,7 @@ library DataTypes {
// refer to the whitepaper, section 1.1 basic concepts for a formal description of these properties.
struct ReserveData {
//stores the reserve configuration
ReserveBitmap configuration;
ReserveConfigurationMap configuration;
//the liquidity index. Expressed in ray
uint128 liquidityIndex;
//variable borrow index. Expressed in ray
@ -27,7 +27,7 @@ library DataTypes {
uint8 id;
}
struct ReserveBitmap {
struct ReserveConfigurationMap {
//bit 0-15: LTV
//bit 16-31: Liq. threshold
//bit 32-47: Liq. bonus
@ -41,7 +41,7 @@ library DataTypes {
uint256 data;
}
struct UserBitmap {
struct UserConfigurationMap {
uint256 data;
}

View File

@ -90,7 +90,7 @@ contract LendingPoolHarnessForVariableDebtToken is ILendingPool {
external
view
override
returns (DataTypes.UserBitmap memory)
returns (DataTypes.UserConfigurationMap memory)
{
return originalPool.getUserConfiguration(user);
}
@ -142,7 +142,7 @@ contract LendingPoolHarnessForVariableDebtToken is ILendingPool {
external
view
override
returns (DataTypes.ReserveBitmap memory)
returns (DataTypes.ReserveConfigurationMap memory)
{
return originalPool.getConfiguration(asset);
}

View File

@ -7,7 +7,7 @@ import {UserConfiguration} from '../../contracts/libraries/configuration/UserCon
A wrapper contract for calling functions from the library UserConfiguration.
*/
contract UserConfigurationHarness {
DataTypes.UserBitmap internal usersConfig;
DataTypes.UserConfigurationMap internal usersConfig;
function setBorrowing(
address user,