From c14ea749c467fc8b65b580d5891291e780b935e8 Mon Sep 17 00:00:00 2001 From: eboado Date: Mon, 26 Oct 2020 11:18:56 +0100 Subject: [PATCH] - Optimized length load on _addToAddressesProvidersList(). --- .../configuration/LendingPoolAddressesProviderRegistry.sol | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/contracts/configuration/LendingPoolAddressesProviderRegistry.sol b/contracts/configuration/LendingPoolAddressesProviderRegistry.sol index 77c260bf..50e79288 100644 --- a/contracts/configuration/LendingPoolAddressesProviderRegistry.sol +++ b/contracts/configuration/LendingPoolAddressesProviderRegistry.sol @@ -76,7 +76,9 @@ contract LendingPoolAddressesProviderRegistry is Ownable, ILendingPoolAddressesP * @param provider the pool address to be added **/ function _addToAddressesProvidersList(address provider) internal { - for (uint256 i = 0; i < _addressesProvidersList.length; i++) { + uint256 providersCount = _addressesProvidersList.length; + + for (uint256 i = 0; i < providersCount; i++) { if (_addressesProvidersList[i] == provider) { return; }