From 5c2ec07b709d7dae63998d6a9f58277d4a67e266 Mon Sep 17 00:00:00 2001 From: The3D Date: Wed, 16 Sep 2020 17:12:07 +0200 Subject: [PATCH] Fixes #42 --- contracts/lendingpool/LendingPool.sol | 2 ++ contracts/libraries/helpers/Errors.sol | 1 + 2 files changed, 3 insertions(+) diff --git a/contracts/lendingpool/LendingPool.sol b/contracts/lendingpool/LendingPool.sol index e6a3c059..c9919495 100644 --- a/contracts/lendingpool/LendingPool.sol +++ b/contracts/lendingpool/LendingPool.sol @@ -44,6 +44,7 @@ contract LendingPool is VersionedInitializable, ILendingPool { uint256 public constant REBALANCE_DOWN_RATE_DELTA = (1e27) / 5; uint256 public constant MAX_STABLE_RATE_BORROW_SIZE_PERCENT = 25; uint256 public constant FLASHLOAN_PREMIUM_TOTAL = 9; + uint256 public constant MAX_NUMBER_RESERVES = 128; ILendingPoolAddressesProvider internal _addressesProvider; @@ -945,6 +946,7 @@ contract LendingPool is VersionedInitializable, ILendingPool { **/ function _addReserveToList(address asset) internal { bool reserveAlreadyAdded = false; + require(_reservesList.length < MAX_NUMBER_RESERVES, Errors.NO_MORE_RESERVES_ALLOWED); for (uint256 i = 0; i < _reservesList.length; i++) if (_reservesList[i] == asset) { reserveAlreadyAdded = true; diff --git a/contracts/libraries/helpers/Errors.sol b/contracts/libraries/helpers/Errors.sol index d25b041b..23431b03 100644 --- a/contracts/libraries/helpers/Errors.sol +++ b/contracts/libraries/helpers/Errors.sol @@ -43,6 +43,7 @@ library Errors { string public constant FAILED_REPAY_WITH_COLLATERAL = '53'; string public constant FAILED_COLLATERAL_SWAP = '55'; string public constant INVALID_EQUAL_ASSETS_TO_SWAP = '56'; + string public constant NO_MORE_RESERVES_ALLOWED = '59'; // require error messages - aToken string public constant CALLER_MUST_BE_LENDING_POOL = '28'; // 'The caller of this function must be a lending pool'