From e0f5c5fb7f5a4e6a5a592ba008b5a263f684d316 Mon Sep 17 00:00:00 2001
From: emilio <emilio@ethlend.io>
Date: Mon, 19 Oct 2020 15:29:42 +0200
Subject: [PATCH 01/13] Fixes PVE002

---
 contracts/libraries/math/WadRayMath.sol | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contracts/libraries/math/WadRayMath.sol b/contracts/libraries/math/WadRayMath.sol
index 7da5fc81..4d6d02f5 100644
--- a/contracts/libraries/math/WadRayMath.sol
+++ b/contracts/libraries/math/WadRayMath.sol
@@ -54,7 +54,7 @@ library WadRayMath {
    * @return the result of a*b, in wad
    **/
   function wadMul(uint256 a, uint256 b) internal pure returns (uint256) {
-    if (a == 0) {
+    if (a == 0 || b == 0) {
       return 0;
     }
 

From b57a59ea6d1e8c24e14adc3eecdf45c86be9d0f0 Mon Sep 17 00:00:00 2001
From: emilio <emilio@ethlend.io>
Date: Mon, 19 Oct 2020 15:40:19 +0200
Subject: [PATCH 02/13] Fixes PVE002

---
 contracts/libraries/math/WadRayMath.sol | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/contracts/libraries/math/WadRayMath.sol b/contracts/libraries/math/WadRayMath.sol
index 4d6d02f5..c4001a71 100644
--- a/contracts/libraries/math/WadRayMath.sol
+++ b/contracts/libraries/math/WadRayMath.sol
@@ -78,6 +78,10 @@ library WadRayMath {
   function wadDiv(uint256 a, uint256 b) internal pure returns (uint256) {
     require(b != 0, Errors.DIVISION_BY_ZERO);
 
+    if (a == 0) {
+      return 0;
+    }
+
     uint256 halfB = b / 2;
 
     uint256 result = a * WAD;
@@ -98,7 +102,7 @@ library WadRayMath {
    * @return the result of a*b, in ray
    **/
   function rayMul(uint256 a, uint256 b) internal pure returns (uint256) {
-    if (a == 0) {
+    if (a == 0 || b == 0) {
       return 0;
     }
 
@@ -122,6 +126,10 @@ library WadRayMath {
   function rayDiv(uint256 a, uint256 b) internal pure returns (uint256) {
     require(b != 0, Errors.DIVISION_BY_ZERO);
 
+    if (a == 0) {
+      return 0;
+    }
+
     uint256 halfB = b / 2;
 
     uint256 result = a * RAY;

From bdac7b0d41549c43c314e5c0fe84594d35894904 Mon Sep 17 00:00:00 2001
From: emilio <emilio@ethlend.io>
Date: Mon, 19 Oct 2020 15:45:35 +0200
Subject: [PATCH 03/13] Fixes PVE004

---
 contracts/lendingpool/LendingPool.sol | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contracts/lendingpool/LendingPool.sol b/contracts/lendingpool/LendingPool.sol
index ac052e33..9bbc8d30 100644
--- a/contracts/lendingpool/LendingPool.sol
+++ b/contracts/lendingpool/LendingPool.sol
@@ -267,7 +267,7 @@ contract LendingPool is VersionedInitializable, ILendingPool, LendingPoolStorage
       ? stableDebt
       : variableDebt;
 
-    if (amount != type(uint256).max && amount < paybackAmount) {
+    if (amount < paybackAmount) {
       paybackAmount = amount;
     }
 

From 1dd92aed6712ce9f1e3673b2b69882ee7ac5488c Mon Sep 17 00:00:00 2001
From: emilio <emilio@ethlend.io>
Date: Mon, 19 Oct 2020 15:52:56 +0200
Subject: [PATCH 04/13] fixes PVE006

---
 contracts/lendingpool/DefaultReserveInterestRateStrategy.sol | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contracts/lendingpool/DefaultReserveInterestRateStrategy.sol b/contracts/lendingpool/DefaultReserveInterestRateStrategy.sol
index 4f17a7c9..7ed6aa42 100644
--- a/contracts/lendingpool/DefaultReserveInterestRateStrategy.sol
+++ b/contracts/lendingpool/DefaultReserveInterestRateStrategy.sol
@@ -162,7 +162,7 @@ contract DefaultReserveInterestRateStrategy is IReserveInterestRateStrategy {
         _stableRateSlope1.rayMul(utilizationRate.rayDiv(OPTIMAL_UTILIZATION_RATE))
       );
       vars.currentVariableBorrowRate = _baseVariableBorrowRate.add(
-        utilizationRate.rayDiv(OPTIMAL_UTILIZATION_RATE).rayMul(_variableRateSlope1)
+        utilizationRate.rayMul(_variableRateSlope1).rayDiv(OPTIMAL_UTILIZATION_RATE)
       );
     }
 

From 3575d58ff43ffa751b026681bd3d4ebbcbc0aea8 Mon Sep 17 00:00:00 2001
From: emilio <emilio@ethlend.io>
Date: Mon, 19 Oct 2020 16:24:49 +0200
Subject: [PATCH 05/13] unified interface of stable, variable debt tokens and
 aTokens

---
 contracts/tokenization/AToken.sol             |  6 +++---
 contracts/tokenization/VariableDebtToken.sol  |  5 +++--
 contracts/tokenization/base/DebtTokenBase.sol | 10 +++-------
 deployed-contracts.json                       |  8 ++++----
 4 files changed, 13 insertions(+), 16 deletions(-)

diff --git a/contracts/tokenization/AToken.sol b/contracts/tokenization/AToken.sol
index 13aa905c..bee1184d 100644
--- a/contracts/tokenization/AToken.sol
+++ b/contracts/tokenization/AToken.sol
@@ -2,7 +2,7 @@
 pragma solidity ^0.6.8;
 
 import {IncentivizedERC20} from './IncentivizedERC20.sol';
-import {LendingPool} from '../lendingpool/LendingPool.sol';
+import {ILendingPool} from '../interfaces/ILendingPool.sol';
 import {WadRayMath} from '../libraries/math/WadRayMath.sol';
 import {Errors} from '../libraries/helpers/Errors.sol';
 import {VersionedInitializable} from '../libraries/aave-upgradeability/VersionedInitializable.sol';
@@ -32,7 +32,7 @@ contract AToken is VersionedInitializable, IncentivizedERC20, IAToken {
   uint256 public constant ATOKEN_REVISION = 0x1;
   address public immutable UNDERLYING_ASSET_ADDRESS;
   address public immutable RESERVE_TREASURY_ADDRESS;
-  LendingPool public immutable POOL;
+  ILendingPool public immutable POOL;
 
   /// @dev owner => next valid nonce to submit with permit()
   mapping(address => uint256) public _nonces;
@@ -45,7 +45,7 @@ contract AToken is VersionedInitializable, IncentivizedERC20, IAToken {
   }
 
   constructor(
-    LendingPool pool,
+    ILendingPool pool,
     address underlyingAssetAddress,
     address reserveTreasuryAddress,
     string memory tokenName,
diff --git a/contracts/tokenization/VariableDebtToken.sol b/contracts/tokenization/VariableDebtToken.sol
index 814ad8e7..2a5d903c 100644
--- a/contracts/tokenization/VariableDebtToken.sol
+++ b/contracts/tokenization/VariableDebtToken.sol
@@ -43,7 +43,7 @@ contract VariableDebtToken is DebtTokenBase, IVariableDebtToken {
       return 0;
     }
 
-    return scaledBalance.rayMul(POOL.getReserveNormalizedVariableDebt(UNDERLYING_ASSET));
+    return scaledBalance.rayMul(POOL.getReserveNormalizedVariableDebt(UNDERLYING_ASSET_ADDRESS));
   }
 
   /**
@@ -102,7 +102,8 @@ contract VariableDebtToken is DebtTokenBase, IVariableDebtToken {
    * @return the total supply
    **/
   function totalSupply() public virtual override view returns (uint256) {
-    return super.totalSupply().rayMul(POOL.getReserveNormalizedVariableDebt(UNDERLYING_ASSET));
+    return
+      super.totalSupply().rayMul(POOL.getReserveNormalizedVariableDebt(UNDERLYING_ASSET_ADDRESS));
   }
 
   /**
diff --git a/contracts/tokenization/base/DebtTokenBase.sol b/contracts/tokenization/base/DebtTokenBase.sol
index a2744017..fc43e770 100644
--- a/contracts/tokenization/base/DebtTokenBase.sol
+++ b/contracts/tokenization/base/DebtTokenBase.sol
@@ -15,8 +15,8 @@ import {Errors} from '../../libraries/helpers/Errors.sol';
  */
 
 abstract contract DebtTokenBase is IncentivizedERC20, VersionedInitializable {
-  address internal immutable UNDERLYING_ASSET;
-  ILendingPool internal immutable POOL;
+  address public immutable UNDERLYING_ASSET_ADDRESS;
+  ILendingPool public immutable POOL;
   mapping(address => uint256) internal _usersData;
 
   /**
@@ -39,7 +39,7 @@ abstract contract DebtTokenBase is IncentivizedERC20, VersionedInitializable {
     address incentivesController
   ) public IncentivizedERC20(name, symbol, 18, incentivesController) {
     POOL = ILendingPool(pool);
-    UNDERLYING_ASSET = underlyingAssetAddress;
+    UNDERLYING_ASSET_ADDRESS = underlyingAssetAddress;
   }
 
   /**
@@ -58,10 +58,6 @@ abstract contract DebtTokenBase is IncentivizedERC20, VersionedInitializable {
     _setDecimals(decimals);
   }
 
-  function underlyingAssetAddress() public view returns (address) {
-    return UNDERLYING_ASSET;
-  }
-
   /**
    * @dev Being non transferrable, the debt token does not implement any of the
    * standard ERC20 functions for transfer and allowance.
diff --git a/deployed-contracts.json b/deployed-contracts.json
index f0208be5..46423910 100644
--- a/deployed-contracts.json
+++ b/deployed-contracts.json
@@ -231,7 +231,7 @@
   },
   "WalletBalanceProvider": {
     "buidlerevm": {
-      "address": "0xC6bA6049F86d528698B5924B8fC2FE7289D38578",
+      "address": "0x2cfcA5785261fbC88EFFDd46fCFc04c22525F9e4",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
@@ -620,7 +620,7 @@
   },
   "MockAToken": {
     "buidlerevm": {
-      "address": "0x3b050AFb4ac4ACE646b31fF3639C1CD43aC31460",
+      "address": "0x392E5355a0e88Bd394F717227c752670fb3a8020",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
@@ -648,7 +648,7 @@
   },
   "MockStableDebtToken": {
     "buidlerevm": {
-      "address": "0xEBAB67ee3ef604D5c250A53b4b8fcbBC6ec3007C",
+      "address": "0x3b050AFb4ac4ACE646b31fF3639C1CD43aC31460",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
@@ -662,7 +662,7 @@
   },
   "MockVariableDebtToken": {
     "buidlerevm": {
-      "address": "0xBE36BE5680244Ae1A6F983E4A6f6E1c142cdAbe3",
+      "address": "0xEBAB67ee3ef604D5c250A53b4b8fcbBC6ec3007C",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {

From 19756cdbe8507d888b698d48c2f6d670725fd7db Mon Sep 17 00:00:00 2001
From: emilio <emilio@ethlend.io>
Date: Mon, 19 Oct 2020 18:29:32 +0200
Subject: [PATCH 06/13] fixed PVE001, PVE009(1)

---
 .../LendingPoolAddressesProviderRegistry.sol  |  2 ++
 .../lendingpool/LendingPoolConfigurator.sol   | 26 +++++++++++++++++--
 contracts/libraries/helpers/Errors.sol        | 10 +++++--
 .../interfaces/ITokenConfiguration.sol        | 13 ++++++++++
 helpers/contracts-helpers.ts                  |  1 -
 helpers/types.ts                              |  1 +
 test/addresses-provider-registry.spec.ts      |  9 +++++++
 7 files changed, 57 insertions(+), 5 deletions(-)
 create mode 100644 contracts/tokenization/interfaces/ITokenConfiguration.sol

diff --git a/contracts/configuration/LendingPoolAddressesProviderRegistry.sol b/contracts/configuration/LendingPoolAddressesProviderRegistry.sol
index f8dfb629..77c260bf 100644
--- a/contracts/configuration/LendingPoolAddressesProviderRegistry.sol
+++ b/contracts/configuration/LendingPoolAddressesProviderRegistry.sol
@@ -54,6 +54,8 @@ contract LendingPoolAddressesProviderRegistry is Ownable, ILendingPoolAddressesP
    * @param provider the pool address to be registered
    **/
   function registerAddressesProvider(address provider, uint256 id) external override onlyOwner {
+    require(id != 0, Errors.INVALID_ADDRESSES_PROVIDER_ID);
+
     _addressesProviders[provider] = id;
     _addToAddressesProvidersList(provider);
     emit AddressesProviderRegistered(provider);
diff --git a/contracts/lendingpool/LendingPoolConfigurator.sol b/contracts/lendingpool/LendingPoolConfigurator.sol
index 8f154e23..c3da634c 100644
--- a/contracts/lendingpool/LendingPoolConfigurator.sol
+++ b/contracts/lendingpool/LendingPoolConfigurator.sol
@@ -10,6 +10,7 @@ import {
 import {ReserveConfiguration} from '../libraries/configuration/ReserveConfiguration.sol';
 import {ILendingPoolAddressesProvider} from '../interfaces/ILendingPoolAddressesProvider.sol';
 import {ILendingPool} from '../interfaces/ILendingPool.sol';
+import {ITokenConfiguration} from '../tokenization/interfaces/ITokenConfiguration.sol';
 import {IERC20Detailed} from '../dependencies/openzeppelin/contracts/IERC20Detailed.sol';
 import {Errors} from '../libraries/helpers/Errors.sol';
 import {ReserveLogic} from '../libraries/logic/ReserveLogic.sol';
@@ -200,7 +201,6 @@ contract LendingPoolConfigurator is VersionedInitializable {
 
   /**
    * @dev initializes a reserve
-   * @param asset the address of the reserve to be initialized
    * @param aTokenImpl  the address of the aToken contract implementation
    * @param stableDebtTokenImpl the address of the stable debt token contract
    * @param variableDebtTokenImpl the address of the variable debt token contract
@@ -208,13 +208,35 @@ contract LendingPoolConfigurator is VersionedInitializable {
    * @param interestRateStrategyAddress the address of the interest rate strategy contract for this reserve
    **/
   function initReserve(
-    address asset,
     address aTokenImpl,
     address stableDebtTokenImpl,
     address variableDebtTokenImpl,
     uint8 underlyingAssetDecimals,
     address interestRateStrategyAddress
   ) public onlyAaveAdmin {
+    address asset = ITokenConfiguration(aTokenImpl).UNDERLYING_ASSET_ADDRESS();
+
+    require(
+      address(pool) == ITokenConfiguration(aTokenImpl).POOL(),
+      Errors.INVALID_ATOKEN_POOL_ADDRESS
+    );
+    require(
+      address(pool) == ITokenConfiguration(stableDebtTokenImpl).POOL(),
+      Errors.INVALID_STABLE_DEBT_TOKEN_POOL_ADDRESS
+    );
+    require(
+      address(pool) == ITokenConfiguration(variableDebtTokenImpl).POOL(),
+      Errors.INVALID_VARIABLE_DEBT_TOKEN_POOL_ADDRESS
+    );
+    require(
+      asset == ITokenConfiguration(stableDebtTokenImpl).UNDERLYING_ASSET_ADDRESS(),
+      Errors.INVALID_STABLE_DEBT_TOKEN_UNDERLYING_ADDRESS
+    );
+    require(
+      asset == ITokenConfiguration(variableDebtTokenImpl).UNDERLYING_ASSET_ADDRESS(),
+      Errors.INVALID_VARIABLE_DEBT_TOKEN_UNDERLYING_ADDRESS
+    );
+
     address aTokenProxyAddress = _initTokenWithProxy(aTokenImpl, underlyingAssetDecimals);
 
     address stableDebtTokenProxyAddress = _initTokenWithProxy(
diff --git a/contracts/libraries/helpers/Errors.sol b/contracts/libraries/helpers/Errors.sol
index ee71efaa..985a2bc3 100644
--- a/contracts/libraries/helpers/Errors.sol
+++ b/contracts/libraries/helpers/Errors.sol
@@ -50,8 +50,8 @@ library Errors {
   string public constant CALLER_MUST_BE_LENDING_POOL = '28'; // 'The caller of this function must be a lending pool'
   string public constant CANNOT_GIVE_ALLOWANCE_TO_HIMSELF = '30'; // 'User cannot give allowance to himself'
   string public constant TRANSFER_AMOUNT_NOT_GT_0 = '31'; // 'Transferred amount needs to be greater than zero'
-  string public constant INVALID_MINT_AMOUNT = '53'; //invalid amount to mint
-  string public constant INVALID_BURN_AMOUNT = '54'; //invalid amount to burn
+  string public constant INVALID_MINT_AMOUNT = '61'; //invalid amount to mint
+  string public constant INVALID_BURN_AMOUNT = '62'; //invalid amount to burn
 
   // require error messages - ReserveLogic
   string public constant RESERVE_ALREADY_INITIALIZED = '34'; // 'Reserve has already been initialized'
@@ -64,9 +64,15 @@ library Errors {
   //require error messages - LendingPoolConfiguration
   string public constant CALLER_NOT_AAVE_ADMIN = '35'; // 'The caller must be the aave admin'
   string public constant RESERVE_LIQUIDITY_NOT_0 = '36'; // 'The liquidity of the reserve needs to be 0'
+  string public constant INVALID_ATOKEN_POOL_ADDRESS = '63'; // the lending pool in the aToken implementation is not configured correctly
+  string public constant INVALID_STABLE_DEBT_TOKEN_POOL_ADDRESS = '64'; // the lending pool in the stable debt token implementation is not configured correctly
+  string public constant INVALID_VARIABLE_DEBT_TOKEN_POOL_ADDRESS = '65'; // the lending pool in the variable debt token implementation is not configured correctly
+  string public constant INVALID_STABLE_DEBT_TOKEN_UNDERLYING_ADDRESS = '66'; // the underlying asset in the stable debt token implementation is not configured correctly
+  string public constant INVALID_VARIABLE_DEBT_TOKEN_UNDERLYING_ADDRESS = '67'; // the underlying asset in the variable debt token implementation is not configured correctly
 
   //require error messages - LendingPoolAddressesProviderRegistry
   string public constant PROVIDER_NOT_REGISTERED = '37'; // 'Provider is not registered'
+  string public constant INVALID_ADDRESSES_PROVIDER_ID = '68'; // the addresses provider id needs to be greater than 0
 
   //return error messages - LendingPoolCollateralManager
   string public constant HEALTH_FACTOR_NOT_BELOW_THRESHOLD = '38'; // 'Health factor is not below the threshold'
diff --git a/contracts/tokenization/interfaces/ITokenConfiguration.sol b/contracts/tokenization/interfaces/ITokenConfiguration.sol
new file mode 100644
index 00000000..50eb3b09
--- /dev/null
+++ b/contracts/tokenization/interfaces/ITokenConfiguration.sol
@@ -0,0 +1,13 @@
+pragma solidity ^0.6;
+
+/**
+ * @title ITokenConfiguration
+ * @author Aave
+ * @dev common interface between aTokens and debt tokens to fetch the
+ * token configuration
+ **/
+interface ITokenConfiguration {
+  function UNDERLYING_ASSET_ADDRESS() external view returns (address);
+
+  function POOL() external view returns (address);
+}
diff --git a/helpers/contracts-helpers.ts b/helpers/contracts-helpers.ts
index 77730b04..62afaa35 100644
--- a/helpers/contracts-helpers.ts
+++ b/helpers/contracts-helpers.ts
@@ -857,7 +857,6 @@ export const initReserves = async (
 
       console.log('init reserve currency ', assetSymbol);
       await lendingPoolConfigurator.initReserve(
-        tokenAddress,
         aToken.address,
         stableDebtToken.address,
         variableDebtToken.address,
diff --git a/helpers/types.ts b/helpers/types.ts
index 0b5e4a33..f2682691 100644
--- a/helpers/types.ts
+++ b/helpers/types.ts
@@ -106,6 +106,7 @@ export enum ProtocolErrors {
 
   //require error messages - LendingPoolAddressesProviderRegistry
   PROVIDER_NOT_REGISTERED = '37', // 'Provider is not registered'
+  INVALID_ADDRESSES_PROVIDER_ID = '68',
 
   //return error messages - LendingPoolCollateralManager
   HEALTH_FACTOR_NOT_BELOW_THRESHOLD = '38', // 'Health factor is not below the threshold'
diff --git a/test/addresses-provider-registry.spec.ts b/test/addresses-provider-registry.spec.ts
index 457514e4..5630591d 100644
--- a/test/addresses-provider-registry.spec.ts
+++ b/test/addresses-provider-registry.spec.ts
@@ -18,6 +18,15 @@ makeSuite('AddressesProviderRegistry', (testEnv: TestEnv) => {
     );
   });
 
+  it('tries to register an addresses provider with id 0', async () => {
+    const {users, registry} = testEnv;
+    const {INVALID_ADDRESSES_PROVIDER_ID} = ProtocolErrors;
+
+    await expect(registry.registerAddressesProvider(users[2].address, '0')).to.be.revertedWith(
+      INVALID_ADDRESSES_PROVIDER_ID
+    );
+  });
+
   it('Registers a new mock addresses provider', async () => {
     const {users, registry} = testEnv;
 

From b7efa920ca21c4f5c67c471c3ea6e27921bfb013 Mon Sep 17 00:00:00 2001
From: The3D <emilio@aave.com>
Date: Thu, 22 Oct 2020 11:50:04 +0200
Subject: [PATCH 07/13] Remove swapLiquidity/repayWithCollateral

---
 contracts/interfaces/ILendingPool.sol         |  37 -
 contracts/lendingpool/LendingPool.sol         |  87 --
 .../LendingPoolCollateralManager.sol          | 285 +-----
 contracts/libraries/logic/ValidationLogic.sol |  91 --
 contracts/mocks/flashloan/MockSwapAdapter.sol |  59 --
 deployed-contracts.json                       |  96 +-
 test/collateral-swap.spec.ts                  | 258 -----
 .../flash-liquidation-with-collateral.spec.ts | 932 ------------------
 test/pausable-functions.spec.ts               |  42 -
 test/repay-with-collateral.spec.ts            | 682 -------------
 10 files changed, 50 insertions(+), 2519 deletions(-)
 delete mode 100644 contracts/mocks/flashloan/MockSwapAdapter.sol
 delete mode 100644 test/collateral-swap.spec.ts
 delete mode 100644 test/flash-liquidation-with-collateral.spec.ts
 delete mode 100644 test/repay-with-collateral.spec.ts

diff --git a/contracts/interfaces/ILendingPool.sol b/contracts/interfaces/ILendingPool.sol
index 8396d35f..2b4ead37 100644
--- a/contracts/interfaces/ILendingPool.sol
+++ b/contracts/interfaces/ILendingPool.sol
@@ -259,27 +259,6 @@ interface ILendingPool {
     bool receiveAToken
   ) external;
 
-  /**
-   * @dev flashes the underlying collateral on an user to swap for the owed asset and repay
-   * - Both the owner of the position and other liquidators can execute it
-   * - The owner can repay with his collateral at any point, no matter the health factor
-   * - Other liquidators can only use this function below 1 HF. To liquidate 50% of the debt > HF 0.98 or the whole below
-   * @param collateral The address of the collateral asset
-   * @param principal The address of the owed asset
-   * @param user Address of the borrower
-   * @param principalAmount Amount of the debt to repay. type(uint256).max to repay the maximum possible
-   * @param receiver Address of the contract receiving the collateral to swap
-   * @param params Variadic bytes param to pass with extra information to the receiver
-   **/
-  function repayWithCollateral(
-    address collateral,
-    address principal,
-    address user,
-    uint256 principalAmount,
-    address receiver,
-    bytes calldata params
-  ) external;
-
   /**
    * @dev allows smartcontracts to access the liquidity of the pool within one transaction,
    * as long as the amount taken plus a fee is returned. NOTE There are security concerns for developers of flashloan receiver contracts
@@ -299,22 +278,6 @@ interface ILendingPool {
     uint16 referralCode
   ) external;
 
-  /**
-   * @dev Allows an user to release one of his assets deposited in the protocol, even if it is used as collateral, to swap for another.
-   * - It's not possible to release one asset to swap for the same
-   * @param receiverAddress The address of the contract receiving the funds. The receiver should implement the ISwapAdapter interface
-   * @param fromAsset Asset to swap from
-   * @param toAsset Asset to swap to
-   * @param params a bytes array to be sent (if needed) to the receiver contract with extra data
-   **/
-  function swapLiquidity(
-    address receiverAddress,
-    address fromAsset,
-    address toAsset,
-    uint256 amountToSwap,
-    bytes calldata params
-  ) external;
-
   function getUserAccountData(address user)
     external
     view
diff --git a/contracts/lendingpool/LendingPool.sol b/contracts/lendingpool/LendingPool.sol
index ac052e33..c1ff20bb 100644
--- a/contracts/lendingpool/LendingPool.sol
+++ b/contracts/lendingpool/LendingPool.sol
@@ -482,55 +482,6 @@ contract LendingPool is VersionedInitializable, ILendingPool, LendingPoolStorage
     }
   }
 
-  /**
-   * @dev flashes the underlying collateral on an user to swap for the owed asset and repay
-   * - Both the owner of the position and other liquidators can execute it
-   * - The owner can repay with his collateral at any point, no matter the health factor
-   * - Other liquidators can only use this function below 1 HF. To liquidate 50% of the debt > HF 0.98 or the whole below
-   * @param collateral The address of the collateral asset
-   * @param principal The address of the owed asset
-   * @param user Address of the borrower
-   * @param principalAmount Amount of the debt to repay. type(uint256).max to repay the maximum possible
-   * @param receiver Address of the contract receiving the collateral to swap
-   * @param params Variadic bytes param to pass with extra information to the receiver
-   **/
-  function repayWithCollateral(
-    address collateral,
-    address principal,
-    address user,
-    uint256 principalAmount,
-    address receiver,
-    bytes calldata params
-  ) external override {
-    _whenNotPaused();
-    require(!_flashLiquidationLocked, Errors.REENTRANCY_NOT_ALLOWED);
-    _flashLiquidationLocked = true;
-
-    address collateralManager = _addressesProvider.getLendingPoolCollateralManager();
-
-    //solium-disable-next-line
-    (bool success, bytes memory result) = collateralManager.delegatecall(
-      abi.encodeWithSignature(
-        'repayWithCollateral(address,address,address,uint256,address,bytes)',
-        collateral,
-        principal,
-        user,
-        principalAmount,
-        receiver,
-        params
-      )
-    );
-    require(success, Errors.FAILED_REPAY_WITH_COLLATERAL);
-
-    (uint256 returnCode, string memory returnMessage) = abi.decode(result, (uint256, string));
-
-    if (returnCode != 0) {
-      revert(string(abi.encodePacked(returnMessage)));
-    }
-
-    _flashLiquidationLocked = false;
-  }
-
   struct FlashLoanLocalVars {
     uint256 premium;
     uint256 amountPlusPremium;
@@ -609,44 +560,6 @@ contract LendingPool is VersionedInitializable, ILendingPool, LendingPoolStorage
     }
   }
 
-  /**
-   * @dev Allows an user to release one of his assets deposited in the protocol, even if it is used as collateral, to swap for another.
-   * - It's not possible to release one asset to swap for the same
-   * @param receiverAddress The address of the contract receiving the funds. The receiver should implement the ISwapAdapter interface
-   * @param fromAsset Asset to swap from
-   * @param toAsset Asset to swap to
-   * @param params a bytes array to be sent (if needed) to the receiver contract with extra data
-   **/
-  function swapLiquidity(
-    address receiverAddress,
-    address fromAsset,
-    address toAsset,
-    uint256 amountToSwap,
-    bytes calldata params
-  ) external override {
-    _whenNotPaused();
-    address collateralManager = _addressesProvider.getLendingPoolCollateralManager();
-
-    //solium-disable-next-line
-    (bool success, bytes memory result) = collateralManager.delegatecall(
-      abi.encodeWithSignature(
-        'swapLiquidity(address,address,address,uint256,bytes)',
-        receiverAddress,
-        fromAsset,
-        toAsset,
-        amountToSwap,
-        params
-      )
-    );
-    require(success, Errors.FAILED_COLLATERAL_SWAP);
-
-    (uint256 returnCode, string memory returnMessage) = abi.decode(result, (uint256, string));
-
-    if (returnCode != 0) {
-      revert(string(abi.encodePacked(returnMessage)));
-    }
-  }
-
   /**
    * @dev returns the state and configuration of the reserve
    * @param asset the address of the reserve
diff --git a/contracts/lendingpool/LendingPoolCollateralManager.sol b/contracts/lendingpool/LendingPoolCollateralManager.sol
index 736eadf9..0341748e 100644
--- a/contracts/lendingpool/LendingPoolCollateralManager.sol
+++ b/contracts/lendingpool/LendingPoolCollateralManager.sol
@@ -58,24 +58,6 @@ contract LendingPoolCollateralManager is VersionedInitializable, LendingPoolStor
     bool receiveAToken
   );
 
-  /**
-    @dev emitted when a borrower/liquidator repays with the borrower's collateral
-    @param collateral the address of the collateral being swapped to repay
-    @param principal the address of the reserve of the debt
-    @param user the borrower's address
-    @param liquidator the address of the liquidator, same as the one of the borrower on self-repayment
-    @param principalAmount the amount of the debt finally covered
-    @param swappedCollateralAmount the amount of collateral finally swapped
-  */
-  event RepaidWithCollateral(
-    address indexed collateral,
-    address indexed principal,
-    address indexed user,
-    address liquidator,
-    uint256 principalAmount,
-    uint256 swappedCollateralAmount
-  );
-
   struct LiquidationCallLocalVars {
     uint256 userCollateralBalance;
     uint256 userStableDebt;
@@ -96,16 +78,6 @@ contract LendingPoolCollateralManager is VersionedInitializable, LendingPoolStor
     string errorMsg;
   }
 
-  struct SwapLiquidityLocalVars {
-    uint256 healthFactor;
-    uint256 amountToReceive;
-    uint256 userBalanceBefore;
-    IAToken fromReserveAToken;
-    IAToken toReserveAToken;
-    uint256 errorCode;
-    string errorMsg;
-  }
-
   struct AvailableCollateralToLiquidateLocalVars {
     uint256 userCompoundedBorrowBalance;
     uint256 liquidationBonus;
@@ -189,7 +161,7 @@ contract LendingPoolCollateralManager is VersionedInitializable, LendingPoolStor
     (
       vars.maxCollateralToLiquidate,
       vars.principalAmountNeeded
-    ) = calculateAvailableCollateralToLiquidate(
+    ) = _calculateAvailableCollateralToLiquidate(
       collateralReserve,
       principalReserve,
       collateral,
@@ -295,259 +267,6 @@ contract LendingPoolCollateralManager is VersionedInitializable, LendingPoolStor
     return (uint256(Errors.CollateralManagerErrors.NO_ERROR), Errors.NO_ERRORS);
   }
 
-  /**
-   * @dev flashes the underlying collateral on an user to swap for the owed asset and repay
-   * - Both the owner of the position and other liquidators can execute it.
-   * - The owner can repay with his collateral at any point, no matter the health factor.
-   * - Other liquidators can only use this function below 1 HF. To liquidate 50% of the debt > HF 0.98 or the whole below.
-   * @param collateral The address of the collateral asset.
-   * @param principal The address of the owed asset.
-   * @param user Address of the borrower.
-   * @param principalAmount Amount of the debt to repay.
-   * @param receiver Address of the contract receiving the collateral to swap.
-   * @param params Variadic bytes param to pass with extra information to the receiver
-   **/
-  function repayWithCollateral(
-    address collateral,
-    address principal,
-    address user,
-    uint256 principalAmount,
-    address receiver,
-    bytes calldata params
-  ) external returns (uint256, string memory) {
-    ReserveLogic.ReserveData storage collateralReserve = _reserves[collateral];
-    ReserveLogic.ReserveData storage debtReserve = _reserves[principal];
-    UserConfiguration.Map storage userConfig = _usersConfig[user];
-
-    LiquidationCallLocalVars memory vars;
-
-    (, , , , vars.healthFactor) = GenericLogic.calculateUserAccountData(
-      user,
-      _reserves,
-      _usersConfig[user],
-      _reservesList,
-      _reservesCount,
-      _addressesProvider.getPriceOracle()
-    );
-
-    (vars.userStableDebt, vars.userVariableDebt) = Helpers.getUserCurrentDebt(user, debtReserve);
-
-    (vars.errorCode, vars.errorMsg) = ValidationLogic.validateRepayWithCollateral(
-      collateralReserve,
-      debtReserve,
-      userConfig,
-      user,
-      vars.healthFactor,
-      vars.userStableDebt,
-      vars.userVariableDebt
-    );
-
-    if (Errors.CollateralManagerErrors(vars.errorCode) != Errors.CollateralManagerErrors.NO_ERROR) {
-      return (vars.errorCode, vars.errorMsg);
-    }
-
-    vars.maxPrincipalAmountToLiquidate = vars.userStableDebt.add(vars.userVariableDebt);
-
-    vars.actualAmountToLiquidate = principalAmount > vars.maxPrincipalAmountToLiquidate
-      ? vars.maxPrincipalAmountToLiquidate
-      : principalAmount;
-
-    vars.collateralAtoken = IAToken(collateralReserve.aTokenAddress);
-    vars.userCollateralBalance = vars.collateralAtoken.balanceOf(user);
-
-    (
-      vars.maxCollateralToLiquidate,
-      vars.principalAmountNeeded
-    ) = calculateAvailableCollateralToLiquidate(
-      collateralReserve,
-      debtReserve,
-      collateral,
-      principal,
-      vars.actualAmountToLiquidate,
-      vars.userCollateralBalance
-    );
-
-    //if principalAmountNeeded < vars.ActualAmountToLiquidate, there isn't enough
-    //of collateral to cover the actual amount that is being liquidated, hence we liquidate
-    //a smaller amount
-    if (vars.principalAmountNeeded < vars.actualAmountToLiquidate) {
-      vars.actualAmountToLiquidate = vars.principalAmountNeeded;
-    }
-    //updating collateral reserve indexes
-    collateralReserve.updateState();
-
-    //updating collateral reserve interest rates
-    collateralReserve.updateInterestRates(
-      collateral,
-      address(vars.collateralAtoken),
-      0,
-      vars.maxCollateralToLiquidate
-    );
-
-    vars.collateralAtoken.burn(
-      user,
-      receiver,
-      vars.maxCollateralToLiquidate,
-      collateralReserve.liquidityIndex
-    );
-
-    if (vars.userCollateralBalance == vars.maxCollateralToLiquidate) {
-      _usersConfig[user].setUsingAsCollateral(collateralReserve.id, false);
-    }
-
-    vars.principalAToken = debtReserve.aTokenAddress;
-
-    // Notifies the receiver to proceed, sending as param the underlying already transferred
-    ISwapAdapter(receiver).executeOperation(
-      collateral,
-      principal,
-      vars.maxCollateralToLiquidate,
-      address(this),
-      params
-    );
-
-    //updating debt reserve
-    debtReserve.updateState();
-    debtReserve.updateInterestRates(
-      principal,
-      vars.principalAToken,
-      vars.actualAmountToLiquidate,
-      0
-    );
-    IERC20(principal).safeTransferFrom(
-      receiver,
-      vars.principalAToken,
-      vars.actualAmountToLiquidate
-    );
-
-    if (vars.userVariableDebt >= vars.actualAmountToLiquidate) {
-      IVariableDebtToken(debtReserve.variableDebtTokenAddress).burn(
-        user,
-        vars.actualAmountToLiquidate,
-        debtReserve.variableBorrowIndex
-      );
-    } else {
-      IVariableDebtToken(debtReserve.variableDebtTokenAddress).burn(
-        user,
-        vars.userVariableDebt,
-        debtReserve.variableBorrowIndex
-      );
-      IStableDebtToken(debtReserve.stableDebtTokenAddress).burn(
-        user,
-        vars.actualAmountToLiquidate.sub(vars.userVariableDebt)
-      );
-    }
-
-    emit RepaidWithCollateral(
-      collateral,
-      principal,
-      user,
-      msg.sender,
-      vars.actualAmountToLiquidate,
-      vars.maxCollateralToLiquidate
-    );
-
-    return (uint256(Errors.CollateralManagerErrors.NO_ERROR), Errors.NO_ERRORS);
-  }
-
-  /**
-   * @dev Allows an user to release one of his assets deposited in the protocol, even if it is used as collateral, to swap for another.
-   * - It's not possible to release one asset to swap for the same
-   * @param receiverAddress The address of the contract receiving the funds. The receiver should implement the ISwapAdapter interface
-   * @param fromAsset Asset to swap from
-   * @param toAsset Asset to swap to
-   * @param params a bytes array to be sent (if needed) to the receiver contract with extra data
-   **/
-  function swapLiquidity(
-    address receiverAddress,
-    address fromAsset,
-    address toAsset,
-    uint256 amountToSwap,
-    bytes calldata params
-  ) external returns (uint256, string memory) {
-    ReserveLogic.ReserveData storage fromReserve = _reserves[fromAsset];
-    ReserveLogic.ReserveData storage toReserve = _reserves[toAsset];
-
-    SwapLiquidityLocalVars memory vars;
-
-    (vars.errorCode, vars.errorMsg) = ValidationLogic.validateSwapLiquidity(
-      fromReserve,
-      toReserve,
-      fromAsset,
-      toAsset
-    );
-
-    if (Errors.CollateralManagerErrors(vars.errorCode) != Errors.CollateralManagerErrors.NO_ERROR) {
-      return (vars.errorCode, vars.errorMsg);
-    }
-
-    vars.fromReserveAToken = IAToken(fromReserve.aTokenAddress);
-    vars.toReserveAToken = IAToken(toReserve.aTokenAddress);
-
-    fromReserve.updateState();
-    toReserve.updateState();
-
-    if (vars.fromReserveAToken.balanceOf(msg.sender) == amountToSwap) {
-      _usersConfig[msg.sender].setUsingAsCollateral(fromReserve.id, false);
-    }
-
-    fromReserve.updateInterestRates(fromAsset, address(vars.fromReserveAToken), 0, amountToSwap);
-
-    vars.fromReserveAToken.burn(
-      msg.sender,
-      receiverAddress,
-      amountToSwap,
-      fromReserve.liquidityIndex
-    );
-    // Notifies the receiver to proceed, sending as param the underlying already transferred
-    ISwapAdapter(receiverAddress).executeOperation(
-      fromAsset,
-      toAsset,
-      amountToSwap,
-      address(this),
-      params
-    );
-
-    vars.amountToReceive = IERC20(toAsset).balanceOf(receiverAddress);
-    if (vars.amountToReceive != 0) {
-      IERC20(toAsset).safeTransferFrom(
-        receiverAddress,
-        address(vars.toReserveAToken),
-        vars.amountToReceive
-      );
-
-      if (vars.toReserveAToken.balanceOf(msg.sender) == 0) {
-        _usersConfig[msg.sender].setUsingAsCollateral(toReserve.id, true);
-      }
-
-      vars.toReserveAToken.mint(msg.sender, vars.amountToReceive, toReserve.liquidityIndex);
-      toReserve.updateInterestRates(
-        toAsset,
-        address(vars.toReserveAToken),
-        vars.amountToReceive,
-        0
-      );
-    }
-
-    (, , , , vars.healthFactor) = GenericLogic.calculateUserAccountData(
-      msg.sender,
-      _reserves,
-      _usersConfig[msg.sender],
-      _reservesList,
-      _reservesCount,
-      _addressesProvider.getPriceOracle()
-    );
-
-    if (vars.healthFactor < GenericLogic.HEALTH_FACTOR_LIQUIDATION_THRESHOLD) {
-      return (
-        uint256(Errors.CollateralManagerErrors.HEALTH_FACTOR_LOWER_THAN_LIQUIDATION_THRESHOLD),
-        Errors.HEALTH_FACTOR_LOWER_THAN_LIQUIDATION_THRESHOLD
-      );
-    }
-
-    return (uint256(Errors.CollateralManagerErrors.NO_ERROR), Errors.NO_ERRORS);
-  }
-
   /**
    * @dev calculates how much of a specific collateral can be liquidated, given
    * a certain amount of principal currency. This function needs to be called after
@@ -559,7 +278,7 @@ contract LendingPoolCollateralManager is VersionedInitializable, LendingPoolStor
    * @return collateralAmount the maximum amount that is possible to liquidated given all the liquidation constraints (user balance, close factor)
    * @return principalAmountNeeded the purchase amount
    **/
-  function calculateAvailableCollateralToLiquidate(
+  function _calculateAvailableCollateralToLiquidate(
     ReserveLogic.ReserveData storage collateralReserve,
     ReserveLogic.ReserveData storage principalReserve,
     address collateralAddress,
diff --git a/contracts/libraries/logic/ValidationLogic.sol b/contracts/libraries/logic/ValidationLogic.sol
index e5691fda..93219ce8 100644
--- a/contracts/libraries/logic/ValidationLogic.sol
+++ b/contracts/libraries/logic/ValidationLogic.sol
@@ -384,95 +384,4 @@ library ValidationLogic {
 
     return (uint256(Errors.CollateralManagerErrors.NO_ERROR), Errors.NO_ERRORS);
   }
-
-  /**
-   * @dev Validates the repayWithCollateral() action
-   * @param collateralReserve The reserve data of the collateral
-   * @param principalReserve The reserve data of the principal
-   * @param userConfig The user configuration
-   * @param user The address of the user
-   * @param userHealthFactor The user's health factor
-   * @param userStableDebt Total stable debt balance of the user
-   * @param userVariableDebt Total variable debt balance of the user
-   **/
-  function validateRepayWithCollateral(
-    ReserveLogic.ReserveData storage collateralReserve,
-    ReserveLogic.ReserveData storage principalReserve,
-    UserConfiguration.Map storage userConfig,
-    address user,
-    uint256 userHealthFactor,
-    uint256 userStableDebt,
-    uint256 userVariableDebt
-  ) internal view returns (uint256, string memory) {
-    if (
-      !collateralReserve.configuration.getActive() || !principalReserve.configuration.getActive()
-    ) {
-      return (uint256(Errors.CollateralManagerErrors.NO_ACTIVE_RESERVE), Errors.NO_ACTIVE_RESERVE);
-    }
-
-    if (
-      msg.sender != user && userHealthFactor >= GenericLogic.HEALTH_FACTOR_LIQUIDATION_THRESHOLD
-    ) {
-      return (
-        uint256(Errors.CollateralManagerErrors.HEALTH_FACTOR_ABOVE_THRESHOLD),
-        Errors.HEALTH_FACTOR_NOT_BELOW_THRESHOLD
-      );
-    }
-
-    if (msg.sender != user) {
-      bool isCollateralEnabled = collateralReserve.configuration.getLiquidationThreshold() > 0 &&
-        userConfig.isUsingAsCollateral(collateralReserve.id);
-
-      //if collateral isn't enabled as collateral by user, it cannot be liquidated
-      if (!isCollateralEnabled) {
-        return (
-          uint256(Errors.CollateralManagerErrors.COLLATERAL_CANNOT_BE_LIQUIDATED),
-          Errors.COLLATERAL_CANNOT_BE_LIQUIDATED
-        );
-      }
-    }
-
-    if (userStableDebt == 0 && userVariableDebt == 0) {
-      return (
-        uint256(Errors.CollateralManagerErrors.CURRRENCY_NOT_BORROWED),
-        Errors.SPECIFIED_CURRENCY_NOT_BORROWED_BY_USER
-      );
-    }
-
-    return (uint256(Errors.CollateralManagerErrors.NO_ERROR), Errors.NO_ERRORS);
-  }
-
-  /**
-   * @dev Validates the swapLiquidity() action
-   * @param fromReserve The reserve data of the asset to swap from
-   * @param toReserve The reserve data of the asset to swap to
-   * @param fromAsset Address of the asset to swap from
-   * @param toAsset Address of the asset to swap to
-   **/
-  function validateSwapLiquidity(
-    ReserveLogic.ReserveData storage fromReserve,
-    ReserveLogic.ReserveData storage toReserve,
-    address fromAsset,
-    address toAsset
-  ) internal view returns (uint256, string memory) {
-    if (fromAsset == toAsset) {
-      return (
-        uint256(Errors.CollateralManagerErrors.INVALID_EQUAL_ASSETS_TO_SWAP),
-        Errors.INVALID_EQUAL_ASSETS_TO_SWAP
-      );
-    }
-
-    (bool isToActive, bool isToFreezed, , ) = toReserve.configuration.getFlags();
-    if (!fromReserve.configuration.getActive() || !isToActive) {
-      return (uint256(Errors.CollateralManagerErrors.NO_ACTIVE_RESERVE), Errors.NO_ACTIVE_RESERVE);
-    }
-    if (isToFreezed) {
-      return (
-        uint256(Errors.CollateralManagerErrors.NO_UNFREEZED_RESERVE),
-        Errors.NO_UNFREEZED_RESERVE
-      );
-    }
-
-    return (uint256(Errors.CollateralManagerErrors.NO_ERROR), Errors.NO_ERRORS);
-  }
 }
diff --git a/contracts/mocks/flashloan/MockSwapAdapter.sol b/contracts/mocks/flashloan/MockSwapAdapter.sol
deleted file mode 100644
index 1e8bca38..00000000
--- a/contracts/mocks/flashloan/MockSwapAdapter.sol
+++ /dev/null
@@ -1,59 +0,0 @@
-// SPDX-License-Identifier: agpl-3.0
-pragma solidity ^0.6.8;
-
-import {MintableERC20} from '../tokens/MintableERC20.sol';
-import {ILendingPoolAddressesProvider} from '../../interfaces/ILendingPoolAddressesProvider.sol';
-import {ISwapAdapter} from '../../interfaces/ISwapAdapter.sol';
-import {ILendingPool} from '../../interfaces/ILendingPool.sol';
-import {IERC20} from '../../dependencies/openzeppelin/contracts/IERC20.sol';
-
-contract MockSwapAdapter is ISwapAdapter {
-  uint256 internal _amountToReturn;
-  bool internal _tryReentrancy;
-  ILendingPoolAddressesProvider public addressesProvider;
-
-  event Swapped(address fromAsset, address toAsset, uint256 fromAmount, uint256 receivedAmount);
-
-  constructor(ILendingPoolAddressesProvider provider) public {
-    addressesProvider = provider;
-  }
-
-  function setAmountToReturn(uint256 amount) public {
-    _amountToReturn = amount;
-  }
-
-  function setTryReentrancy(bool tryReentrancy) public {
-    _tryReentrancy = tryReentrancy;
-  }
-
-  function executeOperation(
-    address assetToSwapFrom,
-    address assetToSwapTo,
-    uint256 amountToSwap,
-    address fundsDestination,
-    bytes calldata params
-  ) external override {
-    params;
-    IERC20(assetToSwapFrom).transfer(address(1), amountToSwap); // We don't want to keep funds here
-    MintableERC20(assetToSwapTo).mint(_amountToReturn);
-    IERC20(assetToSwapTo).approve(fundsDestination, _amountToReturn);
-
-    if (_tryReentrancy) {
-      ILendingPool(fundsDestination).repayWithCollateral(
-        assetToSwapFrom,
-        assetToSwapTo,
-        address(1), // Doesn't matter, we just want to test the reentrancy
-        1 ether, // Same
-        address(1), // Same
-        '0x'
-      );
-    }
-
-    emit Swapped(assetToSwapFrom, assetToSwapTo, amountToSwap, _amountToReturn);
-  }
-
-  function burnAsset(IERC20 asset, uint256 amount) public {
-    uint256 amountToBurn = (amount == type(uint256).max) ? asset.balanceOf(address(this)) : amount;
-    asset.transfer(address(0), amountToBurn);
-  }
-}
diff --git a/deployed-contracts.json b/deployed-contracts.json
index 033a9c6c..04e8014b 100644
--- a/deployed-contracts.json
+++ b/deployed-contracts.json
@@ -5,7 +5,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x58F132FBB86E21545A4Bace3C19f1C05d86d7A22",
+      "address": "0xDFbeeed692AA81E7f86E72F7ACbEA2A1C4d63544",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -19,7 +19,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0xa4bcDF64Cdd5451b6ac3743B414124A6299B65FF",
+      "address": "0x5191aA68c7dB195181Dd2441dBE23A48EA24b040",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -37,7 +37,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x5A0773Ff307Bf7C71a832dBB5312237fD3437f9F",
+      "address": "0xa89E20284Bd638F31b0011D0fC754Fc9d2fa73e3",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -73,7 +73,7 @@
       "address": "0x6642B57e4265BAD868C17Fc1d1F4F88DBBA04Aa8"
     },
     "localhost": {
-      "address": "0x65e0Cd5B8904A02f2e00BC6f58bf881998D54BDe"
+      "address": "0x9Ec55627757348b322c8dD0865D704649bFa0c7b"
     },
     "kovan": {
       "address": "0x1339f3c1FfF00D0FD8946187fdC61F0ef0fFe786"
@@ -89,7 +89,7 @@
       "address": "0xD9273d497eDBC967F39d419461CfcF382a0A822e"
     },
     "localhost": {
-      "address": "0x5d12dDe3286D94E0d85F9D3B01B7099cfA0aBCf1"
+      "address": "0x3EE716e38f21e5FC16BFDB773db24D63C637A5d8"
     },
     "kovan": {
       "address": "0xB43CCfF1148bb5ab2104E2ee68A7c30cDEBb9A9C"
@@ -101,7 +101,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x1750499D05Ed1674d822430FB960d5F6731fDf64",
+      "address": "0x5889354f21A1C8D8D2f82669d778f6Dab778B519",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -115,7 +115,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0xEC1C93A9f6a9e18E97784c76aC52053587FcDB89",
+      "address": "0xC452C5244F701108B4e8E8BCe693160046b30332",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -129,7 +129,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x7B6C3e5486D9e6959441ab554A889099eed76290",
+      "address": "0x0B63c002cb44B2e5e580C3B3560a27F4101D95c0",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -147,7 +147,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0xD83D2773a7873ae2b5f8Fb92097e20a8C64F691E",
+      "address": "0xCeB290A2C6614BF23B2faa0f0B8067F29C48DB0F",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -165,7 +165,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x626FdE749F9d499d3777320CAf29484B624ab84a",
+      "address": "0x7C95b1ad025F0C9aB14192f87bF2aD53889bE4F7",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -227,7 +227,7 @@
       "address": "0xBEF0d4b9c089a5883741fC14cbA352055f35DDA2"
     },
     "localhost": {
-      "address": "0x2B681757d757fbB80cc51c6094cEF5eE75bF55aA"
+      "address": "0x9c91aEaD98b1354C7B0EAfb8ff539d0796c79894"
     },
     "coverage": {
       "address": "0x2B681757d757fbB80cc51c6094cEF5eE75bF55aA"
@@ -235,11 +235,11 @@
   },
   "WalletBalanceProvider": {
     "buidlerevm": {
-      "address": "0xC6bA6049F86d528698B5924B8fC2FE7289D38578",
+      "address": "0x2cfcA5785261fbC88EFFDd46fCFc04c22525F9e4",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0xDf73fC454FA018051D4a1509e63D11530A59DE10",
+      "address": "0x145b7B6368Df63e7F3497b0A948B30fC1A4d5E55",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -253,7 +253,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x7c2C195CD6D34B8F845992d380aADB2730bB9C6F",
+      "address": "0x010e948B9B7D30771E23346C0B17a4D5Ff04e300",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -267,7 +267,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x8858eeB3DfffA017D4BCE9801D340D36Cf895CCf",
+      "address": "0x79094eDB848047e87a4B8a64ab5Ee2f527791bC0",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -281,7 +281,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x0078371BDeDE8aAc7DeBfFf451B74c5EDB385Af7",
+      "address": "0xEE0A69d0Bb1312685870Dd7E20AcAD66b6f6264F",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -295,7 +295,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0xf4e77E5Da47AC3125140c470c71cBca77B5c638c",
+      "address": "0x631B367fBE1dbB934bC039aAA0C9eC2EE5943fd5",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -309,7 +309,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x3619DbE27d7c1e7E91aA738697Ae7Bc5FC3eACA5",
+      "address": "0xf55Af78B3f3059fACF166Aa338FFe059A14e75F6",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -323,7 +323,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x038B86d9d8FAFdd0a02ebd1A476432877b0107C8",
+      "address": "0xD5A0587aAEB195028909E98930B391dFB3f9F589",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -337,7 +337,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x1A1FEe7EeD918BD762173e4dc5EfDB8a78C924A8",
+      "address": "0xaD3AdbC18E4AD090034A6C74Eda61f4310dce313",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -351,7 +351,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x500D1d6A4c7D8Ae28240b47c8FCde034D827fD5e",
+      "address": "0x25a88BbA9c8D2a46e3Ff4bFe98712DF7A1044fB6",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -365,7 +365,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0xc4905364b78a742ccce7B890A89514061E47068D",
+      "address": "0x16d1802cd7cfcb67955BBBa26bAae1cE559B5F5B",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -379,7 +379,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0xD6C850aeBFDC46D7F4c207e445cC0d6B0919BDBe",
+      "address": "0xE58d8c88f5A670f16BE8F7864707170F43e943A6",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -393,7 +393,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x8B5B7a6055E54a36fF574bbE40cf2eA68d5554b3",
+      "address": "0xfdAF4f6e47e854c05bE158993d32872e784F0502",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -407,7 +407,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0xEcc0a6dbC0bb4D51E4F84A315a9e5B0438cAD4f0",
+      "address": "0x92edC13A10036A3C50396f2B63148a3e9a8D589e",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -421,7 +421,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x20Ce94F404343aD2752A2D01b43fa407db9E0D00",
+      "address": "0xE5C277cDb7E10372918Ac54Ce54022910A24FE88",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -435,7 +435,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x1d80315fac6aBd3EfeEbE97dEc44461ba7556160",
+      "address": "0xF5742a599a0F4520089cbf2EBBa66Bb4F471B85F",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -449,7 +449,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x2D8553F9ddA85A9B3259F6Bf26911364B85556F5",
+      "address": "0x380EF388e13D8cAdeACef6eF682C7B7D85865076",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -463,7 +463,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x52d3b94181f8654db2530b0fEe1B19173f519C52",
+      "address": "0xC89577DED8441e52C17C13D527b85b225C5c8311",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -477,7 +477,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0xd15468525c35BDBC1eD8F2e09A00F8a173437f2f",
+      "address": "0xD4b06774A717Ff5A7c20c8712e31c6BbfFcb1F01",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -491,7 +491,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x7e35Eaf7e8FBd7887ad538D4A38Df5BbD073814a",
+      "address": "0xbe66dC9DFEe580ED968403e35dF7b5159f873df8",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -505,7 +505,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x5bcb88A0d20426e451332eE6C4324b0e663c50E0",
+      "address": "0x93AfC6Df4bB8F62F2493B19e577f8382c0BA9EBC",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -519,7 +519,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x3521eF8AaB0323004A6dD8b03CE890F4Ea3A13f5",
+      "address": "0x75Ded61646B5945BdDd0CD9a9Db7c8288DA6F810",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -533,7 +533,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x53369fd4680FfE3DfF39Fc6DDa9CfbfD43daeA2E",
+      "address": "0xdE7c40e675bF1aA45c18cCbaEb9662B16b0Ddf7E",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -547,7 +547,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0xB00cC45B4a7d3e1FEE684cFc4417998A1c183e6d",
+      "address": "0xEcb928A3c079a1696Aa5244779eEc3dE1717fACd",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -561,7 +561,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x58F132FBB86E21545A4Bace3C19f1C05d86d7A22",
+      "address": "0xDFbeeed692AA81E7f86E72F7ACbEA2A1C4d63544",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -574,7 +574,7 @@
       "address": "0xe7536f450378748E1BD4645D3c77ec38e0F3ba28"
     },
     "localhost": {
-      "address": "0x2cfcA5785261fbC88EFFDd46fCFc04c22525F9e4"
+      "address": "0x987223924D2DD6c6efB601756850f3886ECbceF6"
     },
     "coverage": {
       "address": "0x2cfcA5785261fbC88EFFDd46fCFc04c22525F9e4"
@@ -590,7 +590,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0xB660Fdd109a95718cB9d20E3A89EE6cE342aDcB6",
+      "address": "0xaca5aCeB6f44845d07Fd339a51F0bd52Bb3D8D1A",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -608,7 +608,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x830bceA96E56DBC1F8578f75fBaC0AF16B32A07d",
+      "address": "0x9bD0Bec44106D8Ea8fFb6296d7A84742a290E064",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -622,7 +622,7 @@
   },
   "AToken": {
     "localhost": {
-      "address": "0xA0AB1cB92A4AF81f84dCd258155B5c25D247b54E",
+      "address": "0x00f126cCA2266bFb634Ed6DB17c4C74fb8cA5177",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "buidlerevm": {
@@ -640,11 +640,11 @@
   },
   "MockAToken": {
     "buidlerevm": {
-      "address": "0x3b050AFb4ac4ACE646b31fF3639C1CD43aC31460",
+      "address": "0x392E5355a0e88Bd394F717227c752670fb3a8020",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0xa89E20284Bd638F31b0011D0fC754Fc9d2fa73e3",
+      "address": "0xbF538F34cb100bAeEE55aa1F036D33F03b03d900",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -658,7 +658,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0xf784709d2317D872237C4bC22f867d1BAe2913AB",
+      "address": "0xff1B1B810F5DCe853a9b1819DE220D532D1CFeF2",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -668,11 +668,11 @@
   },
   "MockStableDebtToken": {
     "buidlerevm": {
-      "address": "0xEBAB67ee3ef604D5c250A53b4b8fcbBC6ec3007C",
+      "address": "0x3b050AFb4ac4ACE646b31fF3639C1CD43aC31460",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0xaA935993065F2dDB1d13623B1941C7AEE3A60F23",
+      "address": "0x7436d6adaA697413F00cb63E1A2A854bF2Aec5A1",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -682,11 +682,11 @@
   },
   "MockVariableDebtToken": {
     "buidlerevm": {
-      "address": "0xBE36BE5680244Ae1A6F983E4A6f6E1c142cdAbe3",
+      "address": "0xEBAB67ee3ef604D5c250A53b4b8fcbBC6ec3007C",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x35A2624888e207e4B3434E9a9E250bF6Ee68FeA3",
+      "address": "0x2A7BE996B8801ED21f2f45148791D402811A2106",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -702,7 +702,7 @@
       "address": "0xBEF0d4b9c089a5883741fC14cbA352055f35DDA2"
     },
     "localhost": {
-      "address": "0xBEF0d4b9c089a5883741fC14cbA352055f35DDA2"
+      "address": "0x48FAde2E719B770E1783d03466dAEe98b5183538"
     }
   },
   "MockFlashRepayAdapter": {
diff --git a/test/collateral-swap.spec.ts b/test/collateral-swap.spec.ts
deleted file mode 100644
index b85e1dd3..00000000
--- a/test/collateral-swap.spec.ts
+++ /dev/null
@@ -1,258 +0,0 @@
-import {makeSuite, TestEnv} from './helpers/make-suite';
-import {MockSwapAdapter} from '../types/MockSwapAdapter';
-import {getMockSwapAdapter} from '../helpers/contracts-helpers';
-import {ProtocolErrors} from '../helpers/types';
-import {ethers} from 'ethers';
-import {APPROVAL_AMOUNT_LENDING_POOL} from '../helpers/constants';
-import {getContractsData, getTxCostAndTimestamp} from './helpers/actions';
-import {calcExpectedATokenBalance} from './helpers/utils/calculations';
-import {waitForTx} from '../helpers/misc-utils';
-import {advanceBlock, timeLatest} from '../helpers/misc-utils';
-
-const {expect} = require('chai');
-
-makeSuite('LendingPool SwapDeposit function', (testEnv: TestEnv) => {
-  let _mockSwapAdapter = {} as MockSwapAdapter;
-  const {
-    HEALTH_FACTOR_LOWER_THAN_LIQUIDATION_THRESHOLD,
-    NO_UNFREEZED_RESERVE,
-    NO_ACTIVE_RESERVE,
-    INVALID_EQUAL_ASSETS_TO_SWAP,
-  } = ProtocolErrors;
-
-  before(async () => {
-    _mockSwapAdapter = await getMockSwapAdapter();
-  });
-
-  it('Should not allow to swap if from equal to', async () => {
-    const {pool, weth} = testEnv;
-
-    await expect(
-      pool.swapLiquidity(
-        _mockSwapAdapter.address,
-        weth.address,
-        weth.address,
-        '1'.toString(),
-        '0x10'
-      )
-    ).to.be.revertedWith(INVALID_EQUAL_ASSETS_TO_SWAP);
-  });
-
-  it('Should not allow to swap if from or to reserves are not active', async () => {
-    const {pool, weth, dai, configurator} = testEnv;
-
-    await configurator.deactivateReserve(weth.address);
-
-    await expect(
-      pool.swapLiquidity(
-        _mockSwapAdapter.address,
-        weth.address,
-        dai.address,
-        '1'.toString(),
-        '0x10'
-      )
-    ).to.be.revertedWith(NO_ACTIVE_RESERVE);
-    await configurator.activateReserve(weth.address);
-
-    await configurator.deactivateReserve(dai.address);
-
-    await expect(
-      pool.swapLiquidity(
-        _mockSwapAdapter.address,
-        weth.address,
-        dai.address,
-        '1'.toString(),
-        '0x10'
-      )
-    ).to.be.revertedWith(NO_ACTIVE_RESERVE);
-
-    //cleanup state
-    await configurator.activateReserve(dai.address);
-  });
-
-  it('Deposits WETH into the reserve', async () => {
-    const {pool, weth, users} = testEnv;
-    const amountToDeposit = ethers.utils.parseEther('1');
-
-    for (const signer of [weth.signer, users[2].signer]) {
-      const connectedWETH = weth.connect(signer);
-      await connectedWETH.mint(amountToDeposit);
-      await connectedWETH.approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL);
-      await pool
-        .connect(signer)
-        .deposit(weth.address, amountToDeposit, await signer.getAddress(), '0');
-    }
-  });
-
-  it('User tries to swap more then he can, revert expected', async () => {
-    const {pool, weth, dai} = testEnv;
-    await expect(
-      pool.swapLiquidity(
-        _mockSwapAdapter.address,
-        weth.address,
-        dai.address,
-        ethers.utils.parseEther('1.1'),
-        '0x10'
-      )
-    ).to.be.revertedWith('55');
-  });
-
-  it('User tries to swap more then available on the reserve', async () => {
-    const {pool, weth, dai, users, aEth, deployer} = testEnv;
-
-    await pool.borrow(weth.address, ethers.utils.parseEther('0.1'), 1, 0, deployer.address);
-    await pool.connect(users[2].signer).withdraw(weth.address, ethers.utils.parseEther('1'));
-
-    await expect(
-      pool.swapLiquidity(
-        _mockSwapAdapter.address,
-        weth.address,
-        dai.address,
-        ethers.utils.parseEther('1'),
-        '0x10'
-      )
-    ).to.be.revertedWith('55');
-  });
-
-  it('User tries to swap correct amount', async () => {
-    const {pool, weth, dai, aEth, aDai, helpersContract} = testEnv;
-    const userAddress = await pool.signer.getAddress();
-    const amountToSwap = ethers.utils.parseEther('0.25');
-
-    const amountToReturn = ethers.utils.parseEther('0.5');
-    await _mockSwapAdapter.setAmountToReturn(amountToReturn);
-
-    const {
-      reserveData: wethReserveDataBefore,
-      userData: wethUserDataBefore,
-    } = await getContractsData(weth.address, userAddress, testEnv);
-
-    const {reserveData: daiReserveDataBefore, userData: daiUserDataBefore} = await getContractsData(
-      dai.address,
-      userAddress,
-      testEnv
-    );
-
-    const reserveBalanceWETHBefore = await weth.balanceOf(aEth.address);
-    const reserveBalanceDAIBefore = await dai.balanceOf(aDai.address);
-
-    const txReceipt = await waitForTx(
-      await pool.swapLiquidity(
-        _mockSwapAdapter.address,
-        weth.address,
-        dai.address,
-        amountToSwap,
-        '0x10'
-      )
-    );
-    const {txTimestamp} = await getTxCostAndTimestamp(txReceipt);
-    const userATokenBalanceWETHAfter = await aEth.balanceOf(userAddress);
-    const userATokenBalanceDAIAfter = await aDai.balanceOf(userAddress);
-
-    const reserveBalanceWETHAfter = await weth.balanceOf(aEth.address);
-    const reserveBalanceDAIAfter = await dai.balanceOf(aDai.address);
-
-    expect(userATokenBalanceWETHAfter.toString()).to.be.equal(
-      calcExpectedATokenBalance(wethReserveDataBefore, wethUserDataBefore, txTimestamp)
-        .minus(amountToSwap.toString())
-        .toString(),
-      'was burned incorrect amount of user funds'
-    );
-    expect(userATokenBalanceDAIAfter.toString()).to.be.equal(
-      calcExpectedATokenBalance(daiReserveDataBefore, daiUserDataBefore, txTimestamp)
-        .plus(amountToReturn.toString())
-        .toString(),
-      'was minted incorrect amount of user funds'
-    );
-
-    expect(reserveBalanceWETHAfter.toString()).to.be.equal(
-      reserveBalanceWETHBefore.sub(amountToSwap).toString(),
-      'was sent incorrect amount if reserve funds'
-    );
-    expect(reserveBalanceDAIAfter.toString()).to.be.equal(
-      reserveBalanceDAIBefore.add(amountToReturn).toString(),
-      'was received incorrect amount if reserve funds'
-    );
-    expect(
-      (await helpersContract.getUserReserveData(dai.address, userAddress)).usageAsCollateralEnabled
-    ).to.be.equal(true, 'usage as collateral was not enabled on destination reserve for the user');
-  });
-
-  it('User tries to drop HF below one', async () => {
-    const {pool, weth, dai, deployer} = testEnv;
-    const amountToSwap = ethers.utils.parseEther('0.3');
-
-    const amountToReturn = ethers.utils.parseEther('0.5');
-    await _mockSwapAdapter.setAmountToReturn(amountToReturn);
-
-    await pool.borrow(weth.address, ethers.utils.parseEther('0.3'), 1, 0, deployer.address);
-
-    await expect(
-      pool.swapLiquidity(_mockSwapAdapter.address, weth.address, dai.address, amountToSwap, '0x10')
-    ).to.be.revertedWith(HEALTH_FACTOR_LOWER_THAN_LIQUIDATION_THRESHOLD);
-  });
-
-  it('Should set usage as collateral to false if no leftovers after swap', async () => {
-    const {pool, weth, dai, users} = testEnv;
-    const userAddress = await pool.signer.getAddress();
-
-    // add more liquidity to allow user 0 to swap everything he has
-    await weth.connect(users[2].signer).mint(ethers.utils.parseEther('1'));
-    await pool
-      .connect(users[2].signer)
-      .deposit(weth.address, ethers.utils.parseEther('1'), users[2].address, '0');
-
-    // cleanup borrowings, to be abe to swap whole weth
-    const amountToRepay = ethers.utils.parseEther('0.5');
-    await weth.mint(amountToRepay);
-    await pool.repay(weth.address, amountToRepay, '1', userAddress);
-    const txTimestamp = (await timeLatest()).plus(100);
-
-    const {
-      reserveData: wethReserveDataBefore,
-      userData: wethUserDataBefore,
-    } = await getContractsData(weth.address, userAddress, testEnv);
-    const amountToSwap = calcExpectedATokenBalance(
-      wethReserveDataBefore,
-      wethUserDataBefore,
-      txTimestamp.plus('1')
-    );
-
-    await advanceBlock(txTimestamp.toNumber());
-
-    await pool.swapLiquidity(
-      _mockSwapAdapter.address,
-      weth.address,
-      dai.address,
-      amountToSwap.toString(),
-      '0x10'
-    );
-    const {userData: wethUserDataAfter} = await getContractsData(
-      weth.address,
-      userAddress,
-      testEnv
-    );
-    expect(wethUserDataAfter.usageAsCollateralEnabled).to.be.equal(
-      false,
-      'usageAsCollateralEnabled are not set to false'
-    );
-  });
-  it('Should not allow to swap if to reserve are freezed', async () => {
-    const {pool, weth, dai, configurator} = testEnv;
-
-    await configurator.freezeReserve(dai.address);
-
-    await expect(
-      pool.swapLiquidity(
-        _mockSwapAdapter.address,
-        weth.address,
-        dai.address,
-        '1'.toString(),
-        '0x10'
-      )
-    ).to.be.revertedWith(NO_UNFREEZED_RESERVE);
-
-    //cleanup state
-    await configurator.unfreezeReserve(dai.address);
-  });
-});
diff --git a/test/flash-liquidation-with-collateral.spec.ts b/test/flash-liquidation-with-collateral.spec.ts
deleted file mode 100644
index 91bfe38f..00000000
--- a/test/flash-liquidation-with-collateral.spec.ts
+++ /dev/null
@@ -1,932 +0,0 @@
-import {TestEnv, makeSuite} from './helpers/make-suite';
-import {APPROVAL_AMOUNT_LENDING_POOL, oneEther} from '../helpers/constants';
-import {ethers} from 'ethers';
-import BigNumber from 'bignumber.js';
-import {
-  calcExpectedVariableDebtTokenBalance,
-  calcExpectedStableDebtTokenBalance,
-} from './helpers/utils/calculations';
-import {getContractsData} from './helpers/actions';
-import {timeLatest, BRE, increaseTime, waitForTx} from '../helpers/misc-utils';
-import {ProtocolErrors} from '../helpers/types';
-import {convertToCurrencyDecimals} from '../helpers/contracts-helpers';
-import {expectRepayWithCollateralEvent} from './repay-with-collateral.spec';
-
-const {expect} = require('chai');
-const {parseUnits, parseEther} = ethers.utils;
-
-makeSuite('LendingPool. repayWithCollateral() with liquidator', (testEnv: TestEnv) => {
-  const {INVALID_HF, COLLATERAL_CANNOT_BE_LIQUIDATED, IS_PAUSED} = ProtocolErrors;
-
-  it('User 1 provides some liquidity for others to borrow', async () => {
-    const {pool, weth, dai, usdc, deployer} = testEnv;
-
-    await weth.mint(parseEther('200'));
-    await weth.approve(pool.address, parseEther('200'));
-    await pool.deposit(weth.address, parseEther('200'), deployer.address, 0);
-    await dai.mint(parseEther('20000'));
-    await dai.approve(pool.address, parseEther('20000'));
-    await pool.deposit(dai.address, parseEther('20000'), deployer.address, 0);
-    await usdc.mint(parseEther('20000'));
-    await usdc.approve(pool.address, parseEther('20000'));
-    await pool.deposit(usdc.address, parseEther('20000'), deployer.address, 0);
-  });
-
-  it('User 5 liquidate User 3 collateral, all his variable debt and part of the stable', async () => {
-    const {pool, weth, usdc, users, mockSwapAdapter, oracle, helpersContract} = testEnv;
-    const user = users[2];
-    const liquidator = users[4];
-    const amountToDeposit = parseEther('20');
-    const amountToBorrow = parseUnits('40', 6);
-
-    await weth.connect(user.signer).mint(amountToDeposit);
-
-    await weth.connect(user.signer).approve(pool.address, amountToDeposit);
-    await pool.connect(user.signer).deposit(weth.address, amountToDeposit, user.address, '0');
-
-    const usdcPrice = await oracle.getAssetPrice(usdc.address);
-
-    await pool.connect(user.signer).borrow(usdc.address, amountToBorrow, 2, 0, user.address);
-
-    await pool.connect(user.signer).borrow(usdc.address, amountToBorrow, 1, 0, user.address);
-
-    const {userData: wethUserDataBefore} = await getContractsData(
-      weth.address,
-      user.address,
-      testEnv
-    );
-
-    const {
-      reserveData: usdcReserveDataBefore,
-      userData: usdcUserDataBefore,
-    } = await getContractsData(usdc.address, user.address, testEnv);
-
-    // Set HF below 1
-    await oracle.setAssetPrice(
-      usdc.address,
-      new BigNumber(usdcPrice.toString()).multipliedBy(60).toFixed(0)
-    );
-    const userGlobalDataPrior = await pool.getUserAccountData(user.address);
-    expect(userGlobalDataPrior.healthFactor.toString()).to.be.bignumber.lt(oneEther, INVALID_HF);
-
-    const amountToRepay = parseUnits('80', 6);
-
-    await mockSwapAdapter.setAmountToReturn(amountToRepay);
-    const txReceipt = await waitForTx(
-      await pool
-        .connect(liquidator.signer)
-        .repayWithCollateral(
-          weth.address,
-          usdc.address,
-          user.address,
-          amountToRepay,
-          mockSwapAdapter.address,
-          '0x'
-        )
-    );
-    const repayWithCollateralTimestamp = await timeLatest();
-
-    const {userData: wethUserDataAfter} = await getContractsData(
-      weth.address,
-      user.address,
-      testEnv
-    );
-
-    const {userData: usdcUserDataAfter} = await getContractsData(
-      usdc.address,
-      user.address,
-      testEnv
-    );
-
-    const collateralPrice = await oracle.getAssetPrice(weth.address);
-    const principalPrice = await oracle.getAssetPrice(usdc.address);
-
-    const collateralDecimals = (
-      await helpersContract.getReserveConfigurationData(weth.address)
-    ).decimals.toString();
-    const principalDecimals = (
-      await helpersContract.getReserveConfigurationData(usdc.address)
-    ).decimals.toString();
-
-    const expectedCollateralLiquidated = new BigNumber(principalPrice.toString())
-      .times(new BigNumber(amountToRepay.toString()).times(105))
-      .times(new BigNumber(10).pow(collateralDecimals))
-      .div(
-        new BigNumber(collateralPrice.toString()).times(new BigNumber(10).pow(principalDecimals))
-      )
-      .div(100)
-      .decimalPlaces(0, BigNumber.ROUND_DOWN);
-
-    const expectedVariableDebtIncrease = calcExpectedVariableDebtTokenBalance(
-      usdcReserveDataBefore,
-      usdcUserDataBefore,
-      new BigNumber(repayWithCollateralTimestamp)
-    ).minus(usdcUserDataBefore.currentVariableDebt);
-
-    const expectedStableDebtIncrease = calcExpectedStableDebtTokenBalance(
-      usdcUserDataBefore.principalStableDebt,
-      usdcUserDataBefore.stableBorrowRate,
-      usdcUserDataBefore.stableRateLastUpdated,
-      new BigNumber(repayWithCollateralTimestamp)
-    ).minus(usdcUserDataBefore.currentStableDebt);
-
-    expect(usdcUserDataAfter.currentVariableDebt).to.be.bignumber.equal(
-      new BigNumber(usdcUserDataBefore.currentVariableDebt)
-        .minus(amountToRepay.toString())
-        .plus(expectedVariableDebtIncrease)
-        .gte(0)
-        ? new BigNumber(usdcUserDataBefore.currentVariableDebt)
-            .minus(amountToRepay.toString())
-            .plus(expectedVariableDebtIncrease)
-            .toString()
-        : '0',
-      'INVALID_VARIABLE_DEBT_POSITION'
-    );
-
-    const stableDebtRepaid = new BigNumber(usdcUserDataBefore.currentVariableDebt)
-      .minus(amountToRepay.toString())
-      .plus(expectedVariableDebtIncrease)
-      .abs();
-
-    expect(usdcUserDataAfter.currentStableDebt).to.be.bignumber.equal(
-      new BigNumber(usdcUserDataBefore.currentStableDebt)
-        .minus(stableDebtRepaid)
-        .plus(expectedStableDebtIncrease)
-        .gte(0)
-        ? new BigNumber(usdcUserDataBefore.currentStableDebt)
-            .minus(stableDebtRepaid)
-            .plus(expectedStableDebtIncrease)
-            .toString()
-        : '0',
-      'INVALID_STABLE_DEBT_POSITION'
-    );
-
-    expect(wethUserDataAfter.currentATokenBalance).to.be.bignumber.equal(
-      new BigNumber(wethUserDataBefore.currentATokenBalance).minus(
-        expectedCollateralLiquidated.toString()
-      ),
-      'INVALID_COLLATERAL_POSITION'
-    );
-
-    const eventsEmitted = txReceipt.events || [];
-
-    expectRepayWithCollateralEvent(
-      eventsEmitted,
-      pool.address,
-      weth.address,
-      usdc.address,
-      user.address
-    );
-    // Resets USDC Price
-    await oracle.setAssetPrice(usdc.address, usdcPrice);
-  });
-
-  it('User 3 deposits WETH and borrows USDC at Variable', async () => {
-    const {pool, weth, usdc, users, oracle} = testEnv;
-    const user = users[2];
-    const amountToDeposit = parseEther('10');
-
-    await weth.connect(user.signer).mint(amountToDeposit);
-
-    await weth.connect(user.signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL);
-
-    await pool.connect(user.signer).deposit(weth.address, amountToDeposit, user.address, '0');
-
-    const userGlobalData = await pool.getUserAccountData(user.address);
-
-    const usdcPrice = await oracle.getAssetPrice(usdc.address);
-
-    const amountUSDCToBorrow = await convertToCurrencyDecimals(
-      usdc.address,
-      new BigNumber(userGlobalData.availableBorrowsETH.toString())
-        .div(usdcPrice.toString())
-        .multipliedBy(0.95)
-        .toFixed(0)
-    );
-
-    await pool.connect(user.signer).borrow(usdc.address, amountUSDCToBorrow, 2, 0, user.address);
-  });
-
-  it('User 5 liquidates half the USDC loan of User 3 by swapping his WETH collateral', async () => {
-    const {pool, weth, usdc, users, mockSwapAdapter, oracle, helpersContract} = testEnv;
-    const user = users[2];
-    const liquidator = users[4];
-    // Sets USDC Price higher to decrease health factor below 1
-    const usdcPrice = await oracle.getAssetPrice(usdc.address);
-
-    await oracle.setAssetPrice(
-      usdc.address,
-      new BigNumber(usdcPrice.toString()).multipliedBy(1.15).toFixed(0)
-    );
-
-    const userGlobalData = await pool.getUserAccountData(user.address);
-
-    expect(userGlobalData.healthFactor.toString()).to.be.bignumber.lt(oneEther, INVALID_HF);
-
-    const {userData: wethUserDataBefore} = await getContractsData(
-      weth.address,
-      user.address,
-      testEnv
-    );
-
-    const {
-      reserveData: usdcReserveDataBefore,
-      userData: usdcUserDataBefore,
-    } = await getContractsData(usdc.address, user.address, testEnv);
-
-    const amountToRepay = usdcReserveDataBefore.totalVariableDebt.dividedBy(2).toFixed(0);
-
-    await mockSwapAdapter.setAmountToReturn(amountToRepay);
-    await waitForTx(
-      await pool
-        .connect(liquidator.signer)
-        .repayWithCollateral(
-          weth.address,
-          usdc.address,
-          user.address,
-          amountToRepay,
-          mockSwapAdapter.address,
-          '0x'
-        )
-    );
-    const repayWithCollateralTimestamp = await timeLatest();
-
-    const {userData: wethUserDataAfter} = await getContractsData(
-      weth.address,
-      user.address,
-      testEnv
-    );
-
-    const {userData: usdcUserDataAfter} = await getContractsData(
-      usdc.address,
-      user.address,
-      testEnv
-    );
-
-    const collateralPrice = await oracle.getAssetPrice(weth.address);
-    const principalPrice = await oracle.getAssetPrice(usdc.address);
-
-    const collateralDecimals = (
-      await helpersContract.getReserveConfigurationData(weth.address)
-    ).decimals.toString();
-    const principalDecimals = (
-      await helpersContract.getReserveConfigurationData(usdc.address)
-    ).decimals.toString();
-
-    const expectedCollateralLiquidated = new BigNumber(principalPrice.toString())
-      .times(new BigNumber(amountToRepay.toString()).times(105))
-      .times(new BigNumber(10).pow(collateralDecimals))
-      .div(
-        new BigNumber(collateralPrice.toString()).times(new BigNumber(10).pow(principalDecimals))
-      )
-      .div(100)
-      .decimalPlaces(0, BigNumber.ROUND_DOWN);
-
-    const expectedVariableDebtIncrease = calcExpectedVariableDebtTokenBalance(
-      usdcReserveDataBefore,
-      usdcUserDataBefore,
-      new BigNumber(repayWithCollateralTimestamp)
-    ).minus(usdcUserDataBefore.currentVariableDebt);
-
-    expect(usdcUserDataAfter.currentVariableDebt).to.be.bignumber.almostEqual(
-      new BigNumber(usdcUserDataBefore.currentVariableDebt)
-        .minus(amountToRepay.toString())
-        .plus(expectedVariableDebtIncrease)
-        .toString(),
-      'INVALID_DEBT_POSITION'
-    );
-
-    expect(wethUserDataAfter.currentATokenBalance).to.be.bignumber.almostEqual(
-      new BigNumber(wethUserDataBefore.currentATokenBalance).minus(
-        expectedCollateralLiquidated.toString()
-      ),
-      'INVALID_COLLATERAL_POSITION'
-    );
-    expect(wethUserDataAfter.usageAsCollateralEnabled).to.be.true;
-
-    // Resets USDC Price
-    await oracle.setAssetPrice(usdc.address, usdcPrice);
-  });
-
-  it('Revert expected. User 5 tries to liquidate an User 3 collateral a currency he havent borrow', async () => {
-    const {pool, weth, dai, users, oracle, mockSwapAdapter, usdc} = testEnv;
-    const user = users[2];
-    const liquidator = users[4];
-
-    const amountToRepay = parseUnits('10', 6);
-
-    // Sets USDC Price higher to decrease health factor below 1
-    const usdcPrice = await oracle.getAssetPrice(usdc.address);
-
-    await oracle.setAssetPrice(
-      usdc.address,
-      new BigNumber(usdcPrice.toString()).multipliedBy(6.4).toFixed(0)
-    );
-    const userGlobalData = await pool.getUserAccountData(user.address);
-
-    expect(userGlobalData.healthFactor.toString()).to.be.bignumber.lt(oneEther, INVALID_HF);
-
-    await expect(
-      pool
-        .connect(liquidator.signer)
-        .repayWithCollateral(
-          weth.address,
-          dai.address,
-          user.address,
-          amountToRepay,
-          mockSwapAdapter.address,
-          '0x'
-        )
-    ).to.be.revertedWith('40');
-
-    await oracle.setAssetPrice(usdc.address, usdcPrice);
-  });
-
-  it('User 5 liquidates all the USDC loan of User 3 by swapping his WETH collateral', async () => {
-    const {pool, weth, usdc, users, mockSwapAdapter, oracle, helpersContract} = testEnv;
-    const user = users[2];
-    const liquidator = users[4];
-    // Sets USDC Price higher to decrease health factor below 1
-    const usdcPrice = await oracle.getAssetPrice(usdc.address);
-
-    await oracle.setAssetPrice(
-      usdc.address,
-      new BigNumber(usdcPrice.toString()).multipliedBy(1.35).toFixed(0)
-    );
-
-    const userGlobalData = await pool.getUserAccountData(user.address);
-
-    expect(userGlobalData.healthFactor.toString()).to.be.bignumber.lt(oneEther, INVALID_HF);
-
-    const {userData: wethUserDataBefore} = await getContractsData(
-      weth.address,
-      user.address,
-      testEnv
-    );
-
-    const {
-      reserveData: usdcReserveDataBefore,
-      userData: usdcUserDataBefore,
-    } = await getContractsData(usdc.address, user.address, testEnv);
-
-    const amountToRepay = usdcReserveDataBefore.totalVariableDebt.toFixed(0);
-
-    await mockSwapAdapter.setAmountToReturn(amountToRepay);
-    await waitForTx(
-      await pool
-        .connect(liquidator.signer)
-        .repayWithCollateral(
-          weth.address,
-          usdc.address,
-          user.address,
-          amountToRepay,
-          mockSwapAdapter.address,
-          '0x'
-        )
-    );
-    const repayWithCollateralTimestamp = await timeLatest();
-
-    const {userData: wethUserDataAfter} = await getContractsData(
-      weth.address,
-      user.address,
-      testEnv
-    );
-
-    const {userData: usdcUserDataAfter} = await getContractsData(
-      usdc.address,
-      user.address,
-      testEnv
-    );
-
-    const collateralPrice = await oracle.getAssetPrice(weth.address);
-    const principalPrice = await oracle.getAssetPrice(usdc.address);
-
-    const collateralDecimals = (
-      await helpersContract.getReserveConfigurationData(weth.address)
-    ).decimals.toString();
-    const principalDecimals = (
-      await helpersContract.getReserveConfigurationData(usdc.address)
-    ).decimals.toString();
-
-    const expectedCollateralLiquidated = new BigNumber(principalPrice.toString())
-      .times(new BigNumber(amountToRepay.toString()).times(105))
-      .times(new BigNumber(10).pow(collateralDecimals))
-      .div(
-        new BigNumber(collateralPrice.toString()).times(new BigNumber(10).pow(principalDecimals))
-      )
-      .div(100)
-      .decimalPlaces(0, BigNumber.ROUND_DOWN);
-
-    const expectedVariableDebtIncrease = calcExpectedVariableDebtTokenBalance(
-      usdcReserveDataBefore,
-      usdcUserDataBefore,
-      new BigNumber(repayWithCollateralTimestamp)
-    ).minus(usdcUserDataBefore.currentVariableDebt);
-
-    expect(usdcUserDataAfter.currentVariableDebt).to.be.bignumber.almostEqual(
-      new BigNumber(usdcUserDataBefore.currentVariableDebt)
-        .minus(amountToRepay.toString())
-        .plus(expectedVariableDebtIncrease)
-        .toString(),
-      'INVALID_DEBT_POSITION'
-    );
-
-    expect(wethUserDataAfter.currentATokenBalance).to.be.bignumber.equal(
-      new BigNumber(wethUserDataBefore.currentATokenBalance).minus(
-        expectedCollateralLiquidated.toString()
-      ),
-      'INVALID_COLLATERAL_POSITION'
-    );
-
-    // Resets USDC Price
-    await oracle.setAssetPrice(usdc.address, usdcPrice);
-  });
-
-  it('User 2 deposit WETH and borrows DAI at Variable', async () => {
-    const {pool, weth, dai, users, oracle} = testEnv;
-    const user = users[1];
-    const amountToDeposit = ethers.utils.parseEther('2');
-
-    await weth.connect(user.signer).mint(amountToDeposit);
-
-    await weth.connect(user.signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL);
-
-    await pool.connect(user.signer).deposit(weth.address, amountToDeposit, user.address, '0');
-
-    const userGlobalData = await pool.getUserAccountData(user.address);
-
-    const daiPrice = await oracle.getAssetPrice(dai.address);
-
-    const amountDAIToBorrow = await convertToCurrencyDecimals(
-      dai.address,
-      new BigNumber(userGlobalData.availableBorrowsETH.toString())
-        .div(daiPrice.toString())
-        .multipliedBy(0.9)
-        .toFixed(0)
-    );
-
-    await pool.connect(user.signer).borrow(dai.address, amountDAIToBorrow, 2, 0, user.address);
-  });
-
-  it('It is not possible to do reentrancy on repayWithCollateral()', async () => {
-    const {pool, weth, dai, users, mockSwapAdapter, oracle} = testEnv;
-    const user = users[1];
-    const liquidator = users[4];
-
-    // Sets DAI Price higher to decrease health factor below 1
-    const daiPrice = await oracle.getAssetPrice(dai.address);
-
-    await oracle.setAssetPrice(
-      dai.address,
-      new BigNumber(daiPrice.toString()).multipliedBy(1.4).toFixed(0)
-    );
-
-    const {reserveData: daiReserveDataBefore} = await getContractsData(
-      dai.address,
-      user.address,
-      testEnv
-    );
-
-    const amountToRepay = daiReserveDataBefore.totalVariableDebt.toString();
-
-    await waitForTx(await mockSwapAdapter.setTryReentrancy(true));
-
-    await mockSwapAdapter.setAmountToReturn(amountToRepay);
-    await expect(
-      pool
-        .connect(liquidator.signer)
-        .repayWithCollateral(
-          weth.address,
-          dai.address,
-          user.address,
-          amountToRepay,
-          mockSwapAdapter.address,
-          '0x'
-        )
-    ).to.be.revertedWith('53');
-
-    // Resets DAI Price
-    await oracle.setAssetPrice(dai.address, daiPrice);
-    // Resets mock
-    await waitForTx(await mockSwapAdapter.setTryReentrancy(false));
-  });
-
-  it('User 5 tries to liquidate  User 2 DAI Variable loan using his WETH collateral, with good HF', async () => {
-    const {pool, weth, dai, users, mockSwapAdapter} = testEnv;
-    const user = users[1];
-    const liquidator = users[4];
-
-    const {reserveData: daiReserveDataBefore} = await getContractsData(
-      dai.address,
-      user.address,
-      testEnv
-    );
-
-    // First half
-    const amountToRepay = daiReserveDataBefore.totalVariableDebt.dividedBy(2).toString();
-
-    await mockSwapAdapter.setAmountToReturn(amountToRepay);
-    await expect(
-      pool
-        .connect(liquidator.signer)
-        .repayWithCollateral(
-          weth.address,
-          dai.address,
-          user.address,
-          amountToRepay,
-          mockSwapAdapter.address,
-          '0x'
-        )
-    ).to.be.revertedWith('38');
-  });
-  it('User 5 liquidates User 2 DAI Variable loan using his WETH collateral, half the amount', async () => {
-    const {pool, weth, dai, users, mockSwapAdapter, oracle, helpersContract} = testEnv;
-    const user = users[1];
-    const liquidator = users[4];
-
-    // Sets DAI Price higher to decrease health factor below 1
-    const daiPrice = await oracle.getAssetPrice(dai.address);
-
-    await oracle.setAssetPrice(
-      dai.address,
-      new BigNumber(daiPrice.toString()).multipliedBy(1.4).toFixed(0)
-    );
-
-    const userGlobalData = await pool.getUserAccountData(user.address);
-
-    expect(userGlobalData.healthFactor.toString()).to.be.bignumber.lt(oneEther, INVALID_HF);
-
-    const {userData: wethUserDataBefore} = await getContractsData(
-      weth.address,
-      user.address,
-      testEnv
-    );
-
-    const {reserveData: daiReserveDataBefore, userData: daiUserDataBefore} = await getContractsData(
-      dai.address,
-      user.address,
-      testEnv
-    );
-
-    // First half
-    const amountToRepay = daiReserveDataBefore.totalVariableDebt
-      .multipliedBy(0.6)
-      .toFixed(0)
-      .toString();
-
-    await mockSwapAdapter.setAmountToReturn(amountToRepay);
-    await waitForTx(
-      await pool
-        .connect(liquidator.signer)
-        .repayWithCollateral(
-          weth.address,
-          dai.address,
-          user.address,
-          amountToRepay,
-          mockSwapAdapter.address,
-          '0x'
-        )
-    );
-    const repayWithCollateralTimestamp = await timeLatest();
-
-    const {userData: wethUserDataAfter} = await getContractsData(
-      weth.address,
-      user.address,
-      testEnv
-    );
-
-    const {userData: daiUserDataAfter} = await getContractsData(dai.address, user.address, testEnv);
-
-    const collateralPrice = await oracle.getAssetPrice(weth.address);
-    const principalPrice = await oracle.getAssetPrice(dai.address);
-
-    const collateralDecimals = (
-      await helpersContract.getReserveConfigurationData(weth.address)
-    ).decimals.toString();
-    const principalDecimals = (
-      await helpersContract.getReserveConfigurationData(dai.address)
-    ).decimals.toString();
-
-    const expectedCollateralLiquidated = new BigNumber(principalPrice.toString())
-      .times(new BigNumber(amountToRepay.toString()).times(105))
-      .times(new BigNumber(10).pow(collateralDecimals))
-      .div(
-        new BigNumber(collateralPrice.toString()).times(new BigNumber(10).pow(principalDecimals))
-      )
-      .div(100)
-      .decimalPlaces(0, BigNumber.ROUND_DOWN);
-
-    const expectedVariableDebtIncrease = calcExpectedVariableDebtTokenBalance(
-      daiReserveDataBefore,
-      daiUserDataBefore,
-      new BigNumber(repayWithCollateralTimestamp)
-    ).minus(daiUserDataBefore.currentVariableDebt);
-
-    expect(daiUserDataAfter.currentVariableDebt).to.be.bignumber.almostEqual(
-      new BigNumber(daiUserDataBefore.currentVariableDebt)
-        .minus(amountToRepay.toString())
-        .plus(expectedVariableDebtIncrease)
-        .toString()
-    );
-
-    expect(wethUserDataAfter.currentATokenBalance).to.be.bignumber.equal(
-      new BigNumber(wethUserDataBefore.currentATokenBalance).minus(
-        expectedCollateralLiquidated.toString()
-      )
-    );
-    expect(wethUserDataAfter.usageAsCollateralEnabled).to.be.true;
-
-    // Resets DAI price
-    await oracle.setAssetPrice(dai.address, daiPrice);
-  });
-
-  it('User 2 tries to repay remaining DAI Variable loan using his WETH collateral', async () => {
-    const {pool, weth, dai, users, mockSwapAdapter, oracle, helpersContract} = testEnv;
-    const user = users[1];
-
-    const {userData: wethUserDataBefore} = await getContractsData(
-      weth.address,
-      user.address,
-      testEnv
-    );
-
-    const {reserveData: daiReserveDataBefore, userData: daiUserDataBefore} = await getContractsData(
-      dai.address,
-      user.address,
-      testEnv
-    );
-
-    await increaseTime(1000);
-    // Repay the remaining DAI
-    const amountToRepay = daiReserveDataBefore.totalVariableDebt.toString();
-
-    await mockSwapAdapter.setAmountToReturn(amountToRepay);
-    const receipt = await waitForTx(
-      await pool
-        .connect(user.signer)
-        .repayWithCollateral(
-          weth.address,
-          dai.address,
-          user.address,
-          amountToRepay,
-          mockSwapAdapter.address,
-          '0x'
-        )
-    );
-    const repayWithCollateralTimestamp = (await BRE.ethers.provider.getBlock(receipt.blockNumber))
-      .timestamp;
-
-    const {userData: wethUserDataAfter} = await getContractsData(
-      weth.address,
-      user.address,
-      testEnv
-    );
-
-    const {userData: daiUserDataAfter} = await getContractsData(dai.address, user.address, testEnv);
-
-    const collateralPrice = await oracle.getAssetPrice(weth.address);
-    const principalPrice = await oracle.getAssetPrice(dai.address);
-
-    const collateralDecimals = (
-      await helpersContract.getReserveConfigurationData(weth.address)
-    ).decimals.toString();
-    const principalDecimals = (
-      await helpersContract.getReserveConfigurationData(dai.address)
-    ).decimals.toString();
-
-    const expectedCollateralLiquidated = new BigNumber(principalPrice.toString())
-      .times(new BigNumber(amountToRepay.toString()).times(105))
-      .times(new BigNumber(10).pow(collateralDecimals))
-      .div(
-        new BigNumber(collateralPrice.toString()).times(new BigNumber(10).pow(principalDecimals))
-      )
-      .div(100)
-      .decimalPlaces(0, BigNumber.ROUND_DOWN);
-
-    const expectedVariableDebtIncrease = calcExpectedVariableDebtTokenBalance(
-      daiReserveDataBefore,
-      daiUserDataBefore,
-      new BigNumber(repayWithCollateralTimestamp)
-    ).minus(daiUserDataBefore.currentVariableDebt);
-
-    expect(daiUserDataAfter.currentVariableDebt).to.be.bignumber.almostEqual(
-      new BigNumber(daiUserDataBefore.currentVariableDebt)
-        .minus(amountToRepay.toString())
-        .plus(expectedVariableDebtIncrease)
-        .toString()
-    );
-
-    expect(
-      new BigNumber(wethUserDataBefore.currentATokenBalance).minus(
-        expectedCollateralLiquidated.toString()
-      )
-    ).to.be.bignumber.equal(wethUserDataAfter.currentATokenBalance);
-  });
-
-  it('Liquidator tries to repay 4 user a bigger amount that what can be swapped of a particular collateral, repaying only the maximum allowed by that collateral', async () => {
-    const {pool, weth, dai, usdc, users, mockSwapAdapter, oracle, helpersContract} = testEnv;
-    const user = users[3];
-    const liquidator = users[5];
-
-    const amountToDepositWeth = parseEther('0.1');
-    const amountToDepositDAI = parseEther('500');
-    const amountToBorrowVariable = parseUnits('80', '6');
-
-    await weth.connect(user.signer).mint(amountToDepositWeth);
-    await dai.connect(user.signer).mint(amountToDepositDAI);
-    await weth.connect(user.signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL);
-    await dai.connect(user.signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL);
-
-    await pool.connect(user.signer).deposit(weth.address, amountToDepositWeth, user.address, '0');
-    await pool.connect(user.signer).deposit(dai.address, amountToDepositDAI, user.address, '0');
-
-    await pool
-      .connect(user.signer)
-      .borrow(usdc.address, amountToBorrowVariable, 2, 0, user.address);
-
-    const amountToRepay = amountToBorrowVariable;
-
-    const {userData: wethUserDataBefore} = await getContractsData(
-      weth.address,
-      user.address,
-      testEnv
-    );
-
-    const {
-      reserveData: usdcReserveDataBefore,
-      userData: usdcUserDataBefore,
-    } = await getContractsData(usdc.address, user.address, testEnv);
-
-    // Set HF below 1
-    const daiPrice = await oracle.getAssetPrice(dai.address);
-    await oracle.setAssetPrice(
-      dai.address,
-      new BigNumber(daiPrice.toString()).multipliedBy(0.1).toFixed(0)
-    );
-    const userGlobalDataPrior = await pool.getUserAccountData(user.address);
-    expect(userGlobalDataPrior.healthFactor.toString()).to.be.bignumber.lt(oneEther, INVALID_HF);
-
-    // Execute liquidation
-    await mockSwapAdapter.setAmountToReturn(amountToRepay);
-    await waitForTx(
-      await pool
-        .connect(liquidator.signer)
-        .repayWithCollateral(
-          weth.address,
-          usdc.address,
-          user.address,
-          amountToRepay,
-          mockSwapAdapter.address,
-          '0x'
-        )
-    );
-    const repayWithCollateralTimestamp = await timeLatest();
-
-    const {userData: wethUserDataAfter} = await getContractsData(
-      weth.address,
-      user.address,
-      testEnv
-    );
-
-    const {userData: usdcUserDataAfter} = await getContractsData(
-      usdc.address,
-      user.address,
-      testEnv
-    );
-
-    const collateralPrice = await oracle.getAssetPrice(weth.address);
-    const principalPrice = await oracle.getAssetPrice(usdc.address);
-
-    const collateralConfig = await helpersContract.getReserveConfigurationData(weth.address);
-
-    const collateralDecimals = collateralConfig.decimals.toString();
-    const principalDecimals = (
-      await helpersContract.getReserveConfigurationData(usdc.address)
-    ).decimals.toString();
-    const collateralLiquidationBonus = collateralConfig.liquidationBonus.toString();
-
-    const expectedDebtCovered = new BigNumber(collateralPrice.toString())
-      .times(new BigNumber(wethUserDataBefore.currentATokenBalance.toString()))
-      .times(new BigNumber(10).pow(principalDecimals))
-      .div(
-        new BigNumber(principalPrice.toString()).times(new BigNumber(10).pow(collateralDecimals))
-      )
-      .div(new BigNumber(collateralLiquidationBonus).div(10000).toString())
-      .decimalPlaces(0, BigNumber.ROUND_DOWN);
-
-    const expectedVariableDebtIncrease = calcExpectedVariableDebtTokenBalance(
-      usdcReserveDataBefore,
-      usdcUserDataBefore,
-      new BigNumber(repayWithCollateralTimestamp)
-    ).minus(usdcUserDataBefore.currentVariableDebt);
-
-    expect(usdcUserDataAfter.currentVariableDebt).to.be.bignumber.almostEqual(
-      new BigNumber(usdcUserDataBefore.currentVariableDebt)
-        .minus(expectedDebtCovered.toString())
-        .plus(expectedVariableDebtIncrease),
-      'INVALID_VARIABLE_DEBT_POSITION'
-    );
-
-    expect(wethUserDataAfter.usageAsCollateralEnabled).to.be.false;
-
-    expect(wethUserDataAfter.currentATokenBalance).to.be.bignumber.equal(0);
-
-    // Resets DAI Price
-    await oracle.setAssetPrice(dai.address, daiPrice);
-  });
-
-  it('User 4 deposits WETH, LEND and DAI, then borrows USDC at Variable, then disables WETH as collateral', async () => {
-    const {pool, weth, dai, usdc, users} = testEnv;
-    const user = users[4];
-    const amountWETHToDeposit = parseEther('10');
-    const amountDAIToDeposit = parseEther('100');
-
-    const amountToBorrow = parseUnits('75', 6);
-
-    await weth.connect(user.signer).mint(amountWETHToDeposit);
-    await weth.connect(user.signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL);
-    await pool.connect(user.signer).deposit(weth.address, amountWETHToDeposit, user.address, '0');
-
-    await dai.connect(user.signer).mint(amountDAIToDeposit);
-    await dai.connect(user.signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL);
-    await pool.connect(user.signer).deposit(dai.address, amountDAIToDeposit, user.address, '0');
-
-    await pool.connect(user.signer).borrow(usdc.address, amountToBorrow, 2, 0, user.address);
-  });
-
-  it('Liquidator tries to liquidate User 5 USDC loan by swapping his WETH collateral, should revert due WETH collateral disabled', async () => {
-    const {pool, weth, dai, usdc, users, mockSwapAdapter, oracle} = testEnv;
-    const user = users[4];
-    const liquidator = users[5];
-
-    const amountToRepay = parseUnits('65', 6);
-
-    // User 5 Disable WETH as collateral
-    await pool.connect(user.signer).setUserUseReserveAsCollateral(weth.address, false);
-
-    const {userData: wethUserDataBefore} = await getContractsData(
-      weth.address,
-      user.address,
-      testEnv
-    );
-
-    const {
-      reserveData: usdcReserveDataBefore,
-      userData: usdcUserDataBefore,
-    } = await getContractsData(usdc.address, user.address, testEnv);
-
-    expect(wethUserDataBefore.usageAsCollateralEnabled).to.be.false;
-
-    //drop the price to set the HF below 1
-    const daiPrice = await oracle.getAssetPrice(dai.address);
-
-    await oracle.setAssetPrice(
-      dai.address,
-      new BigNumber(daiPrice.toString()).multipliedBy(0.9).toFixed(0)
-    );
-
-    // Liquidator should NOT be able to liquidate himself with WETH, even if is disabled
-    await mockSwapAdapter.setAmountToReturn(amountToRepay);
-    await expect(
-      pool
-        .connect(liquidator.signer)
-        .repayWithCollateral(
-          weth.address,
-          usdc.address,
-          user.address,
-          amountToRepay,
-          mockSwapAdapter.address,
-          '0x'
-        )
-    ).to.be.revertedWith(COLLATERAL_CANNOT_BE_LIQUIDATED);
-
-    const repayWithCollateralTimestamp = await timeLatest();
-
-    const {userData: wethUserDataAfter} = await getContractsData(
-      weth.address,
-      user.address,
-      testEnv
-    );
-
-    const {userData: usdcUserDataAfter} = await getContractsData(
-      usdc.address,
-      user.address,
-      testEnv
-    );
-
-    const expectedVariableDebtIncrease = calcExpectedVariableDebtTokenBalance(
-      usdcReserveDataBefore,
-      usdcUserDataBefore,
-      new BigNumber(repayWithCollateralTimestamp)
-    ).minus(usdcUserDataBefore.currentVariableDebt);
-
-    expect(usdcUserDataAfter.currentVariableDebt).to.be.bignumber.almostEqual(
-      new BigNumber(usdcUserDataBefore.currentVariableDebt)
-        .plus(expectedVariableDebtIncrease)
-        .toString(),
-      'INVALID_DEBT_POSITION'
-    );
-
-    expect(wethUserDataAfter.usageAsCollateralEnabled).to.be.false;
-  });
-});
diff --git a/test/pausable-functions.spec.ts b/test/pausable-functions.spec.ts
index d5e321e3..8e7cc2a7 100644
--- a/test/pausable-functions.spec.ts
+++ b/test/pausable-functions.spec.ts
@@ -155,22 +155,6 @@ makeSuite('Pausable Pool', (testEnv: TestEnv) => {
     await configurator.setPoolPause(false);
   });
 
-  it('Swap liquidity', async () => {
-    const {pool, dai, weth, users, configurator} = testEnv;
-
-    const user = users[1];
-    // Pause the pool
-    await configurator.setPoolPause(true);
-
-    // Try to execute liquidation
-    await expect(
-      pool.connect(user.signer).swapLiquidity(user.address, dai.address, weth.address, '1', '0x')
-    ).revertedWith(IS_PAUSED);
-
-    // Unpause the pool
-    await configurator.setPoolPause(false);
-  });
-
   it('Repay', async () => {
     const {pool, dai, users, configurator} = testEnv;
 
@@ -187,32 +171,6 @@ makeSuite('Pausable Pool', (testEnv: TestEnv) => {
     await configurator.setPoolPause(false);
   });
 
-  it('Repay with collateral', async () => {
-    const {pool, weth, dai, usdc, users, mockSwapAdapter, oracle, configurator} = testEnv;
-    const user = users[6];
-    const liquidator = users[5];
-
-    // Pause the pool
-    await configurator.setPoolPause(true);
-
-    // Try to execute liquidation
-    await expect(
-      pool
-        .connect(liquidator.signer)
-        .repayWithCollateral(
-          weth.address,
-          usdc.address,
-          user.address,
-          '1',
-          mockSwapAdapter.address,
-          '0x'
-        )
-    ).revertedWith(IS_PAUSED);
-
-    // Unpause the pool
-    await configurator.setPoolPause(false);
-  });
-
   it('Flash loan', async () => {
     const {dai, pool, weth, users, configurator} = testEnv;
 
diff --git a/test/repay-with-collateral.spec.ts b/test/repay-with-collateral.spec.ts
deleted file mode 100644
index 282cddb3..00000000
--- a/test/repay-with-collateral.spec.ts
+++ /dev/null
@@ -1,682 +0,0 @@
-import {TestEnv, makeSuite} from './helpers/make-suite';
-import {APPROVAL_AMOUNT_LENDING_POOL} from '../helpers/constants';
-import {ethers} from 'ethers';
-import BigNumber from 'bignumber.js';
-import {
-  calcExpectedVariableDebtTokenBalance,
-  calcExpectedStableDebtTokenBalance,
-} from './helpers/utils/calculations';
-import {getContractsData} from './helpers/actions';
-import {timeLatest, waitForTx} from '../helpers/misc-utils';
-import {ProtocolErrors, tEthereumAddress} from '../helpers/types';
-
-const {expect} = require('chai');
-const {parseUnits, parseEther} = ethers.utils;
-
-export const expectRepayWithCollateralEvent = (
-  events: ethers.Event[],
-  pool: tEthereumAddress,
-  collateral: tEthereumAddress,
-  borrowing: tEthereumAddress,
-  user: tEthereumAddress
-) => {
-  if (!events || events.length < 16) {
-    expect(false, 'INVALID_EVENTS_LENGTH_ON_REPAY_COLLATERAL');
-  }
-
-  const repayWithCollateralEvent = events[15];
-
-  expect(repayWithCollateralEvent.address).to.be.equal(pool);
-  expect(`0x${repayWithCollateralEvent.topics[1].slice(26)}`.toLowerCase()).to.be.equal(
-    collateral.toLowerCase()
-  );
-  expect(`0x${repayWithCollateralEvent.topics[2].slice(26)}`).to.be.equal(borrowing.toLowerCase());
-  expect(`0x${repayWithCollateralEvent.topics[3].slice(26)}`.toLowerCase()).to.be.equal(
-    user.toLowerCase()
-  );
-};
-
-makeSuite('LendingPool. repayWithCollateral()', (testEnv: TestEnv) => {
-  const {IS_PAUSED} = ProtocolErrors;
-  it("It's not possible to repayWithCollateral() on a non-active collateral or a non active principal", async () => {
-    const {configurator, weth, pool, users, dai, mockSwapAdapter} = testEnv;
-    const user = users[1];
-    await configurator.deactivateReserve(weth.address);
-
-    await expect(
-      pool
-        .connect(user.signer)
-        .repayWithCollateral(
-          weth.address,
-          dai.address,
-          user.address,
-          parseEther('100'),
-          mockSwapAdapter.address,
-          '0x'
-        )
-    ).to.be.revertedWith('2');
-
-    await configurator.activateReserve(weth.address);
-
-    await configurator.deactivateReserve(dai.address);
-
-    await expect(
-      pool
-        .connect(user.signer)
-        .repayWithCollateral(
-          weth.address,
-          dai.address,
-          user.address,
-          parseEther('100'),
-          mockSwapAdapter.address,
-          '0x'
-        )
-    ).to.be.revertedWith('2');
-
-    await configurator.activateReserve(dai.address);
-  });
-
-  it('User 1 provides some liquidity for others to borrow', async () => {
-    const {pool, weth, dai, usdc, deployer} = testEnv;
-
-    await weth.mint(parseEther('200'));
-    await weth.approve(pool.address, parseEther('200'));
-    await pool.deposit(weth.address, parseEther('200'), deployer.address, 0);
-    await dai.mint(parseEther('20000'));
-    await dai.approve(pool.address, parseEther('20000'));
-    await pool.deposit(dai.address, parseEther('20000'), deployer.address, 0);
-    await usdc.mint(parseEther('20000'));
-    await usdc.approve(pool.address, parseEther('20000'));
-    await pool.deposit(usdc.address, parseEther('20000'), deployer.address, 0);
-  });
-
-  it('User 2 deposit WETH and borrows DAI at Variable', async () => {
-    const {pool, weth, dai, users} = testEnv;
-    const user = users[1];
-    const amountToDeposit = ethers.utils.parseEther('1');
-    const amountToBorrow = ethers.utils.parseEther('20');
-
-    await weth.connect(user.signer).mint(amountToDeposit);
-
-    await weth.connect(user.signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL);
-
-    await pool.connect(user.signer).deposit(weth.address, amountToDeposit, user.address, '0');
-
-    await pool.connect(user.signer).borrow(dai.address, amountToBorrow, 2, 0, user.address);
-  });
-
-  it('It is not possible to do reentrancy on repayWithCollateral()', async () => {
-    const {pool, weth, dai, users, mockSwapAdapter, oracle} = testEnv;
-    const user = users[1];
-
-    const amountToRepay = parseEther('10');
-
-    await waitForTx(await mockSwapAdapter.setTryReentrancy(true));
-
-    await mockSwapAdapter.setAmountToReturn(amountToRepay);
-    await expect(
-      pool
-        .connect(user.signer)
-        .repayWithCollateral(
-          weth.address,
-          dai.address,
-          user.address,
-          amountToRepay,
-          mockSwapAdapter.address,
-          '0x'
-        )
-    ).to.be.revertedWith('53');
-  });
-
-  it('User 2 tries to repay his DAI Variable loan using his WETH collateral. First half the amount, after that, the rest', async () => {
-    const {pool, weth, dai, users, mockSwapAdapter, oracle, helpersContract} = testEnv;
-    const user = users[1];
-
-    const amountToRepay = parseEther('10');
-
-    await waitForTx(await mockSwapAdapter.setTryReentrancy(false));
-
-    const {userData: wethUserDataBefore} = await getContractsData(
-      weth.address,
-      user.address,
-      testEnv
-    );
-
-    const {reserveData: daiReserveDataBefore, userData: daiUserDataBefore} = await getContractsData(
-      dai.address,
-      user.address,
-      testEnv
-    );
-
-    await mockSwapAdapter.setAmountToReturn(amountToRepay);
-    await waitForTx(
-      await pool
-        .connect(user.signer)
-        .repayWithCollateral(
-          weth.address,
-          dai.address,
-          user.address,
-          amountToRepay,
-          mockSwapAdapter.address,
-          '0x'
-        )
-    );
-    const repayWithCollateralTimestamp = await timeLatest();
-
-    const {userData: wethUserDataAfter} = await getContractsData(
-      weth.address,
-      user.address,
-      testEnv
-    );
-
-    const {userData: daiUserDataAfter} = await getContractsData(dai.address, user.address, testEnv);
-
-    const collateralPrice = await oracle.getAssetPrice(weth.address);
-    const principalPrice = await oracle.getAssetPrice(dai.address);
-
-    const collateralDecimals = (
-      await helpersContract.getReserveConfigurationData(weth.address)
-    ).decimals.toString();
-    const principalDecimals = (
-      await helpersContract.getReserveConfigurationData(dai.address)
-    ).decimals.toString();
-
-    const expectedCollateralLiquidated = new BigNumber(principalPrice.toString())
-      .times(new BigNumber(amountToRepay.toString()).times(105))
-      .times(new BigNumber(10).pow(collateralDecimals))
-      .div(
-        new BigNumber(collateralPrice.toString()).times(new BigNumber(10).pow(principalDecimals))
-      )
-      .div(100)
-      .decimalPlaces(0, BigNumber.ROUND_DOWN);
-
-    const expectedVariableDebtIncrease = calcExpectedVariableDebtTokenBalance(
-      daiReserveDataBefore,
-      daiUserDataBefore,
-      new BigNumber(repayWithCollateralTimestamp)
-    ).minus(daiUserDataBefore.currentVariableDebt);
-
-    expect(daiUserDataAfter.currentVariableDebt).to.be.bignumber.almostEqual(
-      new BigNumber(daiUserDataBefore.currentVariableDebt)
-        .minus(amountToRepay.toString())
-        .plus(expectedVariableDebtIncrease)
-        .toString()
-    );
-
-    expect(wethUserDataAfter.currentATokenBalance).to.be.bignumber.equal(
-      new BigNumber(wethUserDataBefore.currentATokenBalance).minus(
-        expectedCollateralLiquidated.toString()
-      )
-    );
-
-    expect(wethUserDataAfter.usageAsCollateralEnabled).to.be.true;
-  });
-
-  it('User 3 deposits WETH and borrows USDC at Variable', async () => {
-    const {pool, weth, usdc, users} = testEnv;
-    const user = users[2];
-    const amountToDeposit = parseEther('10');
-    const amountToBorrow = parseUnits('40', 6);
-
-    await weth.connect(user.signer).mint(amountToDeposit);
-
-    await weth.connect(user.signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL);
-
-    await pool.connect(user.signer).deposit(weth.address, amountToDeposit, user.address, '0');
-
-    await pool.connect(user.signer).borrow(usdc.address, amountToBorrow, 2, 0, user.address);
-  });
-
-  it('User 3 repays completely his USDC loan by swapping his WETH collateral', async () => {
-    const {pool, weth, usdc, users, mockSwapAdapter, oracle, helpersContract} = testEnv;
-    const user = users[2];
-
-    const amountToRepay = parseUnits('10', 6);
-
-    const {userData: wethUserDataBefore} = await getContractsData(
-      weth.address,
-      user.address,
-      testEnv
-    );
-
-    const {
-      reserveData: usdcReserveDataBefore,
-      userData: usdcUserDataBefore,
-    } = await getContractsData(usdc.address, user.address, testEnv);
-
-    await mockSwapAdapter.setAmountToReturn(amountToRepay);
-    await waitForTx(
-      await pool
-        .connect(user.signer)
-        .repayWithCollateral(
-          weth.address,
-          usdc.address,
-          user.address,
-          amountToRepay,
-          mockSwapAdapter.address,
-          '0x'
-        )
-    );
-    const repayWithCollateralTimestamp = await timeLatest();
-
-    const {userData: wethUserDataAfter} = await getContractsData(
-      weth.address,
-      user.address,
-      testEnv
-    );
-
-    const {userData: usdcUserDataAfter} = await getContractsData(
-      usdc.address,
-      user.address,
-      testEnv
-    );
-
-    const collateralPrice = await oracle.getAssetPrice(weth.address);
-    const principalPrice = await oracle.getAssetPrice(usdc.address);
-
-    const collateralDecimals = (
-      await helpersContract.getReserveConfigurationData(weth.address)
-    ).decimals.toString();
-    const principalDecimals = (
-      await helpersContract.getReserveConfigurationData(usdc.address)
-    ).decimals.toString();
-
-    const expectedCollateralLiquidated = new BigNumber(principalPrice.toString())
-      .times(new BigNumber(amountToRepay.toString()).times(105))
-      .times(new BigNumber(10).pow(collateralDecimals))
-      .div(
-        new BigNumber(collateralPrice.toString()).times(new BigNumber(10).pow(principalDecimals))
-      )
-      .div(100)
-      .decimalPlaces(0, BigNumber.ROUND_DOWN);
-
-    const expectedVariableDebtIncrease = calcExpectedVariableDebtTokenBalance(
-      usdcReserveDataBefore,
-      usdcUserDataBefore,
-      new BigNumber(repayWithCollateralTimestamp)
-    ).minus(usdcUserDataBefore.currentVariableDebt);
-
-    expect(usdcUserDataAfter.currentVariableDebt).to.be.bignumber.almostEqual(
-      new BigNumber(usdcUserDataBefore.currentVariableDebt)
-        .minus(amountToRepay.toString())
-        .plus(expectedVariableDebtIncrease)
-        .toString(),
-      'INVALID_DEBT_POSITION'
-    );
-
-    expect(wethUserDataAfter.currentATokenBalance).to.be.bignumber.equal(
-      new BigNumber(wethUserDataBefore.currentATokenBalance).minus(
-        expectedCollateralLiquidated.toString()
-      ),
-      'INVALID_COLLATERAL_POSITION'
-    );
-
-    expect(wethUserDataAfter.usageAsCollateralEnabled).to.be.true;
-  });
-
-  it('Revert expected. User 3 tries to repay with his collateral a currency he havent borrow', async () => {
-    const {pool, weth, dai, users, mockSwapAdapter} = testEnv;
-    const user = users[2];
-
-    const amountToRepay = parseUnits('10', 6);
-
-    await expect(
-      pool
-        .connect(user.signer)
-        .repayWithCollateral(
-          weth.address,
-          dai.address,
-          user.address,
-          amountToRepay,
-          mockSwapAdapter.address,
-          '0x'
-        )
-    ).to.be.revertedWith('40');
-  });
-
-  it('User 3 tries to repay with his collateral all his variable debt and part of the stable', async () => {
-    const {pool, weth, usdc, users, mockSwapAdapter, oracle, helpersContract} = testEnv;
-    const user = users[2];
-
-    const amountToDeposit = parseEther('20');
-    const amountToBorrowStable = parseUnits('40', 6);
-    const amountToBorrowVariable = parseUnits('40', 6);
-
-    await weth.connect(user.signer).mint(amountToDeposit);
-
-    await pool.connect(user.signer).deposit(weth.address, amountToDeposit, user.address, '0');
-
-    await pool
-      .connect(user.signer)
-      .borrow(usdc.address, amountToBorrowVariable, 2, 0, user.address);
-
-    await pool.connect(user.signer).borrow(usdc.address, amountToBorrowStable, 1, 0, user.address);
-
-    const amountToRepay = parseUnits('80', 6);
-
-    const {userData: wethUserDataBefore} = await getContractsData(
-      weth.address,
-      user.address,
-      testEnv
-    );
-
-    const {
-      reserveData: usdcReserveDataBefore,
-      userData: usdcUserDataBefore,
-    } = await getContractsData(usdc.address, user.address, testEnv);
-
-    await mockSwapAdapter.setAmountToReturn(amountToRepay);
-    const txReceipt = await waitForTx(
-      await pool
-        .connect(user.signer)
-        .repayWithCollateral(
-          weth.address,
-          usdc.address,
-          user.address,
-          amountToRepay,
-          mockSwapAdapter.address,
-          '0x'
-        )
-    );
-    const repayWithCollateralTimestamp = await timeLatest();
-
-    const {userData: wethUserDataAfter} = await getContractsData(
-      weth.address,
-      user.address,
-      testEnv
-    );
-
-    const {userData: usdcUserDataAfter} = await getContractsData(
-      usdc.address,
-      user.address,
-      testEnv
-    );
-
-    const collateralPrice = await oracle.getAssetPrice(weth.address);
-    const principalPrice = await oracle.getAssetPrice(usdc.address);
-
-    const collateralDecimals = (
-      await helpersContract.getReserveConfigurationData(weth.address)
-    ).decimals.toString();
-    const principalDecimals = (
-      await helpersContract.getReserveConfigurationData(usdc.address)
-    ).decimals.toString();
-
-    const expectedCollateralLiquidated = new BigNumber(principalPrice.toString())
-      .times(new BigNumber(amountToRepay.toString()).times(105))
-      .times(new BigNumber(10).pow(collateralDecimals))
-      .div(
-        new BigNumber(collateralPrice.toString()).times(new BigNumber(10).pow(principalDecimals))
-      )
-      .div(100)
-      .decimalPlaces(0, BigNumber.ROUND_DOWN);
-
-    const expectedVariableDebtIncrease = calcExpectedVariableDebtTokenBalance(
-      usdcReserveDataBefore,
-      usdcUserDataBefore,
-      new BigNumber(repayWithCollateralTimestamp)
-    ).minus(usdcUserDataBefore.currentVariableDebt);
-
-    const expectedStableDebtIncrease = calcExpectedStableDebtTokenBalance(
-      usdcUserDataBefore.principalStableDebt,
-      usdcUserDataBefore.stableBorrowRate,
-      usdcUserDataBefore.stableRateLastUpdated,
-      new BigNumber(repayWithCollateralTimestamp)
-    ).minus(usdcUserDataBefore.currentStableDebt);
-
-    expect(usdcUserDataAfter.currentVariableDebt).to.be.bignumber.equal(
-      new BigNumber(usdcUserDataBefore.currentVariableDebt)
-        .minus(amountToRepay.toString())
-        .plus(expectedVariableDebtIncrease)
-        .gte(0)
-        ? new BigNumber(usdcUserDataBefore.currentVariableDebt)
-            .minus(amountToRepay.toString())
-            .plus(expectedVariableDebtIncrease)
-            .toString()
-        : '0',
-      'INVALID_VARIABLE_DEBT_POSITION'
-    );
-
-    const stableDebtRepaid = new BigNumber(usdcUserDataBefore.currentVariableDebt)
-      .minus(amountToRepay.toString())
-      .plus(expectedVariableDebtIncrease)
-      .abs();
-
-    expect(usdcUserDataAfter.currentStableDebt).to.be.bignumber.equal(
-      new BigNumber(usdcUserDataBefore.currentStableDebt)
-        .minus(stableDebtRepaid)
-        .plus(expectedStableDebtIncrease)
-        .gte(0)
-        ? new BigNumber(usdcUserDataBefore.currentStableDebt)
-            .minus(stableDebtRepaid)
-            .plus(expectedStableDebtIncrease)
-            .toString()
-        : '0',
-      'INVALID_STABLE_DEBT_POSITION'
-    );
-
-    expect(wethUserDataAfter.currentATokenBalance).to.be.bignumber.equal(
-      new BigNumber(wethUserDataBefore.currentATokenBalance).minus(
-        expectedCollateralLiquidated.toString()
-      ),
-      'INVALID_COLLATERAL_POSITION'
-    );
-
-    const eventsEmitted = txReceipt.events || [];
-
-    expectRepayWithCollateralEvent(
-      eventsEmitted,
-      pool.address,
-      weth.address,
-      usdc.address,
-      user.address
-    );
-
-    expect(wethUserDataAfter.usageAsCollateralEnabled).to.be.true;
-  });
-
-  it('User 4 tries to repay a bigger amount that what can be swapped of a particular collateral, repaying only the maximum allowed by that collateral', async () => {
-    const {pool, weth, dai, users, mockSwapAdapter, oracle, helpersContract} = testEnv;
-    const user = users[3];
-
-    const amountToDepositWeth = parseEther('0.1');
-    const amountToDepositDAI = parseEther('500');
-    const amountToBorrowVariable = parseEther('80');
-
-    await weth.connect(user.signer).mint(amountToDepositWeth);
-    await dai.connect(user.signer).mint(amountToDepositDAI);
-    await weth.connect(user.signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL);
-    await dai.connect(user.signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL);
-
-    await pool.connect(user.signer).deposit(weth.address, amountToDepositWeth, user.address, '0');
-    await pool.connect(user.signer).deposit(dai.address, amountToDepositDAI, user.address, '0');
-
-    await pool.connect(user.signer).borrow(dai.address, amountToBorrowVariable, 2, 0, user.address);
-
-    const amountToRepay = parseEther('80');
-
-    const {userData: wethUserDataBefore} = await getContractsData(
-      weth.address,
-      user.address,
-      testEnv
-    );
-
-    const {reserveData: daiReserveDataBefore, userData: daiUserDataBefore} = await getContractsData(
-      dai.address,
-      user.address,
-      testEnv
-    );
-
-    await mockSwapAdapter.setAmountToReturn(amountToRepay);
-    await waitForTx(
-      await pool
-        .connect(user.signer)
-        .repayWithCollateral(
-          weth.address,
-          dai.address,
-          user.address,
-          amountToRepay,
-          mockSwapAdapter.address,
-          '0x'
-        )
-    );
-    const repayWithCollateralTimestamp = await timeLatest();
-
-    const {userData: wethUserDataAfter} = await getContractsData(
-      weth.address,
-      user.address,
-      testEnv
-    );
-
-    const {userData: daiUserDataAfter} = await getContractsData(dai.address, user.address, testEnv);
-
-    const collateralPrice = await oracle.getAssetPrice(weth.address);
-    const principalPrice = await oracle.getAssetPrice(dai.address);
-
-    const collateralConfig = await helpersContract.getReserveConfigurationData(weth.address);
-
-    const collateralDecimals = collateralConfig.decimals.toString();
-    const collateralLiquidationBonus = collateralConfig.liquidationBonus.toString();
-
-    const principalDecimals = (
-      await helpersContract.getReserveConfigurationData(dai.address)
-    ).decimals.toString();
-
-    const expectedDebtCovered = new BigNumber(collateralPrice.toString())
-      .times(new BigNumber(wethUserDataBefore.currentATokenBalance.toString()))
-      .times(new BigNumber(10).pow(principalDecimals))
-      .div(
-        new BigNumber(principalPrice.toString()).times(new BigNumber(10).pow(collateralDecimals))
-      )
-      .div(new BigNumber(collateralLiquidationBonus).div(10000).toString())
-      .decimalPlaces(0, BigNumber.ROUND_DOWN);
-
-    const expectedVariableDebtIncrease = calcExpectedVariableDebtTokenBalance(
-      daiReserveDataBefore,
-      daiUserDataBefore,
-      new BigNumber(repayWithCollateralTimestamp)
-    ).minus(daiUserDataBefore.currentVariableDebt);
-
-    expect(daiUserDataAfter.currentVariableDebt).to.be.bignumber.almostEqual(
-      new BigNumber(daiUserDataBefore.currentVariableDebt)
-        .minus(expectedDebtCovered.toString())
-        .plus(expectedVariableDebtIncrease),
-      'INVALID_VARIABLE_DEBT_POSITION'
-    );
-
-    expect(wethUserDataAfter.currentATokenBalance).to.be.bignumber.almostEqual(0);
-
-    expect(wethUserDataAfter.usageAsCollateralEnabled).to.be.false;
-  });
-
-  it('User 5 deposits WETH and DAI, then borrows USDC at Variable, then disables WETH as collateral', async () => {
-    const {pool, weth, dai, usdc, users} = testEnv;
-    const user = users[4];
-    const amountWETHToDeposit = parseEther('10');
-    const amountDAIToDeposit = parseEther('120');
-    const amountToBorrow = parseUnits('65', 6);
-
-    await weth.connect(user.signer).mint(amountWETHToDeposit);
-    await weth.connect(user.signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL);
-    await pool.connect(user.signer).deposit(weth.address, amountWETHToDeposit, user.address, '0');
-
-    await dai.connect(user.signer).mint(amountDAIToDeposit);
-    await dai.connect(user.signer).approve(pool.address, APPROVAL_AMOUNT_LENDING_POOL);
-    await pool.connect(user.signer).deposit(dai.address, amountDAIToDeposit, user.address, '0');
-
-    await pool.connect(user.signer).borrow(usdc.address, amountToBorrow, 2, 0, user.address);
-  });
-
-  it('User 5 tries to repay his USDC loan by swapping his WETH collateral, should not revert even with WETH collateral disabled', async () => {
-    const {pool, weth, usdc, users, mockSwapAdapter, oracle, helpersContract} = testEnv;
-    const user = users[4];
-
-    const amountToRepay = parseUnits('65', 6);
-
-    // Disable WETH as collateral
-    await pool.connect(user.signer).setUserUseReserveAsCollateral(weth.address, false);
-
-    const {userData: wethUserDataBefore} = await getContractsData(
-      weth.address,
-      user.address,
-      testEnv
-    );
-
-    const {
-      reserveData: usdcReserveDataBefore,
-      userData: usdcUserDataBefore,
-    } = await getContractsData(usdc.address, user.address, testEnv);
-
-    expect(wethUserDataBefore.usageAsCollateralEnabled).to.be.false;
-
-    // User 5 should be able to liquidate himself with WETH, even if is disabled
-    await mockSwapAdapter.setAmountToReturn(amountToRepay);
-    expect(
-      await pool
-        .connect(user.signer)
-        .repayWithCollateral(
-          weth.address,
-          usdc.address,
-          user.address,
-          amountToRepay,
-          mockSwapAdapter.address,
-          '0x'
-        )
-    );
-    const repayWithCollateralTimestamp = await timeLatest();
-
-    const {userData: wethUserDataAfter} = await getContractsData(
-      weth.address,
-      user.address,
-      testEnv
-    );
-
-    const {userData: usdcUserDataAfter} = await getContractsData(
-      usdc.address,
-      user.address,
-      testEnv
-    );
-
-    const collateralPrice = await oracle.getAssetPrice(weth.address);
-    const principalPrice = await oracle.getAssetPrice(usdc.address);
-
-    const collateralDecimals = (
-      await helpersContract.getReserveConfigurationData(weth.address)
-    ).decimals.toString();
-    const principalDecimals = (
-      await helpersContract.getReserveConfigurationData(usdc.address)
-    ).decimals.toString();
-
-    const expectedCollateralLiquidated = new BigNumber(principalPrice.toString())
-      .times(new BigNumber(amountToRepay.toString()).times(105))
-      .times(new BigNumber(10).pow(collateralDecimals))
-      .div(
-        new BigNumber(collateralPrice.toString()).times(new BigNumber(10).pow(principalDecimals))
-      )
-      .div(100)
-      .decimalPlaces(0, BigNumber.ROUND_DOWN);
-
-    const expectedVariableDebtIncrease = calcExpectedVariableDebtTokenBalance(
-      usdcReserveDataBefore,
-      usdcUserDataBefore,
-      new BigNumber(repayWithCollateralTimestamp)
-    ).minus(usdcUserDataBefore.currentVariableDebt);
-
-    expect(usdcUserDataAfter.currentVariableDebt).to.be.bignumber.almostEqual(
-      new BigNumber(usdcUserDataBefore.currentVariableDebt)
-        .minus(amountToRepay.toString())
-        .plus(expectedVariableDebtIncrease)
-        .toString(),
-      'INVALID_DEBT_POSITION'
-    );
-
-    expect(wethUserDataAfter.currentATokenBalance).to.be.bignumber.equal(
-      new BigNumber(wethUserDataBefore.currentATokenBalance).minus(
-        expectedCollateralLiquidated.toString()
-      ),
-      'INVALID_COLLATERAL_POSITION'
-    );
-
-    expect(wethUserDataAfter.usageAsCollateralEnabled).to.be.false;
-  });
-});

From d05a2d1c4fecb55c280a387340731ba11a51103b Mon Sep 17 00:00:00 2001
From: The3D <emilio@aave.com>
Date: Thu, 22 Oct 2020 18:59:15 +0200
Subject: [PATCH 08/13] Rolled back PVE002, added further optimization

---
 contracts/libraries/math/WadRayMath.sol |   32 +-
 deployed-contracts.json                 |   88 +-
 test.log                                | 3077 -----------------------
 3 files changed, 52 insertions(+), 3145 deletions(-)

diff --git a/contracts/libraries/math/WadRayMath.sol b/contracts/libraries/math/WadRayMath.sol
index c4001a71..949118c6 100644
--- a/contracts/libraries/math/WadRayMath.sol
+++ b/contracts/libraries/math/WadRayMath.sol
@@ -54,17 +54,13 @@ library WadRayMath {
    * @return the result of a*b, in wad
    **/
   function wadMul(uint256 a, uint256 b) internal pure returns (uint256) {
-    if (a == 0 || b == 0) {
+    if (a == 0) {
       return 0;
     }
 
-    uint256 result = a * b;
+    uint256 result = a * b + halfWAD;
 
-    require(result / a == b, Errors.MULTIPLICATION_OVERFLOW);
-
-    result += halfWAD;
-
-    require(result >= halfWAD, Errors.ADDITION_OVERFLOW);
+    require((result - halfWAD) / a == b, Errors.MULTIPLICATION_OVERFLOW);
 
     return result / WAD;
   }
@@ -102,17 +98,13 @@ library WadRayMath {
    * @return the result of a*b, in ray
    **/
   function rayMul(uint256 a, uint256 b) internal pure returns (uint256) {
-    if (a == 0 || b == 0) {
+    if (a == 0) {
       return 0;
     }
 
-    uint256 result = a * b;
+    uint256 result = a * b + halfRAY;
 
-    require(result / a == b, Errors.MULTIPLICATION_OVERFLOW);
-
-    result += halfRAY;
-
-    require(result >= halfRAY, Errors.ADDITION_OVERFLOW);
+    require((result - halfRAY) / a == b, Errors.MULTIPLICATION_OVERFLOW);
 
     return result / RAY;
   }
@@ -126,19 +118,11 @@ library WadRayMath {
   function rayDiv(uint256 a, uint256 b) internal pure returns (uint256) {
     require(b != 0, Errors.DIVISION_BY_ZERO);
 
-    if (a == 0) {
-      return 0;
-    }
-
     uint256 halfB = b / 2;
 
-    uint256 result = a * RAY;
+    uint256 result = a * RAY + halfB;
 
-    require(result / RAY == a, Errors.MULTIPLICATION_OVERFLOW);
-
-    result += halfB;
-
-    require(result >= halfB, Errors.ADDITION_OVERFLOW);
+    require((result - halfB) / RAY == a, Errors.MULTIPLICATION_OVERFLOW);
 
     return result / b;
   }
diff --git a/deployed-contracts.json b/deployed-contracts.json
index 46423910..92647298 100644
--- a/deployed-contracts.json
+++ b/deployed-contracts.json
@@ -5,7 +5,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x58F132FBB86E21545A4Bace3C19f1C05d86d7A22",
+      "address": "0xAA6DfC2A802857Fadb75726B6166484e2c011cf5",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -19,7 +19,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0xa4bcDF64Cdd5451b6ac3743B414124A6299B65FF",
+      "address": "0xFd23fD3d937ae73a7b545B8Bfeb218395bDe9b8f",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -37,7 +37,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x5A0773Ff307Bf7C71a832dBB5312237fD3437f9F",
+      "address": "0xE567BA007c79D491D585015c30c73BA7FfDAFaF0",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -73,7 +73,7 @@
       "address": "0x6642B57e4265BAD868C17Fc1d1F4F88DBBA04Aa8"
     },
     "localhost": {
-      "address": "0x65e0Cd5B8904A02f2e00BC6f58bf881998D54BDe"
+      "address": "0x81228BFb2fE916C0fF76bF4e12c165321BdF1CFB"
     },
     "kovan": {
       "address": "0x50C9d3aD9399c1EEf6DDeadF8e57fF69994F552e"
@@ -89,7 +89,7 @@
       "address": "0xD9273d497eDBC967F39d419461CfcF382a0A822e"
     },
     "localhost": {
-      "address": "0x5d12dDe3286D94E0d85F9D3B01B7099cfA0aBCf1"
+      "address": "0xE2302ab9A6754EfaA8Ea55eECA668bCE72d8a4FE"
     },
     "kovan": {
       "address": "0x6d1e69bB0578699dd955Eefbf23aAC65c0DA5cE7"
@@ -101,7 +101,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x1750499D05Ed1674d822430FB960d5F6731fDf64",
+      "address": "0x8720da7Bc69d35800937CD0CB2a88517Ab681a34",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -115,7 +115,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0xEC1C93A9f6a9e18E97784c76aC52053587FcDB89",
+      "address": "0x3F1976472C22fb2bC05Ff74CF3d03E52b0FDD6b8",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -129,7 +129,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x7B6C3e5486D9e6959441ab554A889099eed76290",
+      "address": "0x804E98F470694629b5005b3B8f092B0188B2A770",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -147,7 +147,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0xD83D2773a7873ae2b5f8Fb92097e20a8C64F691E",
+      "address": "0xdaE51d2e6C77C5EC035Ab3B2a8eEF552F74035d0",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -165,7 +165,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x626FdE749F9d499d3777320CAf29484B624ab84a",
+      "address": "0x4e92ed34740Ef54325D0382BeA1F433374e92593",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -223,7 +223,7 @@
       "address": "0xBEF0d4b9c089a5883741fC14cbA352055f35DDA2"
     },
     "localhost": {
-      "address": "0x2B681757d757fbB80cc51c6094cEF5eE75bF55aA"
+      "address": "0xaFc2D7E7f6915c053E257200D10BF53daCD37206"
     },
     "coverage": {
       "address": "0x2B681757d757fbB80cc51c6094cEF5eE75bF55aA"
@@ -235,7 +235,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0xDf73fC454FA018051D4a1509e63D11530A59DE10",
+      "address": "0x917873BDf56b8404b984e1D0946A9791fB8723ff",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -249,7 +249,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x7c2C195CD6D34B8F845992d380aADB2730bB9C6F",
+      "address": "0xda8D610DBF58CdbBd9FF63Cfd5d152d6aC03D827",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -263,7 +263,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x8858eeB3DfffA017D4BCE9801D340D36Cf895CCf",
+      "address": "0x230063F7a99684eCB09C0100B46e4ef52F790787",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -277,7 +277,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x0078371BDeDE8aAc7DeBfFf451B74c5EDB385Af7",
+      "address": "0x9357981b57000D78aE088D85D8B93aabd971E44c",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -291,7 +291,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0xf4e77E5Da47AC3125140c470c71cBca77B5c638c",
+      "address": "0x347aB2276e45528d0869d98454dB85d0353289cc",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -305,7 +305,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x3619DbE27d7c1e7E91aA738697Ae7Bc5FC3eACA5",
+      "address": "0x2120a59e1800077C8dd0a60bB36315282d3AD73d",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -319,7 +319,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x038B86d9d8FAFdd0a02ebd1A476432877b0107C8",
+      "address": "0xAD8b260d4a55fa27D9611E32029b74CE4fBb43B7",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -333,7 +333,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x1A1FEe7EeD918BD762173e4dc5EfDB8a78C924A8",
+      "address": "0x15556f286eA3dc789b31d71058F236d3f84a8CdC",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -347,7 +347,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x500D1d6A4c7D8Ae28240b47c8FCde034D827fD5e",
+      "address": "0xc1D388F1b4a9448cC88249020D3Bb82588496aDD",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -361,7 +361,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0xc4905364b78a742ccce7B890A89514061E47068D",
+      "address": "0x8AA4ef0B7069333d32e1a301c3e8867050Ce7dd4",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -375,7 +375,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0xD6C850aeBFDC46D7F4c207e445cC0d6B0919BDBe",
+      "address": "0xFB2DB49aEfdfb4A1443D369F9707BF07EC200609",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -389,7 +389,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x8B5B7a6055E54a36fF574bbE40cf2eA68d5554b3",
+      "address": "0x231926CDdAf87b45382127E83b371D81dd3071dE",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -403,7 +403,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0xEcc0a6dbC0bb4D51E4F84A315a9e5B0438cAD4f0",
+      "address": "0x3DBE70A3bE31C9Bd7EeE42F2d89e6D8BdbB60d9D",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -417,7 +417,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x20Ce94F404343aD2752A2D01b43fa407db9E0D00",
+      "address": "0x17CcC196687feD7693580e5C327C16623c1422aA",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -431,7 +431,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x1d80315fac6aBd3EfeEbE97dEc44461ba7556160",
+      "address": "0xa3C9636e8A83e9A20F17d6101D8f5fC19cFa5cF1",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -445,7 +445,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x2D8553F9ddA85A9B3259F6Bf26911364B85556F5",
+      "address": "0x7b3e185D7Dd72CB6a8e4f3b77f2afa9cc2986702",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -459,7 +459,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x52d3b94181f8654db2530b0fEe1B19173f519C52",
+      "address": "0x582e9540A4FCA6aF23543D10e274bFfC6A1C4bd0",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -473,7 +473,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0xd15468525c35BDBC1eD8F2e09A00F8a173437f2f",
+      "address": "0x1380773F68a96A09181551658ae1F23EA5298339",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -487,7 +487,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x7e35Eaf7e8FBd7887ad538D4A38Df5BbD073814a",
+      "address": "0x0E512D4c480168bB354F9D70EfEe4c2779757Dc7",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -501,7 +501,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x5bcb88A0d20426e451332eE6C4324b0e663c50E0",
+      "address": "0x77607B1E8f05c2D80Ad209368F9d812a79E89D0a",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -515,7 +515,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x3521eF8AaB0323004A6dD8b03CE890F4Ea3A13f5",
+      "address": "0x86089a044275B66A8C01D31B5e234a2c4099DCcA",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -529,7 +529,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x53369fd4680FfE3DfF39Fc6DDa9CfbfD43daeA2E",
+      "address": "0x7B49a4DA95c3d8e3a308D9d550fd735285D2445b",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -543,7 +543,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0xB00cC45B4a7d3e1FEE684cFc4417998A1c183e6d",
+      "address": "0xE3e60d4513d7A63a5C4EE91df71e92cfDd97ac89",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -557,7 +557,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x58F132FBB86E21545A4Bace3C19f1C05d86d7A22",
+      "address": "0xAA6DfC2A802857Fadb75726B6166484e2c011cf5",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -570,7 +570,7 @@
       "address": "0xe7536f450378748E1BD4645D3c77ec38e0F3ba28"
     },
     "localhost": {
-      "address": "0x2cfcA5785261fbC88EFFDd46fCFc04c22525F9e4"
+      "address": "0xAD4EA7747fF8C3ea98009B016280d3E5A93B71e4"
     },
     "coverage": {
       "address": "0x2cfcA5785261fbC88EFFDd46fCFc04c22525F9e4"
@@ -582,7 +582,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0xB660Fdd109a95718cB9d20E3A89EE6cE342aDcB6",
+      "address": "0xc59Ff5B5Ed3F1aEF6e37ec21B5BfFA21bD7fb2D9",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -596,7 +596,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x830bceA96E56DBC1F8578f75fBaC0AF16B32A07d",
+      "address": "0xB6a7e0831d309e3dA99A4D169f0074910f047Dae",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -606,7 +606,7 @@
   },
   "AToken": {
     "localhost": {
-      "address": "0xA0AB1cB92A4AF81f84dCd258155B5c25D247b54E",
+      "address": "0x094D1D9DbA786f0cb1269e5Ddb3EfeB0d12d20c5",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "buidlerevm": {
@@ -624,7 +624,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0xa89E20284Bd638F31b0011D0fC754Fc9d2fa73e3",
+      "address": "0x5DbA865405aAEFe5bf9b77a877EA3956C92E309b",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -638,7 +638,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0xf784709d2317D872237C4bC22f867d1BAe2913AB",
+      "address": "0xdA43fC20d88c77FdebE172b960f8eb1853a0A46F",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -652,7 +652,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0xaA935993065F2dDB1d13623B1941C7AEE3A60F23",
+      "address": "0x7AE7D25Ce30A48FED0bf4A5e86B46829EA73C69a",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -666,7 +666,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x35A2624888e207e4B3434E9a9E250bF6Ee68FeA3",
+      "address": "0x031F94d0E0B894aa4458E3d34ceA141103641CDC",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "coverage": {
@@ -682,7 +682,7 @@
       "address": "0xBEF0d4b9c089a5883741fC14cbA352055f35DDA2"
     },
     "localhost": {
-      "address": "0xBEF0d4b9c089a5883741fC14cbA352055f35DDA2"
+      "address": "0x48AbD2dBBbaA7466313963ea17804B3cBC2cA71f"
     }
   },
   "MockFlashRepayAdapter": {
diff --git a/test.log b/test.log
index ca8c215e..e69de29b 100644
--- a/test.log
+++ b/test.log
@@ -1,3077 +0,0 @@
-Compiling...
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Compiled 76 contracts successfully
-
--> Deploying test environment...
-*** MintableERC20 ***
-
-Network: localhost
-tx: 0x7fa031db361a2b22addc1542eb9dca3b16ddce863e1b52294c94ec3cf9ce1a82
-contract address: 0xbe66dC9DFEe580ED968403e35dF7b5159f873df8
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3770435
-
-******
-
-*** DAI ***
-
-Network: localhost
-tx: 0x7fa031db361a2b22addc1542eb9dca3b16ddce863e1b52294c94ec3cf9ce1a82
-contract address: 0xbe66dC9DFEe580ED968403e35dF7b5159f873df8
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3770435
-
-******
-
-*** MintableERC20 ***
-
-Network: localhost
-tx: 0xbfedacf9ef4b74c7e64c1b5cbb30142abcb758d2f75ebfb7afcbd8f64e985b8c
-contract address: 0x93AfC6Df4bB8F62F2493B19e577f8382c0BA9EBC
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3770555
-
-******
-
-*** LEND ***
-
-Network: localhost
-tx: 0xbfedacf9ef4b74c7e64c1b5cbb30142abcb758d2f75ebfb7afcbd8f64e985b8c
-contract address: 0x93AfC6Df4bB8F62F2493B19e577f8382c0BA9EBC
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3770555
-
-******
-
-*** MintableERC20 ***
-
-Network: localhost
-tx: 0x77fb425d1e7d898c3d9ef846acd4541625fa0b69caeb1c73a45e81925fa965a4
-contract address: 0x75Ded61646B5945BdDd0CD9a9Db7c8288DA6F810
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3770555
-
-******
-
-*** TUSD ***
-
-Network: localhost
-tx: 0x77fb425d1e7d898c3d9ef846acd4541625fa0b69caeb1c73a45e81925fa965a4
-contract address: 0x75Ded61646B5945BdDd0CD9a9Db7c8288DA6F810
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3770555
-
-******
-
-*** MintableERC20 ***
-
-Network: localhost
-tx: 0x9279772c3bd0cc7ff7229fac6a46e2a19c46ddd507d15026d758b77f8a9d1934
-contract address: 0xdE7c40e675bF1aA45c18cCbaEb9662B16b0Ddf7E
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3770435
-
-******
-
-*** BAT ***
-
-Network: localhost
-tx: 0x9279772c3bd0cc7ff7229fac6a46e2a19c46ddd507d15026d758b77f8a9d1934
-contract address: 0xdE7c40e675bF1aA45c18cCbaEb9662B16b0Ddf7E
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3770435
-
-******
-
-*** MintableERC20 ***
-
-Network: localhost
-tx: 0x6e201e503500ae5ee3b900a7a0970085b2d03e5702c1192ca07cb228d3dde9a9
-contract address: 0xEcb928A3c079a1696Aa5244779eEc3dE1717fACd
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3770555
-
-******
-
-*** WETH ***
-
-Network: localhost
-tx: 0x6e201e503500ae5ee3b900a7a0970085b2d03e5702c1192ca07cb228d3dde9a9
-contract address: 0xEcb928A3c079a1696Aa5244779eEc3dE1717fACd
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3770555
-
-******
-
-*** MintableERC20 ***
-
-Network: localhost
-tx: 0x8a2b86528542d7500abbb9af3712b6e2d93a70dccff69ad5fbcc74973be2f0c3
-contract address: 0xDFbeeed692AA81E7f86E72F7ACbEA2A1C4d63544
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3770555
-
-******
-
-*** USDC ***
-
-Network: localhost
-tx: 0x8a2b86528542d7500abbb9af3712b6e2d93a70dccff69ad5fbcc74973be2f0c3
-contract address: 0xDFbeeed692AA81E7f86E72F7ACbEA2A1C4d63544
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3770555
-
-******
-
-*** MintableERC20 ***
-
-Network: localhost
-tx: 0x759e5c27217595d2b42a14cabfd3fd66bdfe03d8c1976ffed978e3ddaa37bcba
-contract address: 0x5191aA68c7dB195181Dd2441dBE23A48EA24b040
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3770555
-
-******
-
-*** USDT ***
-
-Network: localhost
-tx: 0x759e5c27217595d2b42a14cabfd3fd66bdfe03d8c1976ffed978e3ddaa37bcba
-contract address: 0x5191aA68c7dB195181Dd2441dBE23A48EA24b040
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3770555
-
-******
-
-*** MintableERC20 ***
-
-Network: localhost
-tx: 0x5ea082d2b1c31d832663b08ac1d7ad4190415a8ea5b4994b406a793a2e3b9f06
-contract address: 0x8F9422aa37215c8b3D1Ea1674138107F84D68F26
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3770555
-
-******
-
-*** SUSD ***
-
-Network: localhost
-tx: 0x5ea082d2b1c31d832663b08ac1d7ad4190415a8ea5b4994b406a793a2e3b9f06
-contract address: 0x8F9422aa37215c8b3D1Ea1674138107F84D68F26
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3770555
-
-******
-
-*** MintableERC20 ***
-
-Network: localhost
-tx: 0xd44e0f48e38f7c216be9a16449efedfb231d7430a1c0fc3f8bcffdf7948ccfcf
-contract address: 0xa89E20284Bd638F31b0011D0fC754Fc9d2fa73e3
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3770435
-
-******
-
-*** ZRX ***
-
-Network: localhost
-tx: 0xd44e0f48e38f7c216be9a16449efedfb231d7430a1c0fc3f8bcffdf7948ccfcf
-contract address: 0xa89E20284Bd638F31b0011D0fC754Fc9d2fa73e3
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3770435
-
-******
-
-*** MintableERC20 ***
-
-Network: localhost
-tx: 0x239d5b4ae02e9b51640fc4b37e76d04e5a8d4d89583046744365d5c986a2b03e
-contract address: 0xaA935993065F2dDB1d13623B1941C7AEE3A60F23
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3770435
-
-******
-
-*** MKR ***
-
-Network: localhost
-tx: 0x239d5b4ae02e9b51640fc4b37e76d04e5a8d4d89583046744365d5c986a2b03e
-contract address: 0xaA935993065F2dDB1d13623B1941C7AEE3A60F23
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3770435
-
-******
-
-*** MintableERC20 ***
-
-Network: localhost
-tx: 0xf04a9569ae24444f812d6e27087a159b9f2d8efd6af87530cb84dee7be87eb60
-contract address: 0x35A2624888e207e4B3434E9a9E250bF6Ee68FeA3
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3770555
-
-******
-
-*** WBTC ***
-
-Network: localhost
-tx: 0xf04a9569ae24444f812d6e27087a159b9f2d8efd6af87530cb84dee7be87eb60
-contract address: 0x35A2624888e207e4B3434E9a9E250bF6Ee68FeA3
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3770555
-
-******
-
-*** MintableERC20 ***
-
-Network: localhost
-tx: 0xd14a76002a7764f1942b286cdbd83a6c31c963a6536c11e245dd844c80bf2423
-contract address: 0x1f569c307949a908A4b8Ff7453a88Ca0b8D8df13
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3770555
-
-******
-
-*** LINK ***
-
-Network: localhost
-tx: 0xd14a76002a7764f1942b286cdbd83a6c31c963a6536c11e245dd844c80bf2423
-contract address: 0x1f569c307949a908A4b8Ff7453a88Ca0b8D8df13
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3770555
-
-******
-
-*** MintableERC20 ***
-
-Network: localhost
-tx: 0x3eff7433edc5c39c2f4023a61518e744c4b551fc459f9a7b6ab1ca549b779895
-contract address: 0x4301cb254CCc126B9eb9cbBE030C6FDA2FA16D4a
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3770435
-
-******
-
-*** KNC ***
-
-Network: localhost
-tx: 0x3eff7433edc5c39c2f4023a61518e744c4b551fc459f9a7b6ab1ca549b779895
-contract address: 0x4301cb254CCc126B9eb9cbBE030C6FDA2FA16D4a
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3770435
-
-******
-
-*** MintableERC20 ***
-
-Network: localhost
-tx: 0x264fbe1fd2c4bd18b3e256411d085b30f34386ae6a4566a0b2f0d0c04e6bec88
-contract address: 0x0766c9592a8686CAB0081b4f35449462c6e82F11
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3770555
-
-******
-
-*** MANA ***
-
-Network: localhost
-tx: 0x264fbe1fd2c4bd18b3e256411d085b30f34386ae6a4566a0b2f0d0c04e6bec88
-contract address: 0x0766c9592a8686CAB0081b4f35449462c6e82F11
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3770555
-
-******
-
-*** MintableERC20 ***
-
-Network: localhost
-tx: 0xf7f19edbb06b36151a13ed1730693bda0470274d911b3017bb05a6e17959ba80
-contract address: 0xaF6D34adD35E1A565be4539E4d1069c48A49C953
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3770435
-
-******
-
-*** REP ***
-
-Network: localhost
-tx: 0xf7f19edbb06b36151a13ed1730693bda0470274d911b3017bb05a6e17959ba80
-contract address: 0xaF6D34adD35E1A565be4539E4d1069c48A49C953
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3770435
-
-******
-
-*** MintableERC20 ***
-
-Network: localhost
-tx: 0x609c4f2e84f0f979bed72c3fabc665e49917afc02cccd616223eaaa597a0064c
-contract address: 0x48bb3E35D2D6994374db457a6Bf61de2d9cC8E49
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3770435
-
-******
-
-*** SNX ***
-
-Network: localhost
-tx: 0x609c4f2e84f0f979bed72c3fabc665e49917afc02cccd616223eaaa597a0064c
-contract address: 0x48bb3E35D2D6994374db457a6Bf61de2d9cC8E49
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3770435
-
-******
-
-*** MintableERC20 ***
-
-Network: localhost
-tx: 0xdaa890cf86da34cfd100482d0245d86acb9521c435fb6b6606dd5af05be05b0e
-contract address: 0x1E59BA56B1F61c3Ee946D8c7e2994B4A9b0cA45C
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3770555
-
-******
-
-*** BUSD ***
-
-Network: localhost
-tx: 0xdaa890cf86da34cfd100482d0245d86acb9521c435fb6b6606dd5af05be05b0e
-contract address: 0x1E59BA56B1F61c3Ee946D8c7e2994B4A9b0cA45C
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3770555
-
-******
-
-*** MintableERC20 ***
-
-Network: localhost
-tx: 0x34072a8a7ddff91366675c0443c6ed4a56f4ea38284d959ba5cac87d9176559d
-contract address: 0x53813198c75959DDB604462831d8989C29152164
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3770435
-
-******
-
-*** USD ***
-
-Network: localhost
-tx: 0x34072a8a7ddff91366675c0443c6ed4a56f4ea38284d959ba5cac87d9176559d
-contract address: 0x53813198c75959DDB604462831d8989C29152164
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3770435
-
-******
-
-*** MintableERC20 ***
-
-Network: localhost
-tx: 0xd9d0b27927d9ea1d6e01a0b3ab30ad5fff8b1fee863170c0e09bba3164473c86
-contract address: 0x0eD6115873ce6B807a03FE0df1f940387779b729
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3771395
-
-******
-
-*** UNI_DAI_ETH ***
-
-Network: localhost
-tx: 0xd9d0b27927d9ea1d6e01a0b3ab30ad5fff8b1fee863170c0e09bba3164473c86
-contract address: 0x0eD6115873ce6B807a03FE0df1f940387779b729
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3771395
-
-******
-
-*** MintableERC20 ***
-
-Network: localhost
-tx: 0x7108f6a2b5d09c345cef81faed01768eebc82e88cfca411f19ff89d67f39d155
-contract address: 0xFFfDa24e7E3d5F89a24278f53d6f0F81B3bE0d6B
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3771515
-
-******
-
-*** UNI_USDC_ETH ***
-
-Network: localhost
-tx: 0x7108f6a2b5d09c345cef81faed01768eebc82e88cfca411f19ff89d67f39d155
-contract address: 0xFFfDa24e7E3d5F89a24278f53d6f0F81B3bE0d6B
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3771515
-
-******
-
-*** MintableERC20 ***
-
-Network: localhost
-tx: 0x711140cdc325fa89a8fc7c57d40398135dbafbb8386a9714ac9406c097d7f5e1
-contract address: 0x5889354f21A1C8D8D2f82669d778f6Dab778B519
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3771515
-
-******
-
-*** UNI_SETH_ETH ***
-
-Network: localhost
-tx: 0x711140cdc325fa89a8fc7c57d40398135dbafbb8386a9714ac9406c097d7f5e1
-contract address: 0x5889354f21A1C8D8D2f82669d778f6Dab778B519
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3771515
-
-******
-
-*** MintableERC20 ***
-
-Network: localhost
-tx: 0x96e564062931f9f5b4dfec6ff64447d1413db8b199f777e40ef49b6f4cf74e42
-contract address: 0x09F7bF33B3F8922268B34103af3a8AF83148C9B1
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3771515
-
-******
-
-*** UNI_LINK_ETH ***
-
-Network: localhost
-tx: 0x96e564062931f9f5b4dfec6ff64447d1413db8b199f777e40ef49b6f4cf74e42
-contract address: 0x09F7bF33B3F8922268B34103af3a8AF83148C9B1
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3771515
-
-******
-
-*** MintableERC20 ***
-
-Network: localhost
-tx: 0x7e85b4e591d15586638a15aa1585d01b53792cffbb9e88f2858e86c401eb3563
-contract address: 0x8f3966F7d53Fd5f12b701C8835e1e32541613869
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3771395
-
-******
-
-*** UNI_MKR_ETH ***
-
-Network: localhost
-tx: 0x7e85b4e591d15586638a15aa1585d01b53792cffbb9e88f2858e86c401eb3563
-contract address: 0x8f3966F7d53Fd5f12b701C8835e1e32541613869
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3771395
-
-******
-
-*** MintableERC20 ***
-
-Network: localhost
-tx: 0x3a490bd7d0486d2de64b06bdfe5cbc71cf68360015175f695f765ffbdaa0db73
-contract address: 0x9Dc554694756dC303a087e04bA6918C333Bc26a7
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3771515
-
-******
-
-*** UNI_LEND_ETH ***
-
-Network: localhost
-tx: 0x3a490bd7d0486d2de64b06bdfe5cbc71cf68360015175f695f765ffbdaa0db73
-contract address: 0x9Dc554694756dC303a087e04bA6918C333Bc26a7
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3771515
-
-******
-
-*** LendingPoolAddressesProvider ***
-
-Network: localhost
-tx: 0xe9232d3aec0076f72b4dece0ec89cbc78a8373e4abf5561b0a5008887622851b
-contract address: 0xAfC307938C1c0035942c141c31524504c89Aaa8B
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 6959345
-
-******
-
-*** LendingPoolAddressesProviderRegistry ***
-
-Network: localhost
-tx: 0x3e67f200a858db6eb7fb8e1fd5939782b89d45fd82e40900fdf16d11da8e2d1b
-contract address: 0x73DE1e0ab6A5C221258703bc546E0CAAcCc6EC87
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 2515695
-
-******
-
-Deployed lending pool, address: 0xD2720591186c6DCf1DaCE6FAF262f3eB595317C5
-Added pool to addresses provider
-Address is  0x5d12dDe3286D94E0d85F9D3B01B7099cfA0aBCf1
-implementation set, address: 0x5d12dDe3286D94E0d85F9D3B01B7099cfA0aBCf1
-*** LendingPoolConfigurator ***
-
-Network: localhost
-tx: 0xf708c6f21e3ea0ce6d809ecc76fbf2682b9bb398681aebb58942712dfc5fdc01
-contract address: 0xa7a62540B8F2a0C1e091e734E261d13fd9a2B226
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 9499999
-
-******
-
-*** PriceOracle ***
-
-Network: localhost
-tx: 0x76a61118b12b1416a6a75626cf23450a5e9a00e561b99c992719e549e619f000
-contract address: 0xbeA90474c2F3C7c43bC7c36CaAf5272c927Af5a1
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 767525
-
-******
-
-*** MockAggregator ***
-
-Network: localhost
-tx: 0x0e04f73e5593e0ae08c773127c7659a847c7c9cfbbe870b5b8169807ab7390d9
-contract address: 0xa191baa1E96FeFE2b700C536E245725F09717275
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 524490
-
-******
-
-*** MockAggregator ***
-
-Network: localhost
-tx: 0x9240496d0be4193febdb3233ecdd21b90f3d2e93e76d814d5d541f6b16015ae8
-contract address: 0xbD51e397Aa5012aa91628f0354f9670805BfA94E
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 524430
-
-******
-
-*** MockAggregator ***
-
-Network: localhost
-tx: 0x5e8af233bf52b883a0c4e7a2dfbd962649954d8ef4ad3e6cffba9c966887a1e8
-contract address: 0xFc40e47aFD52bD460D65B06c828E54A13d288CE4
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 524430
-
-******
-
-*** MockAggregator ***
-
-Network: localhost
-tx: 0xaa3066730f7ebd39de215205a768145fd99e65157d871d0c640f79f2eaf440ad
-contract address: 0x5795a1e56931bB7Fb8389821f3574983502A785d
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 524430
-
-******
-
-*** MockAggregator ***
-
-Network: localhost
-tx: 0x8d9500b1f7bc9e00ebf25c25b81fb93603eca6a4ac1c6a23559873944ee873ca
-contract address: 0x715Ad5d800535dB0d334F9F42e3eC393947996e3
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 524490
-
-******
-
-*** MockAggregator ***
-
-Network: localhost
-tx: 0xe4019cc104e2ff38106e730db33f74a256d59327614b2f9c3f4dd847ec53ff0e
-contract address: 0xC452C5244F701108B4e8E8BCe693160046b30332
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 524490
-
-******
-
-*** MockAggregator ***
-
-Network: localhost
-tx: 0x5864636182a83ef038a4aa03551d9a1327ca7f6964e25b023bc32dc823000246
-contract address: 0x0B63c002cb44B2e5e580C3B3560a27F4101D95c0
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 524430
-
-******
-
-*** MockAggregator ***
-
-Network: localhost
-tx: 0x4c7e8f67718f9ef15d31e9527499897c6defbe50e91ccbf28d324e37f3936105
-contract address: 0x3F80d60280cc4AdF3e5891765b5545A6B36ebe57
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 524490
-
-******
-
-*** MockAggregator ***
-
-Network: localhost
-tx: 0xbbf4865f658e69a60041983d174c53c77d2132e6e498e64efe27434f03c3a911
-contract address: 0xCeB290A2C6614BF23B2faa0f0B8067F29C48DB0F
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 524430
-
-******
-
-*** MockAggregator ***
-
-Network: localhost
-tx: 0xfb956a1da74bf9ac7dd6daee9929a48bb6954730310a45d7a0e005dc7ff997ff
-contract address: 0x90ee8009AA6add17A0de8Ee22666a91602fa4adf
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 524430
-
-******
-
-*** MockAggregator ***
-
-Network: localhost
-tx: 0xcc9a2257abeaeecd6fa045901912802ade13c615974e0b22db1eaaf1a3ba1cf3
-contract address: 0xc5BeCE9e44E7dE5464f102f6cD4e5b7aBC94B059
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 524550
-
-******
-
-*** MockAggregator ***
-
-Network: localhost
-tx: 0x8e1d91a3cca76bb345ad3b61df570df661418dba282d4bc5a0e3879170ef8b9d
-contract address: 0xF63EA31f84CFF5D1Eb4b8C3ca0D9489490fB98d5
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 524430
-
-******
-
-*** MockAggregator ***
-
-Network: localhost
-tx: 0x63dc4fbb424450404f66b100c36cb33dd3e2efc1d73da8f386e8869ad1d68151
-contract address: 0xD8f534d97D241Fc9EC4A224C90BDD5E3F3990874
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 524370
-
-******
-
-*** MockAggregator ***
-
-Network: localhost
-tx: 0x82e4360e3ed1913609f51a2e80cee06aa9df2ebb9292f5f3abacf24aff0e686d
-contract address: 0xDCAB55FBf59a253B3Fb0CD2Ba45F0c02413dF375
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 524370
-
-******
-
-*** MockAggregator ***
-
-Network: localhost
-tx: 0xf1da3e37ee20e209ccdd756fa2e07a2be9d01bf7675dea41309a2a56ff96c9b5
-contract address: 0x293965D84cE150Cbf5F36332ba47e997e2763bf2
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 524430
-
-******
-
-*** MockAggregator ***
-
-Network: localhost
-tx: 0x8ae4fb0d23dec3b653f720bae0a4eb0538f17a88dde2d596b7e78928a121e076
-contract address: 0x3CADfB3f580F805658B747057E2Cf4E570bA378A
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 524430
-
-******
-
-*** MockAggregator ***
-
-Network: localhost
-tx: 0x01a1c77c94c1c43e927bf5090b25ec4826a32801cfa55fb0b97d2d50c04e2f0e
-contract address: 0x7549d6bb05083613eF87b723595553dCc570Ca21
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 524430
-
-******
-
-*** MockAggregator ***
-
-Network: localhost
-tx: 0xb240c91e88558e87d3be7b5c9c312c18eb3679144d2a0f3af8d7c1d053648cc4
-contract address: 0xd28bf46B340fD3ad0c3dBD979BbE6D1663F41D80
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 524430
-
-******
-
-*** MockAggregator ***
-
-Network: localhost
-tx: 0xfc87e10978edcdf0db0d9c5d5240e4db1d9e0567abe0a8047fe1f7ca28da2815
-contract address: 0xdd008b1A40e43ABD51C7Ba41c1F810aA77b77D22
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 524430
-
-******
-
-*** MockAggregator ***
-
-Network: localhost
-tx: 0xe5991391fac8afd904b94215614914404dd1acb81cb46c9a679c0adfff1894ef
-contract address: 0x23F06e0ECec7ecDb9cf204FAA35C284B51B31C0e
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 524430
-
-******
-
-*** MockAggregator ***
-
-Network: localhost
-tx: 0xaeb4931c1d026a8d162c2c019d5d4ac6d667f78b34c714fd56ffeb01c7ebed92
-contract address: 0x9e63e23026BfA85E2BCdb6e81eF78c71071b6016
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 524430
-
-******
-
-*** MockAggregator ***
-
-Network: localhost
-tx: 0x1bd7ec12d77551e8af98729fea7cfd251eb14641724b6a0216fb307af7cfa26a
-contract address: 0x4EfDBAb487985C09d3be2E7d2B8e98cc09A9757b
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 524430
-
-******
-
-*** MockAggregator ***
-
-Network: localhost
-tx: 0x84dd9d9906a51b08c845eba64c05e708064c351f17ae10a127efd6ff479cdf85
-contract address: 0xAbA65A243A64622eA13382160d410F269Cd63eC1
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 524430
-
-******
-
-*** MockAggregator ***
-
-Network: localhost
-tx: 0xa83c9fb3b2af5858ad72e5323e311bbeafde65b930ded1418006e4e660bf6f38
-contract address: 0x19E42cA990cF697D3dda0e59131215C43bB6989F
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 524430
-
-******
-
-*** ChainlinkProxyPriceProvider ***
-
-Network: localhost
-tx: 0x0d084d72f9d6b20a27654ff6612be6cd271b1d7f5442399e0d7872ec5a0a480d
-contract address: 0xE30c3983E51bC9d6baE3E9437710a1459e21e81F
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 6255480
-
-******
-
-*** LendingRateOracle ***
-
-Network: localhost
-tx: 0xff049fb48683766195e7de8b648f8a805bc1c76e12cfc8811dbc46b40308908e
-contract address: 0xDf69898e844197a24C658CcF9fD53dF15948dc8b
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 1720040
-
-******
-
-Initialize configuration
-*** DefaultReserveInterestRateStrategy ***
-
-Network: localhost
-tx: 0x7f2393d8b55ddd4f0bdf96dd1ae30cab9d26935db6bdfa9943ce54c69bfe3eaf
-contract address: 0x303CEAFd0aF91A63576FF7dEFc01E66ca2D19E3a
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3277425
-
-******
-
-*** StableDebtToken ***
-
-Network: localhost
-tx: 0xe4bacd3cf0bb45f3e03d8a99036b4a77bf70ac220ec8635d7be130c83805f2ca
-contract address: 0x168ef56fCb0382f4808497C9570434684657A9D3
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 7425490
-
-******
-
-*** VariableDebtToken ***
-
-Network: localhost
-tx: 0x1bd0700a586883870734011f942a2c0ec8af12431c2e4a20ed83f7127a319330
-contract address: 0x5366cD335B002b009304Dc74a21EC97e94510177
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 6936890
-
-******
-
-*** AToken ***
-
-Network: localhost
-tx: 0x97b28bbdc29f1bf73d223aac5ce6a3298175135ae0089d0189a1a6748c3b36ff
-contract address: 0x8821b8e3000629f2c43BB99A092f6687366592F0
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 9499999
-
-******
-
-*** DefaultReserveInterestRateStrategy ***
-
-Network: localhost
-tx: 0x696fd437c7b45c15abe1e7c35d71915e74c2f8ba5ce76fdafcc03a0b72e1e6b8
-contract address: 0x3E447b144e446558c2467d95FcF17Eaee9d704Bf
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3277425
-
-******
-
-*** StableDebtToken ***
-
-Network: localhost
-tx: 0xfe8ce2454ff8599e9c3bd21d1b4805b854875a1f1525abbe48b5bf7a1ed19f1b
-contract address: 0x6452dDB1f891be0426b6B519E461a777aeAe2E9d
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 7425610
-
-******
-
-*** VariableDebtToken ***
-
-Network: localhost
-tx: 0x24c25ca9ebb2588733588d07e05e6e74cd617c417296ac046c2d12fdc0b95e9d
-contract address: 0x6174769FBbC16D956a7bf70c3Ae7283341CAe3B6
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 6937010
-
-******
-
-*** AToken ***
-
-Network: localhost
-tx: 0x469a3347ec96fad195e41b5d62b21d2cf8ff0d603f0f2c62b0fada2ae09727a0
-contract address: 0x9e498c2dF52Efdd649140417E405B9DeedcfEbE1
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 9499999
-
-******
-
-*** DefaultReserveInterestRateStrategy ***
-
-Network: localhost
-tx: 0x2e78bf0b216139babb6e33aea0ffbe3e165124e551e4131664f9f0717cdd4f2a
-contract address: 0x184E5376484c2728e7A2cb4E7f2c1975f4a177dA
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3277425
-
-******
-
-*** StableDebtToken ***
-
-Network: localhost
-tx: 0xb40b0345dc8645ccd2de39cec597afa889d61d337c83d98402848e20650f0b57
-contract address: 0x23Fa899d0b780f2f439354DcdC325ff738d1234d
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 7425610
-
-******
-
-*** VariableDebtToken ***
-
-Network: localhost
-tx: 0x68079ed8c90d74997e59e47b4e99119f374f59793c5245e4a9254373042bbff3
-contract address: 0x398A7a447E4D9007Fa1A5F82F2D07F0B369bD26f
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 6937010
-
-******
-
-*** AToken ***
-
-Network: localhost
-tx: 0x297d99eb0ebb373ac4d6aedb1d973974aaaf398c2fb2cb9b7ad6c1a523078a5b
-contract address: 0xc9ffDd024B01AcE9B8ee692b85797593ddd25eBb
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 9499999
-
-******
-
-*** DefaultReserveInterestRateStrategy ***
-
-Network: localhost
-tx: 0x29d94602d60b38369651722227f15226632a76aeb8225b3e7c20761ed8935d4e
-contract address: 0x8A054E7463937F7bf914B2a0C6C1a9D7348f32d9
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3277425
-
-******
-
-*** StableDebtToken ***
-
-Network: localhost
-tx: 0x8e926fd7735088a84c0253e4c0fc852d56f7b875bf497014f296c054c9382d50
-contract address: 0x9cbEE5c0A6178F61dcD57C3b21180C8602aBdAc1
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 7425610
-
-******
-
-*** VariableDebtToken ***
-
-Network: localhost
-tx: 0x8713a3ce634d0280113197ed918c57ecb508ab053e8d6d562c9e54659abed5bc
-contract address: 0xdE00B3eb5e9F867eE45F9B9E5aF0d102Fe6A093f
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 6937010
-
-******
-
-*** AToken ***
-
-Network: localhost
-tx: 0x25e4771fd18e0bfbd9caabbba1c1ea0439705770362752945f567aec663aacea
-contract address: 0x3Eb52adc2294219C9A8F27C6a0BCcBBBEEeB0637
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 9499999
-
-******
-
-*** DefaultReserveInterestRateStrategy ***
-
-Network: localhost
-tx: 0x4ee8cad51cbfc07c56566826a77c12c07213bd5799200257bfcbbb5274654f9e
-contract address: 0x1b59Cd56B9D76CF3FFE0b8671164Fbe7ACA33164
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3277425
-
-******
-
-*** StableDebtToken ***
-
-Network: localhost
-tx: 0x48074d32ee1aa4263ffd99c906205b2cb211085ef64b6593b6c869e073feb20b
-contract address: 0xEC828976783079948F5DfAc8e61de6a895EB59D2
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 7425610
-
-******
-
-*** VariableDebtToken ***
-
-Network: localhost
-tx: 0x6082f47e348f616bf616739250d90c768d1638e599d52736942af94f093560a4
-contract address: 0xbA81aEa1F2b60dF39a96952FfbE121A0c82dc590
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 6937010
-
-******
-
-*** AToken ***
-
-Network: localhost
-tx: 0xd685996cbfaee73738b4435112642be71a62bd5150b7622060d29a5bc10e86a2
-contract address: 0xdB70141346347383D8e01c565E74b1a607f3Dd05
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 9499999
-
-******
-
-*** DefaultReserveInterestRateStrategy ***
-
-Network: localhost
-tx: 0x89c15e0f7e757ea6bb08a253ee7aeff7977641fc163e8063e15f714aa207f0cc
-contract address: 0x3597899d1c79b516D724b33c6b5e404dCdD45Da1
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3276945
-
-******
-
-*** StableDebtToken ***
-
-Network: localhost
-tx: 0x42a31cd5ec3a1a0616b2dcca2d6178f436454fc2ba7d4cd4c86daae9f0d8b724
-contract address: 0xc489495Ad73C2E75fbBA3916df7BD186F6b1696F
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 7425610
-
-******
-
-*** VariableDebtToken ***
-
-Network: localhost
-tx: 0x0213cc4f1faf661fdc368dd513afbfd94743d931a3501d0df5d1ebc2629653d2
-contract address: 0xf77136FA9c9280c3bBCA29a431B770AD04BE0aE3
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 6937010
-
-******
-
-*** AToken ***
-
-Network: localhost
-tx: 0x540c880640831ce39ae7be3f870f96a68fe64d5b77b4e5fb57a03b428faf3f19
-contract address: 0x1FB3ccD743653c4f8533268fFe4a9a9DA97db500
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 9499999
-
-******
-
-*** DefaultReserveInterestRateStrategy ***
-
-Network: localhost
-tx: 0xea49a43b755144530500ffb8b8001b88558831737543deb69a451d0e5850e63d
-contract address: 0x54f9224C1A99951ABc0A7e843CE19a92dFA2E3c4
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3276945
-
-******
-
-*** StableDebtToken ***
-
-Network: localhost
-tx: 0xf85b360885516da2a05f4ec85a0a29861caac0a8d11ac0225d5d2e1b80d5ebb0
-contract address: 0xf62D2373BAbb096EF4f7dc508e5c153c73dD9CfE
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 7425490
-
-******
-
-*** VariableDebtToken ***
-
-Network: localhost
-tx: 0x496c3e75abb9d525d1d38888324a42615a52975871565b6dcdefb70aca47d508
-contract address: 0x662b3D8C8Dc691C46334bcB2229336063e3c2487
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 6936890
-
-******
-
-*** AToken ***
-
-Network: localhost
-tx: 0x37edd828c08b60bc80c517b50fc90f8218623c65e844a2db67e8748e50f9cb5e
-contract address: 0xEa02aebdf8DccbD3bf2BaA9eeBa48b0275D370b8
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 9499999
-
-******
-
-*** DefaultReserveInterestRateStrategy ***
-
-Network: localhost
-tx: 0x1370094924d5683d96bed3dcf4331597eada7653b9dca5f15cee62184a134de1
-contract address: 0x5a3343A0CF72dC6933362676Bb5831784CaA0014
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3276945
-
-******
-
-*** StableDebtToken ***
-
-Network: localhost
-tx: 0x4617c93975b1b7681079d512168203358d18890f610b7bcb51c98748732d0b78
-contract address: 0xbC15a5eEA769cfB4BA6d7574c9942f0b8C40Ae03
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 7425490
-
-******
-
-*** VariableDebtToken ***
-
-Network: localhost
-tx: 0xefa498d1e69d9fe6409a50b3aa506a592b807e94dddd1f21aea2cd7de547dd8f
-contract address: 0x3c3AB51fF33032159e82E1FDEe6503dEd082F1d9
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 6936890
-
-******
-
-*** AToken ***
-
-Network: localhost
-tx: 0xe80eca2e4658c64f6398e96298cefbb500fc9022a0fcffe444c310fbf6492911
-contract address: 0x2d17b3E44e413F1fDa30E569895863EeD139CE6B
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 9499999
-
-******
-
-*** DefaultReserveInterestRateStrategy ***
-
-Network: localhost
-tx: 0x12bd37e159dabe8a4841f79d966ba2c38d83da6c82227045ab65f0a19bb157b9
-contract address: 0x09e2af829b1C36A6A8876925D1557C0FA1FF7eF5
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3276945
-
-******
-
-*** StableDebtToken ***
-
-Network: localhost
-tx: 0xbda59242e7edfa65c64d898da377e5db00fba42d5f0f0bce70f9967e460aec7b
-contract address: 0x64179c836DD6D887034e14be49c912d166786534
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 7425610
-
-******
-
-*** VariableDebtToken ***
-
-Network: localhost
-tx: 0xdba8d42783dad76edf7623d93ca8720c94a246f2916f683577de0a94abea5eeb
-contract address: 0x912e47ab2257B0fE50516444bb6a12CffaCFA322
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 6937010
-
-******
-
-*** AToken ***
-
-Network: localhost
-tx: 0x994d41b318faa0d04d5e6475ec1c3faccd4670022897c77e2e10c6f87ff5d514
-contract address: 0x29f65c17aD1e6D6b3C99aE80093E4Bf382fA0F69
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 9499999
-
-******
-
-*** DefaultReserveInterestRateStrategy ***
-
-Network: localhost
-tx: 0x0d4d2be3095a1aa2ec941bad0e6d41ce8de15cd8354d0cd56fa3d919c167d49e
-contract address: 0xD4991960dB15FFd68cc78AAAF42dcC0B7ccb6459
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3276945
-
-******
-
-*** StableDebtToken ***
-
-Network: localhost
-tx: 0xd32a1b9b1413871a3001c6e8ba0a9e4ef2a83c4ab09f28194e20befcd9e25090
-contract address: 0xAB45290275E6970b7B76FbaC8b39619EE05D0B69
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 7425610
-
-******
-
-*** VariableDebtToken ***
-
-Network: localhost
-tx: 0x3cf245cc6e80e8b0e47af13b6a48e7784236c6f06be28a566c3f6f4b6edf4122
-contract address: 0xb1c9e66a9064208a930e446811aBE8f4c24310e0
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 6937010
-
-******
-
-*** AToken ***
-
-Network: localhost
-tx: 0xe794f12c3bd49d9118d9ad2cf14efc0afaad2c4b3ae746f1aceb9c375840db48
-contract address: 0x4dab1e43593c3045D3FCb1eEaBBE839C16F12dA6
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 9499999
-
-******
-
-*** DefaultReserveInterestRateStrategy ***
-
-Network: localhost
-tx: 0xc2db0defdfaf772c832b78fa1adb471d831ac9f2dd44f0c9829abc6136e90ce6
-contract address: 0x62650cE1014A9880f8651f5b4ADB3314F339Dc3b
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3276945
-
-******
-
-*** StableDebtToken ***
-
-Network: localhost
-tx: 0x8065c8f31a805076424b8f6bc16b7d8fb38e3e6ee105d73b798f73bb0f8038d2
-contract address: 0x43d8f4f99eCEE76977B75F1659ad34d6A7652c93
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 7425490
-
-******
-
-*** VariableDebtToken ***
-
-Network: localhost
-tx: 0x0f409992c4dcbd92e3fd2c2fca0ce635d82ce9dfa400dc7cf118be901918b331
-contract address: 0x5fc30A361D6dDf1dBa00b4D86aC2EBBe265E76fc
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 6936890
-
-******
-
-*** AToken ***
-
-Network: localhost
-tx: 0x1b2509cbaa127b8d6b76a64c38c66a035ad59f69e3adddd9a5180f3297c47b9b
-contract address: 0x2f77845F39273850bf6d734e21c0D8E7bdfF50F8
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 9499999
-
-******
-
-*** DefaultReserveInterestRateStrategy ***
-
-Network: localhost
-tx: 0xc8572498fec572951914dc2e1558c8834da00750856e80964504270cc6971e16
-contract address: 0x739e654a4550FC22652eFD4d91fF3bf982bEDA4d
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3276945
-
-******
-
-*** StableDebtToken ***
-
-Network: localhost
-tx: 0x152777a73df721c0de6d51a4118e8a492d25275e25757653c4f2267e7976ade0
-contract address: 0x708e2B13F6EB3f62686BAC1795c1e3C09e91eEaF
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 7425490
-
-******
-
-*** VariableDebtToken ***
-
-Network: localhost
-tx: 0x5450edbf0e2695bf4add1f68970ba7b01fc13206a27f0833f3e882eff515b802
-contract address: 0x7c888989D880597456a250098e8F57B0686A2B29
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 6936890
-
-******
-
-*** AToken ***
-
-Network: localhost
-tx: 0xd1931ba728e39a704c7fc1fdc0f87af362ed4e56384e828ad679607b182cf3f3
-contract address: 0x65df659Be90a49356a33458d806d9dE3d8F03969
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 9499999
-
-******
-
-*** DefaultReserveInterestRateStrategy ***
-
-Network: localhost
-tx: 0x77ba9383e9e5b2960c06e763cd6af1219b5de6c18d91f9013bd69f7f03e06343
-contract address: 0xE5464F611113932335B397Eb0dD1601a896005C6
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3276945
-
-******
-
-*** StableDebtToken ***
-
-Network: localhost
-tx: 0x81358741e66b74a3238e9781bd0fb634fee8ffce2a914d82dcba0a591d4f7430
-contract address: 0xF0cDB2EcE3A2188048b79B1f94b434c594B807fB
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 7425490
-
-******
-
-*** VariableDebtToken ***
-
-Network: localhost
-tx: 0xe4552f83561f339dabcbbbeededbb56ccb1ab4d5fcf1ddfa2135982cf246985a
-contract address: 0x9D8Ae53F3D152a668C7c2d7a6cB37FdD9aF38285
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 6936890
-
-******
-
-*** AToken ***
-
-Network: localhost
-tx: 0x748c940099df36aae3b2b10368e70bde62e3e3dbe45ca55e7d5033f44f779a1d
-contract address: 0x7C95b1ad025F0C9aB14192f87bF2aD53889bE4F7
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 9499999
-
-******
-
-*** DefaultReserveInterestRateStrategy ***
-
-Network: localhost
-tx: 0xf4f55e9354a916fa5b9549b681025a341502d384d2f77645cf0f4060e0d1e637
-contract address: 0x9bD0Bec44106D8Ea8fFb6296d7A84742a290E064
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3276945
-
-******
-
-*** StableDebtToken ***
-
-Network: localhost
-tx: 0xc40f435954d1fc3a8ad096e084a83b05647c26b0bbe9f32fee215bbfb8d4e9e8
-contract address: 0x00f126cCA2266bFb634Ed6DB17c4C74fb8cA5177
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 7425610
-
-******
-
-*** VariableDebtToken ***
-
-Network: localhost
-tx: 0xab44990260fe38bf2b4fc6cf1100f3aad1326eb3e9cb415e5cb65f69102e6ba2
-contract address: 0x34Ac3eB6180FdD94043664C22043F004734Dc480
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 6937010
-
-******
-
-*** AToken ***
-
-Network: localhost
-tx: 0x667372a46626f30abeebcf4516685a8417975a73478090f6083b0dc58eaef381
-contract address: 0x04dE7A5bCCf369cb28AB389BfD7a6262E870B0a6
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 9499999
-
-******
-
-*** DefaultReserveInterestRateStrategy ***
-
-Network: localhost
-tx: 0xffecfe6215cd8137e3ba605236c39278b56592675dc35a802d53de8b5378005b
-contract address: 0xC9366C94D1760624DFa702Ee99a04E9f6271Aa70
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3276945
-
-******
-
-*** StableDebtToken ***
-
-Network: localhost
-tx: 0xe9c01fb60c1d3d74881c2833d199081cca4c4fa57701855d63c479c4a1006bc4
-contract address: 0xd405FD3185d05Ed8ba637C1C1ae772F9916A4F49
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 7425430
-
-******
-
-*** VariableDebtToken ***
-
-Network: localhost
-tx: 0x13deded53ea75d1a7fae2ea5e517dcb2ec6501dd72847bfdf4d293929400ed11
-contract address: 0x54F1df7dB2E46dbeF18CF97A376b79108166fa36
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 6936830
-
-******
-
-*** AToken ***
-
-Network: localhost
-tx: 0x3f8f8ec47ba5d1c5e02a248086dea3eac1a72367cc5f4a730e61afe787d444cf
-contract address: 0xF778f628abF1C0E17618077bAEA4FDA95D334136
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 9499999
-
-******
-
-*** DefaultReserveInterestRateStrategy ***
-
-Network: localhost
-tx: 0x1f791622f6dd6ee0e3ca7369a05f94de5ac9ad34758400c20bb62d720c52bdcc
-contract address: 0x267B07Fd1032e9A4e10dBF2600C8407ee6CA1e8c
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3277425
-
-******
-
-*** StableDebtToken ***
-
-Network: localhost
-tx: 0xbc9d4ce2f71b60a86e0936a9eccd7990fa8ed5731d53c2e0961fd8ce42b4ec3b
-contract address: 0x61751f72Fa303F3bB256707dD3cD368c89E82f1b
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 7425490
-
-******
-
-*** VariableDebtToken ***
-
-Network: localhost
-tx: 0x7af317b3ebd94924badd8b088357a9c144aa99243bb8a48de6b23cfdbc41e1b9
-contract address: 0x2E10b24b10692fa972510051A1e296D4535043ad
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 6936890
-
-******
-
-*** AToken ***
-
-Network: localhost
-tx: 0x901aedab1094e416b81636292fd3df29b6e73aeb794526a728843bd4ff9c8ec2
-contract address: 0x99245fC7F2d63e1b09EE1b89f0861dcD09e7a4C1
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 9499999
-
-******
-
-*** DefaultReserveInterestRateStrategy ***
-
-Network: localhost
-tx: 0x3fa610059efa2c6228780079b05e9d200fe986a7a6a48911278cb52e461b9e8f
-contract address: 0xBe6d8642382C241c9B4B50c89574DbF3f4181E7D
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 3277425
-
-******
-
-*** StableDebtToken ***
-
-Network: localhost
-tx: 0xc1af9ee6909ed0d6e2a5ff0deef43dbbdd0e85dfabeb20bb60f67f27b28a758c
-contract address: 0x02BB514187B830d6A2111197cd7D8cb60650B970
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 7425610
-
-******
-
-*** VariableDebtToken ***
-
-Network: localhost
-tx: 0x6612bc1ec1d383ce25143b2cb399480c4f76996b218d1150e8407fdf46520593
-contract address: 0x6774Ce86Abf5EBB22E9F45b5f55daCbB4170aD7f
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 6937010
-
-******
-
-*** AToken ***
-
-Network: localhost
-tx: 0x99665e44ce3b98d3f39d6ed1bc18bbc2705109a8b5f54b36dca59e1cf3e928a0
-contract address: 0x007C1a44e85bDa8F562F916685A9DC8BdC6542bF
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 9499999
-
-******
-
-*** MockFlashLoanReceiver ***
-
-Network: localhost
-tx: 0x04999d6cad119214e028099ca819a45a5f26cf5c523de92e83701bf79575f08d
-contract address: 0xAd49512dFBaD6fc13D67d3935283c0606812E962
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 1872305
-
-******
-
-*** MockSwapAdapter ***
-
-Network: localhost
-tx: 0xfd8e8e01a41ef55102549e5e4489b6dfe5405233a722d5913758517b3d50b53b
-contract address: 0x749258D38b0473d96FEcc14cC5e7DCE12d7Bd6f6
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 1895365
-
-******
-
-*** WalletBalanceProvider ***
-
-Network: localhost
-tx: 0xf36d7aaae62638f3e44de25aa1df006a96928b6459a7a3d2b80ed79e11ce190a
-contract address: 0xA29C2A7e59aa49C71aF084695337E3AA5e820758
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 2512320
-
-******
-
-*** AaveProtocolTestHelpers ***
-
-Network: localhost
-tx: 0x6f1847e62f402f758eaa6dfaa62f318688f8822c5090cd57157d13da892cc489
-contract address: 0x9305d862ee95a899b83906Cd9CB666aC269E5f66
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 2838385
-
-******
-
-setup: 22.427s
-Pool loaded
-Configurator loaded
-
-***************
-Setup and snapshot finished
-***************
-
-  AToken: Modifiers
-    ✓ Tries to invoke mint not being the LendingPool
-    ✓ Tries to invoke burn not being the LendingPool
-    ✓ Tries to invoke transferOnLiquidation not being the LendingPool
-    ✓ Tries to invoke transferUnderlyingTo not being the LendingPool
-
-  AToken: Transfer
-    ✓ User 0 deposits 1000 DAI, transfers to user 1
-    ✓ User 0 deposits 1 WETH and user 1 tries to borrow, but the aTokens received as a transfer are not available as collateral (revert expected)
-    ✓ User 1 sets the DAI as collateral and borrows, tries to transfer everything back to user 0 (revert expected)
-
-  LendingPoolConfigurator
-
-    1) Deactivates the ETH reserve
-    ✓ Rectivates the ETH reserve
-    ✓ Check the onlyLendingPoolManager on deactivateReserve 
-    ✓ Check the onlyLendingPoolManager on activateReserve 
-    ✓ Freezes the ETH reserve
-    ✓ Unfreezes the ETH reserve
-    ✓ Check the onlyLendingPoolManager on freezeReserve 
-    ✓ Check the onlyLendingPoolManager on unfreezeReserve 
-    ✓ Deactivates the ETH reserve for borrowing
-    ✓ Activates the ETH reserve for borrowing
-    ✓ Check the onlyLendingPoolManager on disableBorrowingOnReserve 
-    ✓ Check the onlyLendingPoolManager on enableBorrowingOnReserve 
-    ✓ Deactivates the ETH reserve as collateral
-    ✓ Activates the ETH reserve as collateral
-    ✓ Check the onlyLendingPoolManager on disableReserveAsCollateral 
-    ✓ Check the onlyLendingPoolManager on enableReserveAsCollateral 
-    ✓ Disable stable borrow rate on the ETH reserve
-    ✓ Enables stable borrow rate on the ETH reserve
-    ✓ Check the onlyLendingPoolManager on disableReserveStableRate
-    ✓ Check the onlyLendingPoolManager on enableReserveStableRate
-    ✓ Changes LTV of the reserve
-    ✓ Check the onlyLendingPoolManager on setLtv
-    ✓ Changes liquidation threshold of the reserve
-    ✓ Check the onlyLendingPoolManager on setLiquidationThreshold
-    ✓ Changes liquidation bonus of the reserve
-    ✓ Check the onlyLendingPoolManager on setLiquidationBonus
-    ✓ Check the onlyLendingPoolManager on setReserveDecimals
-    ✓ Check the onlyLendingPoolManager on setLiquidationBonus
-    ✓ Reverts when trying to disable the DAI reserve with liquidity on it
-
-  LendingPool. repayWithCollateral()
-    ✓ User 1 provides some liquidity for others to borrow
-    ✓ User 2 deposit WETH and borrows DAI at Variable
-    ✓ It is not possible to do reentrancy on repayWithCollateral()
-
-    2) User 2 tries to repay his DAI Variable loan using his WETH collateral. First half the amount, after that, the rest
-
-    3) User 3 deposits WETH and borrows USDC at Variable
-
-    4) User 3 repays completely his USDC loan by swapping his WETH collateral
-    ✓ Revert expected. User 3 tries to repay with his collateral a currency he havent borrow
-
-    5) User 3 tries to repay with his collateral all his variable debt and part of the stable
-
-    6) User 4 tries to repay a bigger amount that what can be swapped of a particular collateral, repaying only the maximum allowed by that collateral
-    ✓ User 5 deposits WETH and DAI, then borrows USDC at Variable, then disables WETH as collateral
-
-    7) User 5 tries to repay his USDC loan by swapping his WETH collateral, should not revert even with WETH collateral disabled
-
-  LendingPool. repayWithCollateral() with liquidator
-    ✓ User 1 provides some liquidity for others to borrow
-
-    8) User 5 liquidate User 3 collateral, all his variable debt and part of the stable
-    ✓ User 3 deposits WETH and borrows USDC at Variable
-
-    9) User 5 liquidates half the USDC loan of User 3 by swapping his WETH collateral
-    ✓ Revert expected. User 5 tries to liquidate an User 3 collateral a currency he havent borrow
-
-    10) User 5 liquidates all the USDC loan of User 3 by swapping his WETH collateral
-    ✓ User 2 deposit WETH and borrows DAI at Variable
-
-    11) It is not possible to do reentrancy on repayWithCollateral()
-    ✓ User 5 tries to liquidate  User 2 DAI Variable loan using his WETH collateral, with good HF
-
-    12) User 5 liquidates User 2 DAI Variable loan using his WETH collateral, half the amount
-
-    13) User 2 tries to repay remaining DAI Variable loan using his WETH collateral
-
-    14) Liquidator tries to repay 4 user a bigger amount that what can be swapped of a particular collateral, repaying only the maximum allowed by that collateral
-
-    15) User 5 deposits WETH and DAI, then borrows USDC at Variable, then disables WETH as collateral
-
-    16) Liquidator tries to liquidates User 5 USDC loan by swapping his WETH collateral, should revert due WETH collateral disabled
-
-  LendingPool FlashLoan function
-    ✓ Deposits ETH into the reserve
-
-    17) Takes WETH flashloan with mode = 0, returns the funds correctly
-
-    18) Takes an ETH flashloan with mode = 0 as big as the available liquidity
-    ✓ Takes WETH flashloan, does not return the funds with mode = 0. (revert expected)
-    ✓ Takes a WETH flashloan with an invalid mode. (revert expected)
-
-    19) Caller deposits 1000 DAI as collateral, Takes WETH flashloan with mode = 2, does not return the funds. A variable loan for caller is created
-    ✓ tries to take a very small flashloan, which would result in 0 fees (revert expected)
-
-    20) tries to take a flashloan that is bigger than the available liquidity (revert expected)
-    ✓ tries to take a flashloan using a non contract address as receiver (revert expected)
-    ✓ Deposits USDC into the reserve
-
-    21) Takes out a 500 USDC flashloan, returns the funds correctly
-
-    22) Takes out a 500 USDC flashloan with mode = 0, does not return the funds. (revert expected)
-
-    23) Caller deposits 5 WETH as collateral, Takes a USDC flashloan with mode = 2, does not return the funds. A loan for caller is created
-    ✓ Caller deposits 1000 DAI as collateral, Takes a WETH flashloan with mode = 0, does not approve the transfer of the funds
-
-    24) Caller takes a WETH flashloan with mode = 1
-
-  LendingPoolAddressesProvider
-    ✓ Test the accessibility of the LendingPoolAddressesProvider
-
-  LendingPool liquidation - liquidator receiving aToken
-
-    25) LIQUIDATION - Deposits WETH, borrows DAI/Check liquidation fails because health factor is above 1
-
-    26) LIQUIDATION - Drop the health factor below 1
-
-    27) LIQUIDATION - Tries to liquidate a different currency than the loan principal
-
-    28) LIQUIDATION - Tries to liquidate a different collateral than the borrower collateral
-
-    29) LIQUIDATION - Liquidates the borrow
-
-    30) User 3 deposits 1000 USDC, user 4 1 WETH, user 4 borrows - drops HF, liquidates the borrow
-
-  LendingPool liquidation - liquidator receiving the underlying asset
-
-    31) LIQUIDATION - Deposits WETH, borrows DAI
-
-    32) LIQUIDATION - Drop the health factor below 1
-
-    33) LIQUIDATION - Liquidates the borrow
-
-    34) User 3 deposits 1000 USDC, user 4 1 WETH, user 4 borrows - drops HF, liquidates the borrow
-    ✓ User 4 deposits 1000 LEND - drops HF, liquidates the LEND, which results on a lower amount being liquidated
-
-  LendingPool: Borrow negatives (reverts)
-
-    35) User 0 deposits 1000 DAI, user 1 deposits 1 WETH as collateral and tries to borrow 100 DAI with rate mode NONE (revert expected)
-
-    36) User 0 deposits 1000 DAI, user 1 deposits 1 WETH as collateral and tries to borrow 100 DAI with an invalid rate mode (revert expected)
-
-  LendingPool: Borrow/repay (stable rate)
-
-    37) User 0 deposits 1000 DAI, user 1 deposits 1 WETH as collateral and borrows 100 DAI at stable rate
-    ✓ User 1 tries to borrow the rest of the DAI liquidity (revert expected)
-    ✓ User 1 repays the half of the DAI borrow after one year
-    ✓ User 1 repays the rest of the DAI borrow after one year
-    ✓ User 0 withdraws the deposited DAI plus interest
-
-    38) User 1 deposits 1000 DAI, user 2 tries to borrow 1000 DAI at a stable rate without any collateral (revert expected)
-
-    39) User 0 deposits 1000 DAI, user 1,2,3,4 deposit 1 WETH each and borrow 100 DAI at stable rate. Everything is repaid, user 0 withdraws
-
-    40) User 0 deposits 1000 DAI, user 1 deposits 2 WETH and borrow 100 DAI at stable rate first, then 100 DAI at variable rate, repays everything. User 0 withdraws
-
-  LendingPool: Borrow/repay (variable rate)
-    ✓ User 2 deposits 1 DAI to account for rounding errors
-
-    41) User 0 deposits 1000 DAI, user 1 deposits 1 WETH as collateral and borrows 100 DAI at variable rate
-    ✓ User 1 tries to borrow the rest of the DAI liquidity (revert expected)
-    ✓ User 1 tries to repay 0 DAI (revert expected)
-    ✓ User 1 repays a small amount of DAI, enough to cover a small part of the interest
-    ✓ User 1 repays the DAI borrow after one year
-    ✓ User 0 withdraws the deposited DAI plus interest
-    ✓ User 1 withdraws the collateral
-    ✓ User 2 deposits a small amount of WETH to account for rounding errors
-    ✓ User 0 deposits 1 WETH, user 1 deposits 100 LINK as collateral and borrows 0.5 ETH at variable rate
-    ✓ User 1 tries to repay 0 ETH
-    ✓ User 2 tries to repay everything on behalf of user 1 using uint(-1) (revert expected)
-    ✓ User 3 repays a small amount of WETH on behalf of user 1
-    ✓ User 1 repays the WETH borrow after one year
-    ✓ User 0 withdraws the deposited WETH plus interest
-    ✓ User 1 withdraws the collateral
-    ✓ User 2 deposits 1 USDC to account for rounding errors
-
-    42) User 0 deposits 1000 USDC, user 1 deposits 1 WETH as collateral and borrows 100 USDC at variable rate
-    ✓ User 1 tries to borrow the rest of the USDC liquidity (revert expected)
-
-    43) User 1 repays the USDC borrow after one year
-    ✓ User 0 withdraws the deposited USDC plus interest
-    ✓ User 1 withdraws the collateral
-
-    44) User 1 deposits 1000 DAI, user 3 tries to borrow 1000 DAI without any collateral (revert expected)
-
-    45) user 3 deposits 0.1 ETH collateral to borrow 100 DAI; 0.1 ETH is not enough to borrow 100 DAI (revert expected)
-    ✓ user 3 withdraws the 0.1 ETH
-
-    46) User 1 deposits 1000 USDC, user 3 tries to borrow 1000 USDC without any collateral (revert expected)
-
-    47) user 3 deposits 0.1 ETH collateral to borrow 100 USDC; 0.1 ETH is not enough to borrow 100 USDC (revert expected)
-    ✓ user 3 withdraws the 0.1 ETH
-
-    48) User 0 deposits 1000 DAI, user 6 deposits 2 WETH and borrow 100 DAI at variable rate first, then 100 DAI at stable rate, repays everything. User 0 withdraws
-
-  LendingPool: Deposit
-    ✓ User 0 Deposits 1000 DAI in an empty reserve
-    ✓ User 1 deposits 1000 DAI after user 1
-    ✓ User 0 deposits 1000 USDC in an empty reserve
-    ✓ User 1 deposits 1000 USDC after user 0
-    ✓ User 0 deposits 1 WETH in an empty reserve
-
-    49) User 1 deposits 1 WETH after user 0
-    ✓ User 1 deposits 0 ETH (revert expected)
-    ✓ User 1 deposits 0 DAI
-    ✓ User 1 deposits 100 DAI on behalf of user 2, user 2 tries to borrow 0.1 WETH
-
-  LendingPool: Rebalance stable rate
-    ✓ User 0 tries to rebalance user 1 who has no borrows in progress (revert expected)
-
-    50) User 0 deposits 1000 DAI, user 1 deposits 1 ETH, borrows 100 DAI at a variable rate, user 0 rebalances user 1 (revert expected)
-
-    51) User 1 swaps to stable, user 0 tries to rebalance but the conditions are not met (revert expected)
-
-    52) User 2 deposits ETH and borrows the remaining DAI, causing the stable rates to rise (liquidity rate < user 1 borrow rate). User 0 tries to rebalance user 1 (revert expected)
-
-    53) User 2 borrows more DAI, causing the liquidity rate to rise above user 1 stable borrow rate User 0 rebalances user 1
-
-  LendingPool: Usage as collateral
-
-    54) User 0 Deposits 1000 DAI, disables DAI as collateral
-
-    55) User 1 Deposits 2 ETH, disables ETH as collateral, borrows 400 DAI (revert expected)
-
-    56) User 1 enables ETH as collateral, borrows 400 DAI
-
-    57) User 1 disables ETH as collateral (revert expected)
-
-  LendingPool: Swap rate mode
-    ✓ User 0 tries to swap rate mode without any variable rate loan in progress (revert expected)
-    ✓ User 0 tries to swap rate mode without any stable rate loan in progress (revert expected)
-
-    58) User 0 deposits 1000 DAI, user 1 deposits 2 ETH as collateral, borrows 100 DAI at variable rate and swaps to stable after one year
-    ✓ User 1 borrows another 100 DAI, and swaps back to variable after one year, repays the loan
-
-  LendingPool: Redeem negative test cases
-    ✓ Users 0 Deposits 1000 DAI and tries to redeem 0 DAI (revert expected)
-
-    59) Users 0 tries to redeem 1100 DAI from the 1000 DAI deposited (revert expected)
-
-    60) Users 1 deposits 1 WETH, borrows 100 DAI, tries to redeem the 1 WETH deposited (revert expected)
-
-  LendingPool: withdraw
-    ✓ User 0 Deposits 1000 DAI in an empty reserve
-    ✓ User 0 withdraws half of the deposited DAI
-    ✓ User 0 withdraws remaining half of the deposited DAI
-    ✓ User 0 Deposits 1000 USDC in an empty reserve
-    ✓ User 0 withdraws half of the deposited USDC
-    ✓ User 0 withdraws remaining half of the deposited USDC
-    ✓ User 0 Deposits 1 WETH in an empty reserve
-    ✓ User 0 withdraws half of the deposited ETH
-    ✓ User 0 withdraws remaining half of the deposited ETH
-    ✓ Users 0 and 1 Deposit 1000 DAI, both withdraw
-
-    61) Users 0 deposits 1000 DAI, user 1 Deposit 1000 USDC and 1 WETH, borrows 100 DAI. User 1 tries to withdraw all the USDC
-
-  Stable debt token tests
-    ✓ Tries to invoke mint not being the LendingPool
-    ✓ Tries to invoke burn not being the LendingPool
-
-  Upgradeability
-*** MockAToken ***
-
-Network: localhost
-tx: 0x696dc0be963fe2924a4aa5558d3e5a3bf1fed36fe36d7d23c789a3777f35f512
-contract address: 0xFBdF1E93D0D88145e3CcA63bf8d513F83FB0903b
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 9499999
-
-******
-
-*** MockStableDebtToken ***
-
-Network: localhost
-tx: 0x01436232ca0350c63f60eb508aa006612a889e9d678c026f810f6a4966382a11
-contract address: 0xE45fF4A0A8D0E9734C73874c034E03594E15ba28
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 7628560
-
-******
-
-*** MockVariableDebtToken ***
-
-Network: localhost
-tx: 0xefccca15b91974bbe2288e8671c0451f22dfdc62e088ccfe05a744402b4e0b2e
-contract address: 0x5cCC6Abc4c9F7262B9485797a848Ec6CC28A11dF
-deployer address: 0xc783df8a850f42e7F7e57013759C285caa701eB6
-gas price: 8000000000
-gas used: 7139960
-
-******
-
-    ✓ Tries to update the DAI Atoken implementation with a different address than the lendingPoolManager
-    ✓ Upgrades the DAI Atoken implementation 
-    ✓ Tries to update the DAI Stable debt token implementation with a different address than the lendingPoolManager
-    ✓ Upgrades the DAI stable debt token implementation 
-    ✓ Tries to update the DAI variable debt token implementation with a different address than the lendingPoolManager
-    ✓ Upgrades the DAI variable debt token implementation 
-
-  Variable debt token tests
-    ✓ Tries to invoke mint not being the LendingPool
-    ✓ Tries to invoke burn not being the LendingPool
-
-·------------------------------------------------------------------|---------------------------|-------------|-----------------------------·
-|                       Solc version: 0.6.8                        ·  Optimizer enabled: true  ·  Runs: 200  ·  Block limit: 10000000 gas  │
-···································································|···························|·············|······························
-|  Methods                                                                                                                                 │
-·································|·································|·············|·············|·············|···············|··············
-|  Contract                      ·  Method                         ·  Min        ·  Max        ·  Avg        ·  # calls      ·  eur (avg)  │
-·································|·································|·············|·············|·············|···············|··············
-|  LendingPool                   ·  borrow                         ·     262042  ·     357423  ·     307591  ·           14  ·          -  │
-·································|·································|·············|·············|·············|···············|··············
-|  LendingPool                   ·  deposit                        ·     106722  ·     203343  ·     166219  ·           58  ·          -  │
-·································|·································|·············|·············|·············|···············|··············
-|  LendingPool                   ·  flashLoan                      ·     174269  ·     334932  ·     281378  ·            3  ·          -  │
-·································|·································|·············|·············|·············|···············|··············
-|  LendingPool                   ·  liquidationCall                ·          -  ·          -  ·     402890  ·            1  ·          -  │
-·································|·································|·············|·············|·············|···············|··············
-|  LendingPool                   ·  repay                          ·     133914  ·     207869  ·     181299  ·           14  ·          -  │
-·································|·································|·············|·············|·············|···············|··············
-|  LendingPool                   ·  repayWithCollateral            ·     404877  ·     475002  ·     432357  ·            3  ·          -  │
-·································|·································|·············|·············|·············|···············|··············
-|  LendingPool                   ·  setUserUseReserveAsCollateral  ·      93517  ·     176141  ·     148600  ·            3  ·          -  │
-·································|·································|·············|·············|·············|···············|··············
-|  LendingPool                   ·  swapBorrowRateMode             ·          -  ·          -  ·     159870  ·            1  ·          -  │
-·································|·································|·············|·············|·············|···············|··············
-|  LendingPool                   ·  withdraw                       ·     171316  ·     318009  ·     207305  ·           28  ·          -  │
-·································|·································|·············|·············|·············|···············|··············
-|  LendingPoolAddressesProvider  ·  transferOwnership              ·          -  ·          -  ·      30839  ·            1  ·          -  │
-·································|·································|·············|·············|·············|···············|··············
-|  LendingPoolConfigurator       ·  activateReserve                ·          -  ·          -  ·      46958  ·            4  ·          -  │
-·································|·································|·············|·············|·············|···············|··············
-|  LendingPoolConfigurator       ·  disableBorrowingOnReserve      ·          -  ·          -  ·      51124  ·            2  ·          -  │
-·································|·································|·············|·············|·············|···············|··············
-|  LendingPoolConfigurator       ·  disableReserveAsCollateral     ·          -  ·          -  ·      51060  ·            2  ·          -  │
-·································|·································|·············|·············|·············|···············|··············
-|  LendingPoolConfigurator       ·  disableReserveStableRate       ·          -  ·          -  ·      51189  ·            2  ·          -  │
-·································|·································|·············|·············|·············|···············|··············
-|  LendingPoolConfigurator       ·  enableBorrowingOnReserve       ·          -  ·          -  ·      51700  ·            4  ·          -  │
-·································|·································|·············|·············|·············|···············|··············
-|  LendingPoolConfigurator       ·  enableReserveAsCollateral      ·          -  ·          -  ·      52549  ·            4  ·          -  │
-·································|·································|·············|·············|·············|···············|··············
-|  LendingPoolConfigurator       ·  enableReserveStableRate        ·          -  ·          -  ·      51069  ·            4  ·          -  │
-·································|·································|·············|·············|·············|···············|··············
-|  LendingPoolConfigurator       ·  freezeReserve                  ·          -  ·          -  ·      51104  ·            2  ·          -  │
-·································|·································|·············|·············|·············|···············|··············
-|  LendingPoolConfigurator       ·  setLiquidationBonus            ·          -  ·          -  ·      51381  ·            5  ·          -  │
-·································|·································|·············|·············|·············|···············|··············
-|  LendingPoolConfigurator       ·  setLiquidationThreshold        ·          -  ·          -  ·      51382  ·            3  ·          -  │
-·································|·································|·············|·············|·············|···············|··············
-|  LendingPoolConfigurator       ·  setLtv                         ·          -  ·          -  ·      51410  ·            3  ·          -  │
-·································|·································|·············|·············|·············|···············|··············
-|  LendingPoolConfigurator       ·  unfreezeReserve                ·          -  ·          -  ·      51167  ·            4  ·          -  │
-·································|·································|·············|·············|·············|···············|··············
-|  LendingPoolConfigurator       ·  updateAToken                   ·          -  ·          -  ·     141032  ·            3  ·          -  │
-·································|·································|·············|·············|·············|···············|··············
-|  LendingPoolConfigurator       ·  updateStableDebtToken          ·          -  ·          -  ·     140990  ·            3  ·          -  │
-·································|·································|·············|·············|·············|···············|··············
-|  LendingPoolConfigurator       ·  updateVariableDebtToken        ·          -  ·          -  ·     140959  ·            3  ·          -  │
-·································|·································|·············|·············|·············|···············|··············
-|  MintableERC20                 ·  approve                        ·      24907  ·      44119  ·      36154  ·           42  ·          -  │
-·································|·································|·············|·············|·············|···············|··············
-|  MintableERC20                 ·  mint                           ·      35427  ·      65487  ·      44328  ·           44  ·          -  │
-·································|·································|·············|·············|·············|···············|··············
-|  MintableERC20                 ·  transfer                       ·          -  ·          -  ·      79721  ·            2  ·          -  │
-·································|·································|·············|·············|·············|···············|··············
-|  MockFlashLoanReceiver         ·  setAmountToApprove             ·          -  ·          -  ·      41475  ·            1  ·          -  │
-·································|·································|·············|·············|·············|···············|··············
-|  MockFlashLoanReceiver         ·  setFailExecutionTransfer       ·      13614  ·      42239  ·      29921  ·            7  ·          -  │
-·································|·································|·············|·············|·············|···············|··············
-|  MockSwapAdapter               ·  setAmountToReturn              ·      26483  ·      41519  ·      29521  ·            5  ·          -  │
-·································|·································|·············|·············|·············|···············|··············
-|  MockSwapAdapter               ·  setTryReentrancy               ·          -  ·          -  ·      27257  ·            1  ·          -  │
-·································|·································|·············|·············|·············|···············|··············
-|  PriceOracle                   ·  setAssetPrice                  ·      28539  ·      28551  ·      28548  ·            4  ·          -  │
-·································|·································|·············|·············|·············|···············|··············
-|  Deployments                                                     ·                                         ·  % of limit   ·             │
-···································································|·············|·············|·············|···············|··············
-|  MockVariableDebtToken                                           ·          -  ·          -  ·    1427992  ·       14.3 %  ·          -  │
-···································································|·············|·············|·············|···············|··············
-|  ValidationLogic                                                 ·          -  ·          -  ·    1539063  ·       15.4 %  ·          -  │
-·------------------------------------------------------------------|-------------|-------------|-------------|---------------|-------------·
-
-  112 passing (3m)
-  61 failing
-
-  1) LendingPoolConfigurator
-       Deactivates the ETH reserve:
-     Error: VM Exception while processing transaction: revert 36
-      at HttpProvider.send (node_modules/@nomiclabs/buidler/src/internal/core/providers/http.ts:36:34)
-      at getMultipliedGasEstimation (node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:150:45)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:108:14
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/accounts.ts:219:21
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:63:21
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:82:21
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at EthersProviderWrapper.send (node_modules/@nomiclabs/buidler-ethers/src/ethers-provider-wrapper.ts:13:48)
-      at EthersProviderWrapper.JsonRpcProvider.perform (node_modules/@ethersproject/providers/src.ts/json-rpc-provider.ts:432:21)
-      at EthersProviderWrapper.<anonymous> (node_modules/@ethersproject/providers/src.ts/base-provider.ts:850:42)
-      at step (node_modules/@ethersproject/providers/lib/base-provider.js:46:23)
-      at Object.next (node_modules/@ethersproject/providers/lib/base-provider.js:27:53)
-      at fulfilled (node_modules/@ethersproject/providers/lib/base-provider.js:18:58)
-      at runMicrotasks (<anonymous>)
-      at processTicksAndRejections (internal/process/task_queues.js:97:5)
-
-  2) LendingPool. repayWithCollateral()
-       User 2 tries to repay his DAI Variable loan using his WETH collateral. First half the amount, after that, the rest:
-
-      AssertionError: expected '999594024748679625' to equal '961247816651583750'
-      + expected - actual
-
-      -999594024748679625
-      +961247816651583750
-      
-      at /src/test/repay-with-collateral.spec.ts:169:68
-      at step (test/repay-with-collateral.spec.ts:33:23)
-      at Object.next (test/repay-with-collateral.spec.ts:14:53)
-      at fulfilled (test/repay-with-collateral.spec.ts:5:58)
-      at runMicrotasks (<anonymous>)
-      at processTicksAndRejections (internal/process/task_queues.js:97:5)
-
-  3) LendingPool. repayWithCollateral()
-       User 3 deposits WETH and borrows USDC at Variable:
-     Error: VM Exception while processing transaction: revert 11
-      at HttpProvider.send (node_modules/@nomiclabs/buidler/src/internal/core/providers/http.ts:36:34)
-      at getMultipliedGasEstimation (node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:150:45)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:108:14
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/accounts.ts:219:21
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:63:21
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:82:21
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at EthersProviderWrapper.send (node_modules/@nomiclabs/buidler-ethers/src/ethers-provider-wrapper.ts:13:48)
-      at EthersProviderWrapper.JsonRpcProvider.perform (node_modules/@ethersproject/providers/src.ts/json-rpc-provider.ts:432:21)
-      at EthersProviderWrapper.<anonymous> (node_modules/@ethersproject/providers/src.ts/base-provider.ts:850:42)
-      at step (node_modules/@ethersproject/providers/lib/base-provider.js:46:23)
-      at Object.next (node_modules/@ethersproject/providers/lib/base-provider.js:27:53)
-      at fulfilled (node_modules/@ethersproject/providers/lib/base-provider.js:18:58)
-      at runMicrotasks (<anonymous>)
-      at processTicksAndRejections (internal/process/task_queues.js:97:5)
-
-  4) LendingPool. repayWithCollateral()
-       User 3 repays completely his USDC loan by swapping his WETH collateral:
-     Error: VM Exception while processing transaction: revert 40
-      at HttpProvider.send (node_modules/@nomiclabs/buidler/src/internal/core/providers/http.ts:36:34)
-      at getMultipliedGasEstimation (node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:150:45)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:108:14
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/accounts.ts:219:21
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:63:21
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:82:21
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at EthersProviderWrapper.send (node_modules/@nomiclabs/buidler-ethers/src/ethers-provider-wrapper.ts:13:48)
-      at EthersProviderWrapper.JsonRpcProvider.perform (node_modules/@ethersproject/providers/src.ts/json-rpc-provider.ts:432:21)
-      at EthersProviderWrapper.<anonymous> (node_modules/@ethersproject/providers/src.ts/base-provider.ts:850:42)
-      at step (node_modules/@ethersproject/providers/lib/base-provider.js:46:23)
-      at Object.next (node_modules/@ethersproject/providers/lib/base-provider.js:27:53)
-      at fulfilled (node_modules/@ethersproject/providers/lib/base-provider.js:18:58)
-      at runMicrotasks (<anonymous>)
-      at processTicksAndRejections (internal/process/task_queues.js:97:5)
-
-  5) LendingPool. repayWithCollateral()
-       User 3 tries to repay with his collateral all his variable debt and part of the stable:
-     Error: VM Exception while processing transaction: revert 11
-      at HttpProvider.send (node_modules/@nomiclabs/buidler/src/internal/core/providers/http.ts:36:34)
-      at getMultipliedGasEstimation (node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:150:45)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:108:14
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/accounts.ts:219:21
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:63:21
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:82:21
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at EthersProviderWrapper.send (node_modules/@nomiclabs/buidler-ethers/src/ethers-provider-wrapper.ts:13:48)
-      at EthersProviderWrapper.JsonRpcProvider.perform (node_modules/@ethersproject/providers/src.ts/json-rpc-provider.ts:432:21)
-      at EthersProviderWrapper.<anonymous> (node_modules/@ethersproject/providers/src.ts/base-provider.ts:850:42)
-      at step (node_modules/@ethersproject/providers/lib/base-provider.js:46:23)
-      at Object.next (node_modules/@ethersproject/providers/lib/base-provider.js:27:53)
-      at fulfilled (node_modules/@ethersproject/providers/lib/base-provider.js:18:58)
-      at runMicrotasks (<anonymous>)
-      at processTicksAndRejections (internal/process/task_queues.js:97:5)
-
-  6) LendingPool. repayWithCollateral()
-       User 4 tries to repay a bigger amount that what can be swapped of a particular collateral, repaying only the maximum allowed by that collateral:
-
-      AssertionError: expected '52004058862' to equal '-2.383204320379782404696e+21'
-      + expected - actual
-
-      -52004058862
-      +-2.383204320379782404696e+21
-      
-      at /src/test/repay-with-collateral.spec.ts:518:66
-      at step (test/repay-with-collateral.spec.ts:33:23)
-      at Object.next (test/repay-with-collateral.spec.ts:14:53)
-      at fulfilled (test/repay-with-collateral.spec.ts:5:58)
-      at runMicrotasks (<anonymous>)
-      at processTicksAndRejections (internal/process/task_queues.js:97:5)
-
-  7) LendingPool. repayWithCollateral()
-       User 5 tries to repay his USDC loan by swapping his WETH collateral, should not revert even with WETH collateral disabled:
-
-      AssertionError: expected '9997370843952131411' to equal '9749035101915727008'
-      + expected - actual
-
-      -9997370843952131411
-      +9749035101915727008
-      
-      at /src/test/repay-with-collateral.spec.ts:631:68
-      at step (test/repay-with-collateral.spec.ts:33:23)
-      at Object.next (test/repay-with-collateral.spec.ts:14:53)
-      at fulfilled (test/repay-with-collateral.spec.ts:5:58)
-      at runMicrotasks (<anonymous>)
-      at processTicksAndRejections (internal/process/task_queues.js:97:5)
-
-  8) LendingPool. repayWithCollateral() with liquidator
-       User 5 liquidate User 3 collateral, all his variable debt and part of the stable:
-     Error: VM Exception while processing transaction: revert 11
-      at HttpProvider.send (node_modules/@nomiclabs/buidler/src/internal/core/providers/http.ts:36:34)
-      at getMultipliedGasEstimation (node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:150:45)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:108:14
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/accounts.ts:219:21
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:63:21
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:82:21
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at EthersProviderWrapper.send (node_modules/@nomiclabs/buidler-ethers/src/ethers-provider-wrapper.ts:13:48)
-      at EthersProviderWrapper.JsonRpcProvider.perform (node_modules/@ethersproject/providers/src.ts/json-rpc-provider.ts:432:21)
-      at EthersProviderWrapper.<anonymous> (node_modules/@ethersproject/providers/src.ts/base-provider.ts:850:42)
-      at step (node_modules/@ethersproject/providers/lib/base-provider.js:46:23)
-      at Object.next (node_modules/@ethersproject/providers/lib/base-provider.js:27:53)
-      at fulfilled (node_modules/@ethersproject/providers/lib/base-provider.js:18:58)
-      at runMicrotasks (<anonymous>)
-      at processTicksAndRejections (internal/process/task_queues.js:97:5)
-
-  9) LendingPool. repayWithCollateral() with liquidator
-       User 5 liquidates half the USDC loan of User 3 by swapping his WETH collateral:
-
-      AssertionError: expected '1097065639317749425' to be less than '1000000000000000000'
-      + expected - actual
-
-      -1097065639317749425
-      +1000000000000000000
-      
-      at /src/test/flash-liquidation-with-collateral.spec.ts:223:68
-      at step (test/flash-liquidation-with-collateral.spec.ts:33:23)
-      at Object.next (test/flash-liquidation-with-collateral.spec.ts:14:53)
-      at fulfilled (test/flash-liquidation-with-collateral.spec.ts:5:58)
-      at runMicrotasks (<anonymous>)
-      at processTicksAndRejections (internal/process/task_queues.js:97:5)
-
-  10) LendingPool. repayWithCollateral() with liquidator
-       User 5 liquidates all the USDC loan of User 3 by swapping his WETH collateral:
-
-      AssertionError: expected '59993908751455423405' to equal '59418562594024569644'
-      + expected - actual
-
-      -59993908751455423405
-      +59418562594024569644
-      
-      at /src/test/flash-liquidation-with-collateral.spec.ts:433:68
-      at step (test/flash-liquidation-with-collateral.spec.ts:33:23)
-      at Object.next (test/flash-liquidation-with-collateral.spec.ts:14:53)
-      at fulfilled (test/flash-liquidation-with-collateral.spec.ts:5:58)
-      at runMicrotasks (<anonymous>)
-      at processTicksAndRejections (internal/process/task_queues.js:97:5)
-
-  11) LendingPool. repayWithCollateral() with liquidator
-       It is not possible to do reentrancy on repayWithCollateral():
-     AssertionError: Expected transaction to be reverted with 53, but other exception was thrown: Error: VM Exception while processing transaction: revert 38
-  
-
-  12) LendingPool. repayWithCollateral() with liquidator
-       User 5 liquidates User 2 DAI Variable loan using his WETH collateral, half the amount:
-
-      AssertionError: expected '1198981160048434745' to be less than '1000000000000000000'
-      + expected - actual
-
-      -1198981160048434745
-      +1000000000000000000
-      
-      at /src/test/flash-liquidation-with-collateral.spec.ts:556:68
-      at step (test/flash-liquidation-with-collateral.spec.ts:33:23)
-      at Object.next (test/flash-liquidation-with-collateral.spec.ts:14:53)
-      at fulfilled (test/flash-liquidation-with-collateral.spec.ts:5:58)
-      at runMicrotasks (<anonymous>)
-      at processTicksAndRejections (internal/process/task_queues.js:97:5)
-
-  13) LendingPool. repayWithCollateral() with liquidator
-       User 2 tries to repay remaining DAI Variable loan using his WETH collateral:
-     Error: VM Exception while processing transaction: revert 53
-      at HttpProvider.send (node_modules/@nomiclabs/buidler/src/internal/core/providers/http.ts:36:34)
-      at getMultipliedGasEstimation (node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:150:45)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:108:14
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/accounts.ts:219:21
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:63:21
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:82:21
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at EthersProviderWrapper.send (node_modules/@nomiclabs/buidler-ethers/src/ethers-provider-wrapper.ts:13:48)
-      at EthersProviderWrapper.JsonRpcProvider.perform (node_modules/@ethersproject/providers/src.ts/json-rpc-provider.ts:432:21)
-      at EthersProviderWrapper.<anonymous> (node_modules/@ethersproject/providers/src.ts/base-provider.ts:850:42)
-      at step (node_modules/@ethersproject/providers/lib/base-provider.js:46:23)
-      at Object.next (node_modules/@ethersproject/providers/lib/base-provider.js:27:53)
-      at fulfilled (node_modules/@ethersproject/providers/lib/base-provider.js:18:58)
-      at runMicrotasks (<anonymous>)
-      at processTicksAndRejections (internal/process/task_queues.js:97:5)
-
-  14) LendingPool. repayWithCollateral() with liquidator
-       Liquidator tries to repay 4 user a bigger amount that what can be swapped of a particular collateral, repaying only the maximum allowed by that collateral:
-
-      AssertionError: expected '1270283356830566122' to be less than '1000000000000000000'
-      + expected - actual
-
-      -1270283356830566122
-      +1000000000000000000
-      
-      at /src/test/flash-liquidation-with-collateral.spec.ts:761:73
-      at step (test/flash-liquidation-with-collateral.spec.ts:33:23)
-      at Object.next (test/flash-liquidation-with-collateral.spec.ts:14:53)
-      at fulfilled (test/flash-liquidation-with-collateral.spec.ts:5:58)
-      at runMicrotasks (<anonymous>)
-      at processTicksAndRejections (internal/process/task_queues.js:97:5)
-
-  15) LendingPool. repayWithCollateral() with liquidator
-       User 5 deposits WETH and DAI, then borrows USDC at Variable, then disables WETH as collateral:
-     Error: VM Exception while processing transaction: revert 11
-      at HttpProvider.send (node_modules/@nomiclabs/buidler/src/internal/core/providers/http.ts:36:34)
-      at getMultipliedGasEstimation (node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:150:45)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:108:14
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/accounts.ts:219:21
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:63:21
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:82:21
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at EthersProviderWrapper.send (node_modules/@nomiclabs/buidler-ethers/src/ethers-provider-wrapper.ts:13:48)
-      at EthersProviderWrapper.JsonRpcProvider.perform (node_modules/@ethersproject/providers/src.ts/json-rpc-provider.ts:432:21)
-      at EthersProviderWrapper.<anonymous> (node_modules/@ethersproject/providers/src.ts/base-provider.ts:850:42)
-      at step (node_modules/@ethersproject/providers/lib/base-provider.js:46:23)
-      at Object.next (node_modules/@ethersproject/providers/lib/base-provider.js:27:53)
-      at fulfilled (node_modules/@ethersproject/providers/lib/base-provider.js:18:58)
-      at runMicrotasks (<anonymous>)
-      at processTicksAndRejections (internal/process/task_queues.js:97:5)
-
-  16) LendingPool. repayWithCollateral() with liquidator
-       Liquidator tries to liquidates User 5 USDC loan by swapping his WETH collateral, should revert due WETH collateral disabled:
-     AssertionError: Expected transaction to be reverted with 39, but other exception was thrown: Error: VM Exception while processing transaction: revert 38
-  
-
-  17) LendingPool FlashLoan function
-       Takes WETH flashloan with mode = 0, returns the funds correctly:
-
-      AssertionError: expected '485188345817617606687' to equal '1000720000000000000'
-      + expected - actual
-
-      -485188345817617606687
-      +1000720000000000000
-      
-      at /src/test/flashloan.spec.ts:66:45
-      at step (test/flashloan.spec.ts:33:23)
-      at Object.next (test/flashloan.spec.ts:14:53)
-      at fulfilled (test/flashloan.spec.ts:5:58)
-      at runMicrotasks (<anonymous>)
-      at processTicksAndRejections (internal/process/task_queues.js:97:5)
-
-  18) LendingPool FlashLoan function
-       Takes an ETH flashloan with mode = 0 as big as the available liquidity:
-
-      AssertionError: expected '485189246465617606687' to equal '1001620648000000000'
-      + expected - actual
-
-      -485189246465617606687
-      +1001620648000000000
-      
-      at /src/test/flashloan.spec.ts:93:45
-      at step (test/flashloan.spec.ts:33:23)
-      at Object.next (test/flashloan.spec.ts:14:53)
-      at fulfilled (test/flashloan.spec.ts:5:58)
-      at runMicrotasks (<anonymous>)
-      at processTicksAndRejections (internal/process/task_queues.js:97:5)
-
-  19) LendingPool FlashLoan function
-       Caller deposits 1000 DAI as collateral, Takes WETH flashloan with mode = 2, does not return the funds. A variable loan for caller is created:
-     Error: VM Exception while processing transaction: revert 11
-      at HttpProvider.send (node_modules/@nomiclabs/buidler/src/internal/core/providers/http.ts:36:34)
-      at getMultipliedGasEstimation (node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:150:45)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:108:14
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/accounts.ts:219:21
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:63:21
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:82:21
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at EthersProviderWrapper.send (node_modules/@nomiclabs/buidler-ethers/src/ethers-provider-wrapper.ts:13:48)
-      at EthersProviderWrapper.JsonRpcProvider.perform (node_modules/@ethersproject/providers/src.ts/json-rpc-provider.ts:432:21)
-      at EthersProviderWrapper.<anonymous> (node_modules/@ethersproject/providers/src.ts/base-provider.ts:850:42)
-      at step (node_modules/@ethersproject/providers/lib/base-provider.js:46:23)
-      at Object.next (node_modules/@ethersproject/providers/lib/base-provider.js:27:53)
-      at fulfilled (node_modules/@ethersproject/providers/lib/base-provider.js:18:58)
-      at runMicrotasks (<anonymous>)
-      at processTicksAndRejections (internal/process/task_queues.js:97:5)
-
-  20) LendingPool FlashLoan function
-       tries to take a flashloan that is bigger than the available liquidity (revert expected):
-
-      AssertionError: ERC20: transfer amount exceeds balance: Expected transaction to be reverted
-      + expected - actual
-
-      -Transaction NOT reverted.
-      +Transaction reverted.
-      
-  
-
-  21) LendingPool FlashLoan function
-       Takes out a 500 USDC flashloan, returns the funds correctly:
-     AssertionError: Expected "40000000000001000450000" to be equal 1000450000
-      at /src/test/flashloan.spec.ts:254:34
-      at step (test/flashloan.spec.ts:33:23)
-      at Object.next (test/flashloan.spec.ts:14:53)
-      at fulfilled (test/flashloan.spec.ts:5:58)
-      at runMicrotasks (<anonymous>)
-      at processTicksAndRejections (internal/process/task_queues.js:97:5)
-
-  22) LendingPool FlashLoan function
-       Takes out a 500 USDC flashloan with mode = 0, does not return the funds. (revert expected):
-     AssertionError: Expected transaction to be reverted with 9, but other exception was thrown: Error: VM Exception while processing transaction: revert 11
-  
-
-  23) LendingPool FlashLoan function
-       Caller deposits 5 WETH as collateral, Takes a USDC flashloan with mode = 2, does not return the funds. A loan for caller is created:
-     Error: VM Exception while processing transaction: revert 11
-      at HttpProvider.send (node_modules/@nomiclabs/buidler/src/internal/core/providers/http.ts:36:34)
-      at getMultipliedGasEstimation (node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:150:45)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:108:14
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/accounts.ts:219:21
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:63:21
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:82:21
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at EthersProviderWrapper.send (node_modules/@nomiclabs/buidler-ethers/src/ethers-provider-wrapper.ts:13:48)
-      at EthersProviderWrapper.JsonRpcProvider.perform (node_modules/@ethersproject/providers/src.ts/json-rpc-provider.ts:432:21)
-      at EthersProviderWrapper.<anonymous> (node_modules/@ethersproject/providers/src.ts/base-provider.ts:850:42)
-      at step (node_modules/@ethersproject/providers/lib/base-provider.js:46:23)
-      at Object.next (node_modules/@ethersproject/providers/lib/base-provider.js:27:53)
-      at fulfilled (node_modules/@ethersproject/providers/lib/base-provider.js:18:58)
-      at runMicrotasks (<anonymous>)
-      at processTicksAndRejections (internal/process/task_queues.js:97:5)
-
-  24) LendingPool FlashLoan function
-       Caller takes a WETH flashloan with mode = 1:
-     Error: VM Exception while processing transaction: revert 11
-      at HttpProvider.send (node_modules/@nomiclabs/buidler/src/internal/core/providers/http.ts:36:34)
-      at getMultipliedGasEstimation (node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:150:45)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:108:14
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/accounts.ts:219:21
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:63:21
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:82:21
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at EthersProviderWrapper.send (node_modules/@nomiclabs/buidler-ethers/src/ethers-provider-wrapper.ts:13:48)
-      at EthersProviderWrapper.JsonRpcProvider.perform (node_modules/@ethersproject/providers/src.ts/json-rpc-provider.ts:432:21)
-      at EthersProviderWrapper.<anonymous> (node_modules/@ethersproject/providers/src.ts/base-provider.ts:850:42)
-      at step (node_modules/@ethersproject/providers/lib/base-provider.js:46:23)
-      at Object.next (node_modules/@ethersproject/providers/lib/base-provider.js:27:53)
-      at fulfilled (node_modules/@ethersproject/providers/lib/base-provider.js:18:58)
-      at runMicrotasks (<anonymous>)
-      at processTicksAndRejections (internal/process/task_queues.js:97:5)
-
-  25) LendingPool liquidation - liquidator receiving aToken
-       LIQUIDATION - Deposits WETH, borrows DAI/Check liquidation fails because health factor is above 1:
-
-      AssertionError: expected '2180' to equal '8000'
-      + expected - actual
-
-      -2180
-      +8000
-      
-      at /src/test/liquidation-atoken.spec.ts:70:88
-      at step (test/liquidation-atoken.spec.ts:33:23)
-      at Object.next (test/liquidation-atoken.spec.ts:14:53)
-      at fulfilled (test/liquidation-atoken.spec.ts:5:58)
-      at runMicrotasks (<anonymous>)
-      at processTicksAndRejections (internal/process/task_queues.js:97:5)
-
-  26) LendingPool liquidation - liquidator receiving aToken
-       LIQUIDATION - Drop the health factor below 1:
-
-      AssertionError: expected '1106703694383782217' to be less than '1000000000000000000'
-      + expected - actual
-
-      -1106703694383782217
-      +1000000000000000000
-      
-      at /src/test/liquidation-atoken.spec.ts:94:68
-      at step (test/liquidation-atoken.spec.ts:33:23)
-      at Object.next (test/liquidation-atoken.spec.ts:14:53)
-      at fulfilled (test/liquidation-atoken.spec.ts:5:58)
-      at runMicrotasks (<anonymous>)
-      at processTicksAndRejections (internal/process/task_queues.js:97:5)
-
-  27) LendingPool liquidation - liquidator receiving aToken
-       LIQUIDATION - Tries to liquidate a different currency than the loan principal:
-     AssertionError: Expected transaction to be reverted with 40, but other exception was thrown: Error: VM Exception while processing transaction: revert 38
-  
-
-  28) LendingPool liquidation - liquidator receiving aToken
-       LIQUIDATION - Tries to liquidate a different collateral than the borrower collateral:
-     AssertionError: Expected transaction to be reverted with 39, but other exception was thrown: Error: VM Exception while processing transaction: revert 38
-  
-
-  29) LendingPool liquidation - liquidator receiving aToken
-       LIQUIDATION - Liquidates the borrow:
-     Error: VM Exception while processing transaction: revert 38
-      at HttpProvider.send (node_modules/@nomiclabs/buidler/src/internal/core/providers/http.ts:36:34)
-      at getMultipliedGasEstimation (node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:150:45)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:108:14
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/accounts.ts:219:21
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:63:21
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:82:21
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at EthersProviderWrapper.send (node_modules/@nomiclabs/buidler-ethers/src/ethers-provider-wrapper.ts:13:48)
-      at EthersProviderWrapper.JsonRpcProvider.perform (node_modules/@ethersproject/providers/src.ts/json-rpc-provider.ts:432:21)
-      at EthersProviderWrapper.<anonymous> (node_modules/@ethersproject/providers/src.ts/base-provider.ts:850:42)
-      at step (node_modules/@ethersproject/providers/lib/base-provider.js:46:23)
-      at Object.next (node_modules/@ethersproject/providers/lib/base-provider.js:27:53)
-      at fulfilled (node_modules/@ethersproject/providers/lib/base-provider.js:18:58)
-      at runMicrotasks (<anonymous>)
-      at processTicksAndRejections (internal/process/task_queues.js:97:5)
-
-  30) LendingPool liquidation - liquidator receiving aToken
-       User 3 deposits 1000 USDC, user 4 1 WETH, user 4 borrows - drops HF, liquidates the borrow:
-     Error: VM Exception while processing transaction: revert 39
-      at HttpProvider.send (node_modules/@nomiclabs/buidler/src/internal/core/providers/http.ts:36:34)
-      at getMultipliedGasEstimation (node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:150:45)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:108:14
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/accounts.ts:219:21
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:63:21
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:82:21
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at EthersProviderWrapper.send (node_modules/@nomiclabs/buidler-ethers/src/ethers-provider-wrapper.ts:13:48)
-      at EthersProviderWrapper.JsonRpcProvider.perform (node_modules/@ethersproject/providers/src.ts/json-rpc-provider.ts:432:21)
-      at EthersProviderWrapper.<anonymous> (node_modules/@ethersproject/providers/src.ts/base-provider.ts:850:42)
-      at step (node_modules/@ethersproject/providers/lib/base-provider.js:46:23)
-      at Object.next (node_modules/@ethersproject/providers/lib/base-provider.js:27:53)
-      at fulfilled (node_modules/@ethersproject/providers/lib/base-provider.js:18:58)
-      at runMicrotasks (<anonymous>)
-      at processTicksAndRejections (internal/process/task_queues.js:97:5)
-
-  31) LendingPool liquidation - liquidator receiving the underlying asset
-       LIQUIDATION - Deposits WETH, borrows DAI:
-
-      AssertionError: expected '2053' to equal '8000'
-      + expected - actual
-
-      -2053
-      +8000
-      
-      at /src/test/liquidation-underlying.spec.ts:75:88
-      at step (test/liquidation-underlying.spec.ts:33:23)
-      at Object.next (test/liquidation-underlying.spec.ts:14:53)
-      at fulfilled (test/liquidation-underlying.spec.ts:5:58)
-      at runMicrotasks (<anonymous>)
-      at processTicksAndRejections (internal/process/task_queues.js:97:5)
-
-  32) LendingPool liquidation - liquidator receiving the underlying asset
-       LIQUIDATION - Drop the health factor below 1:
-
-      AssertionError: expected '1084735437615841522' to be less than '1000000000000000000'
-      + expected - actual
-
-      -1084735437615841522
-      +1000000000000000000
-      
-      at /src/test/liquidation-underlying.spec.ts:94:68
-      at step (test/liquidation-underlying.spec.ts:33:23)
-      at Object.next (test/liquidation-underlying.spec.ts:14:53)
-      at fulfilled (test/liquidation-underlying.spec.ts:5:58)
-      at runMicrotasks (<anonymous>)
-      at processTicksAndRejections (internal/process/task_queues.js:97:5)
-
-  33) LendingPool liquidation - liquidator receiving the underlying asset
-       LIQUIDATION - Liquidates the borrow:
-     Error: VM Exception while processing transaction: revert 38
-      at HttpProvider.send (node_modules/@nomiclabs/buidler/src/internal/core/providers/http.ts:36:34)
-      at getMultipliedGasEstimation (node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:150:45)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:108:14
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/accounts.ts:219:21
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:63:21
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:82:21
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at EthersProviderWrapper.send (node_modules/@nomiclabs/buidler-ethers/src/ethers-provider-wrapper.ts:13:48)
-      at EthersProviderWrapper.JsonRpcProvider.perform (node_modules/@ethersproject/providers/src.ts/json-rpc-provider.ts:432:21)
-      at EthersProviderWrapper.<anonymous> (node_modules/@ethersproject/providers/src.ts/base-provider.ts:850:42)
-      at step (node_modules/@ethersproject/providers/lib/base-provider.js:46:23)
-      at Object.next (node_modules/@ethersproject/providers/lib/base-provider.js:27:53)
-      at fulfilled (node_modules/@ethersproject/providers/lib/base-provider.js:18:58)
-      at runMicrotasks (<anonymous>)
-      at processTicksAndRejections (internal/process/task_queues.js:97:5)
-
-  34) LendingPool liquidation - liquidator receiving the underlying asset
-       User 3 deposits 1000 USDC, user 4 1 WETH, user 4 borrows - drops HF, liquidates the borrow:
-     Error: VM Exception while processing transaction: revert 39
-      at HttpProvider.send (node_modules/@nomiclabs/buidler/src/internal/core/providers/http.ts:36:34)
-      at getMultipliedGasEstimation (node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:150:45)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:108:14
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/accounts.ts:219:21
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:63:21
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:82:21
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at EthersProviderWrapper.send (node_modules/@nomiclabs/buidler-ethers/src/ethers-provider-wrapper.ts:13:48)
-      at EthersProviderWrapper.JsonRpcProvider.perform (node_modules/@ethersproject/providers/src.ts/json-rpc-provider.ts:432:21)
-      at EthersProviderWrapper.<anonymous> (node_modules/@ethersproject/providers/src.ts/base-provider.ts:850:42)
-      at step (node_modules/@ethersproject/providers/lib/base-provider.js:46:23)
-      at Object.next (node_modules/@ethersproject/providers/lib/base-provider.js:27:53)
-      at fulfilled (node_modules/@ethersproject/providers/lib/base-provider.js:18:58)
-      at runMicrotasks (<anonymous>)
-      at processTicksAndRejections (internal/process/task_queues.js:97:5)
-
-  35) LendingPool: Borrow negatives (reverts)
-       User 0 deposits 1000 DAI, user 1 deposits 1 WETH as collateral and tries to borrow 100 DAI with rate mode NONE (revert expected):
-
-      AssertionError: expected '100000000000000000' to be almost equal or equal '0' for property principalStableDebt
-      + expected - actual
-
-      -100000000000000000
-      +0
-      
-      at expectEqual (test/helpers/actions.ts:664:26)
-      at /src/test/helpers/actions.ts:194:5
-      at step (test/helpers/actions.ts:33:23)
-      at Object.next (test/helpers/actions.ts:14:53)
-      at fulfilled (test/helpers/actions.ts:5:58)
-      at runMicrotasks (<anonymous>)
-      at processTicksAndRejections (internal/process/task_queues.js:97:5)
-
-  36) LendingPool: Borrow negatives (reverts)
-       User 0 deposits 1000 DAI, user 1 deposits 1 WETH as collateral and tries to borrow 100 DAI with an invalid rate mode (revert expected):
-
-      AssertionError: expected '100000000000000000' to be almost equal or equal '0' for property principalStableDebt
-      + expected - actual
-
-      -100000000000000000
-      +0
-      
-      at expectEqual (test/helpers/actions.ts:664:26)
-      at /src/test/helpers/actions.ts:194:5
-      at step (test/helpers/actions.ts:33:23)
-      at Object.next (test/helpers/actions.ts:14:53)
-      at fulfilled (test/helpers/actions.ts:5:58)
-      at runMicrotasks (<anonymous>)
-      at processTicksAndRejections (internal/process/task_queues.js:97:5)
-
-  37) LendingPool: Borrow/repay (stable rate)
-       User 0 deposits 1000 DAI, user 1 deposits 1 WETH as collateral and borrows 100 DAI at stable rate:
-
-      AssertionError: expected '100000000000000000' to be almost equal or equal '0' for property principalStableDebt
-      + expected - actual
-
-      -100000000000000000
-      +0
-      
-      at expectEqual (test/helpers/actions.ts:664:26)
-      at /src/test/helpers/actions.ts:194:5
-      at step (test/helpers/actions.ts:33:23)
-      at Object.next (test/helpers/actions.ts:14:53)
-      at fulfilled (test/helpers/actions.ts:5:58)
-      at runMicrotasks (<anonymous>)
-      at processTicksAndRejections (internal/process/task_queues.js:97:5)
-
-  38) LendingPool: Borrow/repay (stable rate)
-       User 1 deposits 1000 DAI, user 2 tries to borrow 1000 DAI at a stable rate without any collateral (revert expected):
-
-      AssertionError: expected '0' to be almost equal or equal '1358000328427211421354' for property principalStableDebt
-      + expected - actual
-
-      -0
-      +1358000328427211421354
-      
-      at expectEqual (test/helpers/actions.ts:664:26)
-      at /src/test/helpers/actions.ts:194:5
-      at step (test/helpers/actions.ts:33:23)
-      at Object.next (test/helpers/actions.ts:14:53)
-      at fulfilled (test/helpers/actions.ts:5:58)
-      at runMicrotasks (<anonymous>)
-      at processTicksAndRejections (internal/process/task_queues.js:97:5)
-
-  39) LendingPool: Borrow/repay (stable rate)
-       User 0 deposits 1000 DAI, user 1,2,3,4 deposit 1 WETH each and borrow 100 DAI at stable rate. Everything is repaid, user 0 withdraws:
-
-      AssertionError: expected '100000000000000000' to be almost equal or equal '0' for property principalStableDebt
-      + expected - actual
-
-      -100000000000000000
-      +0
-      
-      at expectEqual (test/helpers/actions.ts:664:26)
-      at /src/test/helpers/actions.ts:194:5
-      at step (test/helpers/actions.ts:33:23)
-      at Object.next (test/helpers/actions.ts:14:53)
-      at fulfilled (test/helpers/actions.ts:5:58)
-      at runMicrotasks (<anonymous>)
-      at processTicksAndRejections (internal/process/task_queues.js:97:5)
-
-  40) LendingPool: Borrow/repay (stable rate)
-       User 0 deposits 1000 DAI, user 1 deposits 2 WETH and borrow 100 DAI at stable rate first, then 100 DAI at variable rate, repays everything. User 0 withdraws:
-
-      AssertionError: expected '100000000000000000' to be almost equal or equal '0' for property principalStableDebt
-      + expected - actual
-
-      -100000000000000000
-      +0
-      
-      at expectEqual (test/helpers/actions.ts:664:26)
-      at /src/test/helpers/actions.ts:194:5
-      at step (test/helpers/actions.ts:33:23)
-      at Object.next (test/helpers/actions.ts:14:53)
-      at fulfilled (test/helpers/actions.ts:5:58)
-      at runMicrotasks (<anonymous>)
-      at processTicksAndRejections (internal/process/task_queues.js:97:5)
-
-  41) LendingPool: Borrow/repay (variable rate)
-       User 0 deposits 1000 DAI, user 1 deposits 1 WETH as collateral and borrows 100 DAI at variable rate:
-
-      AssertionError: expected '100000000000000000' to be almost equal or equal '0' for property principalStableDebt
-      + expected - actual
-
-      -100000000000000000
-      +0
-      
-      at expectEqual (test/helpers/actions.ts:664:26)
-      at /src/test/helpers/actions.ts:194:5
-      at step (test/helpers/actions.ts:33:23)
-      at Object.next (test/helpers/actions.ts:14:53)
-      at fulfilled (test/helpers/actions.ts:5:58)
-      at runMicrotasks (<anonymous>)
-      at processTicksAndRejections (internal/process/task_queues.js:97:5)
-
-  42) LendingPool: Borrow/repay (variable rate)
-       User 0 deposits 1000 USDC, user 1 deposits 1 WETH as collateral and borrows 100 USDC at variable rate:
-
-      AssertionError: expected '100000000000000000' to be almost equal or equal '0' for property principalStableDebt
-      + expected - actual
-
-      -100000000000000000
-      +0
-      
-      at expectEqual (test/helpers/actions.ts:664:26)
-      at /src/test/helpers/actions.ts:194:5
-      at step (test/helpers/actions.ts:33:23)
-      at Object.next (test/helpers/actions.ts:14:53)
-      at fulfilled (test/helpers/actions.ts:5:58)
-      at runMicrotasks (<anonymous>)
-      at processTicksAndRejections (internal/process/task_queues.js:97:5)
-
-  43) LendingPool: Borrow/repay (variable rate)
-       User 1 repays the USDC borrow after one year:
-     Error: VM Exception while processing transaction: revert 15
-      at HttpProvider.send (node_modules/@nomiclabs/buidler/src/internal/core/providers/http.ts:36:34)
-      at getMultipliedGasEstimation (node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:150:45)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:108:14
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/accounts.ts:219:21
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:63:21
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:82:21
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at EthersProviderWrapper.send (node_modules/@nomiclabs/buidler-ethers/src/ethers-provider-wrapper.ts:13:48)
-      at EthersProviderWrapper.JsonRpcProvider.perform (node_modules/@ethersproject/providers/src.ts/json-rpc-provider.ts:432:21)
-      at EthersProviderWrapper.<anonymous> (node_modules/@ethersproject/providers/src.ts/base-provider.ts:850:42)
-      at step (node_modules/@ethersproject/providers/lib/base-provider.js:46:23)
-      at Object.next (node_modules/@ethersproject/providers/lib/base-provider.js:27:53)
-      at fulfilled (node_modules/@ethersproject/providers/lib/base-provider.js:18:58)
-      at runMicrotasks (<anonymous>)
-      at processTicksAndRejections (internal/process/task_queues.js:97:5)
-
-  44) LendingPool: Borrow/repay (variable rate)
-       User 1 deposits 1000 DAI, user 3 tries to borrow 1000 DAI without any collateral (revert expected):
-
-      AssertionError: The collateral balance is 0: Expected transaction to be reverted
-      + expected - actual
-
-      -Transaction NOT reverted.
-      +Transaction reverted.
-      
-  
-
-  45) LendingPool: Borrow/repay (variable rate)
-       user 3 deposits 0.1 ETH collateral to borrow 100 DAI; 0.1 ETH is not enough to borrow 100 DAI (revert expected):
-
-      AssertionError: There is not enough collateral to cover a new borrow: Expected transaction to be reverted
-      + expected - actual
-
-      -Transaction NOT reverted.
-      +Transaction reverted.
-      
-  
-
-  46) LendingPool: Borrow/repay (variable rate)
-       User 1 deposits 1000 USDC, user 3 tries to borrow 1000 USDC without any collateral (revert expected):
-
-      AssertionError: The collateral balance is 0: Expected transaction to be reverted
-      + expected - actual
-
-      -Transaction NOT reverted.
-      +Transaction reverted.
-      
-  
-
-  47) LendingPool: Borrow/repay (variable rate)
-       user 3 deposits 0.1 ETH collateral to borrow 100 USDC; 0.1 ETH is not enough to borrow 100 USDC (revert expected):
-
-      AssertionError: There is not enough collateral to cover a new borrow: Expected transaction to be reverted
-      + expected - actual
-
-      -Transaction NOT reverted.
-      +Transaction reverted.
-      
-  
-
-  48) LendingPool: Borrow/repay (variable rate)
-       User 0 deposits 1000 DAI, user 6 deposits 2 WETH and borrow 100 DAI at variable rate first, then 100 DAI at stable rate, repays everything. User 0 withdraws:
-     Error: VM Exception while processing transaction: revert 11
-      at HttpProvider.send (node_modules/@nomiclabs/buidler/src/internal/core/providers/http.ts:36:34)
-      at getMultipliedGasEstimation (node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:150:45)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:108:14
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/accounts.ts:219:21
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:63:21
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:82:21
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at EthersProviderWrapper.send (node_modules/@nomiclabs/buidler-ethers/src/ethers-provider-wrapper.ts:13:48)
-      at EthersProviderWrapper.JsonRpcProvider.perform (node_modules/@ethersproject/providers/src.ts/json-rpc-provider.ts:432:21)
-      at EthersProviderWrapper.<anonymous> (node_modules/@ethersproject/providers/src.ts/base-provider.ts:850:42)
-      at step (node_modules/@ethersproject/providers/lib/base-provider.js:46:23)
-      at Object.next (node_modules/@ethersproject/providers/lib/base-provider.js:27:53)
-      at fulfilled (node_modules/@ethersproject/providers/lib/base-provider.js:18:58)
-      at runMicrotasks (<anonymous>)
-      at processTicksAndRejections (internal/process/task_queues.js:97:5)
-
-  49) LendingPool: Deposit
-       User 1 deposits 1 WETH after user 0:
-
-      AssertionError: expected '100000000000000000' to be almost equal or equal '0' for property principalStableDebt
-      + expected - actual
-
-      -100000000000000000
-      +0
-      
-      at expectEqual (test/helpers/actions.ts:664:26)
-      at /src/test/helpers/actions.ts:194:5
-      at step (test/helpers/actions.ts:33:23)
-      at Object.next (test/helpers/actions.ts:14:53)
-      at fulfilled (test/helpers/actions.ts:5:58)
-      at runMicrotasks (<anonymous>)
-      at processTicksAndRejections (internal/process/task_queues.js:97:5)
-
-  50) LendingPool: Rebalance stable rate
-       User 0 deposits 1000 DAI, user 1 deposits 1 ETH, borrows 100 DAI at a variable rate, user 0 rebalances user 1 (revert expected):
-
-      AssertionError: expected '100000000000000000' to be almost equal or equal '0' for property principalStableDebt
-      + expected - actual
-
-      -100000000000000000
-      +0
-      
-      at expectEqual (test/helpers/actions.ts:664:26)
-      at /src/test/helpers/actions.ts:194:5
-      at step (test/helpers/actions.ts:33:23)
-      at Object.next (test/helpers/actions.ts:14:53)
-      at fulfilled (test/helpers/actions.ts:5:58)
-      at runMicrotasks (<anonymous>)
-      at processTicksAndRejections (internal/process/task_queues.js:97:5)
-
-  51) LendingPool: Rebalance stable rate
-       User 1 swaps to stable, user 0 tries to rebalance but the conditions are not met (revert expected):
-     Error: VM Exception while processing transaction: revert 18
-      at HttpProvider.send (node_modules/@nomiclabs/buidler/src/internal/core/providers/http.ts:36:34)
-      at getMultipliedGasEstimation (node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:150:45)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:108:14
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/accounts.ts:219:21
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:63:21
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at /src/node_modules/@nomiclabs/buidler/src/internal/core/providers/gas-providers.ts:82:21
-      at Proxy.cloningSendWrapper (node_modules/@nomiclabs/buidler/src/internal/core/providers/wrapper.ts:9:12)
-      at EthersProviderWrapper.send (node_modules/@nomiclabs/buidler-ethers/src/ethers-provider-wrapper.ts:13:48)
-      at EthersProviderWrapper.JsonRpcProvider.perform (node_modules/@ethersproject/providers/src.ts/json-rpc-provider.ts:432:21)
-      at EthersProviderWrapper.<anonymous> (node_modules/@ethersproject/providers/src.ts/base-provider.ts:850:42)
-      at step (node_modules/@ethersproject/providers/lib/base-provider.js:46:23)
-      at Object.next (node_modules/@ethersproject/providers/lib/base-provider.js:27:53)
-      at fulfilled (node_modules/@ethersproject/providers/lib/base-provider.js:18:58)
-      at runMicrotasks (<anonymous>)
-      at processTicksAndRejections (internal/process/task_queues.js:97:5)
-
-  52) LendingPool: Rebalance stable rate
-       User 2 deposits ETH and borrows the remaining DAI, causing the stable rates to rise (liquidity rate < user 1 borrow rate). User 0 tries to rebalance user 1 (revert expected):
-
-      AssertionError: expected '0' to be almost equal or equal '100000000006972721' for property principalStableDebt
-      + expected - actual
-
-      -0
-      +100000000006972721
-      
-      at expectEqual (test/helpers/actions.ts:664:26)
-      at /src/test/helpers/actions.ts:194:5
-      at step (test/helpers/actions.ts:33:23)
-      at Object.next (test/helpers/actions.ts:14:53)
-      at fulfilled (test/helpers/actions.ts:5:58)
-      at runMicrotasks (<anonymous>)
-      at processTicksAndRejections (internal/process/task_queues.js:97:5)
-
-  53) LendingPool: Rebalance stable rate
-       User 2 borrows more DAI, causing the liquidity rate to rise above user 1 stable borrow rate User 0 rebalances user 1:
-
-      AssertionError: expected '0' to be almost equal or equal '100000000009270565' for property principalStableDebt
-      + expected - actual
-
-      -0
-      +100000000009270565
-      
-      at expectEqual (test/helpers/actions.ts:664:26)
-      at /src/test/helpers/actions.ts:194:5
-      at step (test/helpers/actions.ts:33:23)
-      at Object.next (test/helpers/actions.ts:14:53)
-      at fulfilled (test/helpers/actions.ts:5:58)
-      at runMicrotasks (<anonymous>)
-      at processTicksAndRejections (internal/process/task_queues.js:97:5)
-
-  54) LendingPool: Usage as collateral
-       User 0 Deposits 1000 DAI, disables DAI as collateral:
-
-      AssertionError: expected '4000000000706215436781' to be almost equal or equal '4000000000676018902879' for property currentATokenBalance
-      + expected - actual
-
-      -4000000000706215436781
-      +4000000000676018902879
-      
-      at expectEqual (test/helpers/actions.ts:664:26)
-      at /src/test/helpers/actions.ts:509:5
-      at step (test/helpers/actions.ts:33:23)
-      at Object.next (test/helpers/actions.ts:14:53)
-      at fulfilled (test/helpers/actions.ts:5:58)
-      at runMicrotasks (<anonymous>)
-      at processTicksAndRejections (internal/process/task_queues.js:97:5)
-
-  55) LendingPool: Usage as collateral
-       User 1 Deposits 2 ETH, disables ETH as collateral, borrows 400 DAI (revert expected):
-
-      AssertionError: expected '100000000000000000' to be almost equal or equal '0' for property principalStableDebt
-      + expected - actual
-
-      -100000000000000000
-      +0
-      
-      at expectEqual (test/helpers/actions.ts:664:26)
-      at /src/test/helpers/actions.ts:194:5
-      at step (test/helpers/actions.ts:33:23)
-      at Object.next (test/helpers/actions.ts:14:53)
-      at fulfilled (test/helpers/actions.ts:5:58)
-      at runMicrotasks (<anonymous>)
-      at processTicksAndRejections (internal/process/task_queues.js:97:5)
-
-  56) LendingPool: Usage as collateral
-       User 1 enables ETH as collateral, borrows 400 DAI:
-
-      AssertionError: expected '4000000000008306119' to be almost equal or equal '4000000000007484590' for property currentATokenBalance
-      + expected - actual
-
-      -4000000000008306119
-      +4000000000007484590
-      
-      at expectEqual (test/helpers/actions.ts:664:26)
-      at /src/test/helpers/actions.ts:509:5
-      at step (test/helpers/actions.ts:33:23)
-      at Object.next (test/helpers/actions.ts:14:53)
-      at fulfilled (test/helpers/actions.ts:5:58)
-      at runMicrotasks (<anonymous>)
-      at processTicksAndRejections (internal/process/task_queues.js:97:5)
-
-  57) LendingPool: Usage as collateral
-       User 1 disables ETH as collateral (revert expected):
-
-      AssertionError: User deposit is already being used as collateral: Expected transaction to be reverted
-      + expected - actual
-
-      -Transaction NOT reverted.
-      +Transaction reverted.
-      
-  
-
-  58) LendingPool: Swap rate mode
-       User 0 deposits 1000 DAI, user 1 deposits 2 ETH as collateral, borrows 100 DAI at variable rate and swaps to stable after one year:
-
-      AssertionError: expected '100000000000000000' to be almost equal or equal '0' for property principalStableDebt
-      + expected - actual
-
-      -100000000000000000
-      +0
-      
-      at expectEqual (test/helpers/actions.ts:664:26)
-      at /src/test/helpers/actions.ts:194:5
-      at step (test/helpers/actions.ts:33:23)
-      at Object.next (test/helpers/actions.ts:14:53)
-      at fulfilled (test/helpers/actions.ts:5:58)
-      at runMicrotasks (<anonymous>)
-      at processTicksAndRejections (internal/process/task_queues.js:97:5)
-
-  59) LendingPool: Redeem negative test cases
-       Users 0 tries to redeem 1100 DAI from the 1000 DAI deposited (revert expected):
-
-      AssertionError: User cannot redeem more than the available balance: Expected transaction to be reverted
-      + expected - actual
-
-      -Transaction NOT reverted.
-      +Transaction reverted.
-      
-  
-
-  60) LendingPool: Redeem negative test cases
-       Users 1 deposits 1 WETH, borrows 100 DAI, tries to redeem the 1 WETH deposited (revert expected):
-
-      AssertionError: expected '100000000000000000' to be almost equal or equal '0' for property principalStableDebt
-      + expected - actual
-
-      -100000000000000000
-      +0
-      
-      at expectEqual (test/helpers/actions.ts:664:26)
-      at /src/test/helpers/actions.ts:194:5
-      at step (test/helpers/actions.ts:33:23)
-      at Object.next (test/helpers/actions.ts:14:53)
-      at fulfilled (test/helpers/actions.ts:5:58)
-      at runMicrotasks (<anonymous>)
-      at processTicksAndRejections (internal/process/task_queues.js:97:5)
-
-  61) LendingPool: withdraw
-       Users 0 deposits 1000 DAI, user 1 Deposit 1000 USDC and 1 WETH, borrows 100 DAI. User 1 tries to withdraw all the USDC:
-
-      AssertionError: expected '100000000000000000' to be almost equal or equal '0' for property principalStableDebt
-      + expected - actual
-
-      -100000000000000000
-      +0
-      
-      at expectEqual (test/helpers/actions.ts:664:26)
-      at /src/test/helpers/actions.ts:194:5
-      at step (test/helpers/actions.ts:33:23)
-      at Object.next (test/helpers/actions.ts:14:53)
-      at fulfilled (test/helpers/actions.ts:5:58)
-      at runMicrotasks (<anonymous>)
-      at processTicksAndRejections (internal/process/task_queues.js:97:5)
-
-
-

From d4abc123492f637ef12a3e424c3360db5694fdf6 Mon Sep 17 00:00:00 2001
From: The3D <emilio@aave.com>
Date: Thu, 22 Oct 2020 19:06:37 +0200
Subject: [PATCH 09/13] Updated wadDiv

---
 contracts/libraries/math/WadRayMath.sol | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/contracts/libraries/math/WadRayMath.sol b/contracts/libraries/math/WadRayMath.sol
index 949118c6..6b67641c 100644
--- a/contracts/libraries/math/WadRayMath.sol
+++ b/contracts/libraries/math/WadRayMath.sol
@@ -74,10 +74,6 @@ library WadRayMath {
   function wadDiv(uint256 a, uint256 b) internal pure returns (uint256) {
     require(b != 0, Errors.DIVISION_BY_ZERO);
 
-    if (a == 0) {
-      return 0;
-    }
-
     uint256 halfB = b / 2;
 
     uint256 result = a * WAD;

From dadebe9d2cc4683cdc114e0195c2fec4189066ab Mon Sep 17 00:00:00 2001
From: The3D <emilio@aave.com>
Date: Fri, 23 Oct 2020 10:57:22 +0200
Subject: [PATCH 10/13] Updated optimization

---
 contracts/libraries/math/WadRayMath.sol | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/contracts/libraries/math/WadRayMath.sol b/contracts/libraries/math/WadRayMath.sol
index 6b67641c..696a0e09 100644
--- a/contracts/libraries/math/WadRayMath.sol
+++ b/contracts/libraries/math/WadRayMath.sol
@@ -100,7 +100,7 @@ library WadRayMath {
 
     uint256 result = a * b + halfRAY;
 
-    require((result - halfRAY) / a == b, Errors.MULTIPLICATION_OVERFLOW);
+    require(result >= halfRAY && (result - halfRAY) / a == b, Errors.MULTIPLICATION_OVERFLOW);
 
     return result / RAY;
   }
@@ -118,7 +118,7 @@ library WadRayMath {
 
     uint256 result = a * RAY + halfB;
 
-    require((result - halfB) / RAY == a, Errors.MULTIPLICATION_OVERFLOW);
+    require(result >= halfB && (result - halfB) / RAY == a, Errors.MULTIPLICATION_OVERFLOW);
 
     return result / b;
   }

From 614244272e0ee802f324f30bc93b9f0054d50f34 Mon Sep 17 00:00:00 2001
From: The3D <emilio@aave.com>
Date: Fri, 23 Oct 2020 12:20:06 +0200
Subject: [PATCH 11/13] Added the gas reporter

---
 buidler.config.ts | 2 +-
 package.json      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/buidler.config.ts b/buidler.config.ts
index ae6ef7e3..878bc53f 100644
--- a/buidler.config.ts
+++ b/buidler.config.ts
@@ -11,7 +11,7 @@ usePlugin('buidler-typechain');
 usePlugin('solidity-coverage');
 usePlugin('@nomiclabs/buidler-waffle');
 usePlugin('@nomiclabs/buidler-etherscan');
-//usePlugin('buidler-gas-reporter');
+usePlugin('buidler-gas-reporter');
 
 const SKIP_LOAD = process.env.SKIP_LOAD === 'true';
 const DEFAULT_BLOCK_GAS_LIMIT = 10000000;
diff --git a/package.json b/package.json
index 1c0bfb5b..bb6816d4 100644
--- a/package.json
+++ b/package.json
@@ -59,7 +59,7 @@
     "@types/mocha": "7.0.2",
     "@types/node": "14.0.5",
     "bignumber.js": "9.0.0",
-    "buidler-gas-reporter": "^0.1.3",
+    "buidler-gas-reporter": "^0.1.4",
     "buidler-typechain": "0.1.1",
     "chai": "4.2.0",
     "chai-bignumber": "3.0.0",

From 86d25393e9cf18856f0d237f9057a525836f555b Mon Sep 17 00:00:00 2001
From: The3D <emilio@aave.com>
Date: Fri, 23 Oct 2020 13:09:19 +0200
Subject: [PATCH 12/13] Add small optimization in _mintToTreasury

---
 contracts/libraries/logic/ReserveLogic.sol | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/contracts/libraries/logic/ReserveLogic.sol b/contracts/libraries/logic/ReserveLogic.sol
index c253d6a9..ee6749da 100644
--- a/contracts/libraries/logic/ReserveLogic.sol
+++ b/contracts/libraries/logic/ReserveLogic.sol
@@ -359,7 +359,9 @@ library ReserveLogic {
 
     vars.amountToMint = vars.totalDebtAccrued.percentMul(vars.reserveFactor);
 
-    IAToken(reserve.aTokenAddress).mintToTreasury(vars.amountToMint, newLiquidityIndex);
+    if (vars.amountToMint != 0) {
+      IAToken(reserve.aTokenAddress).mintToTreasury(vars.amountToMint, newLiquidityIndex);
+    }
   }
 
   /**

From 4e1a8c29bd904b8dce47a8a7c83cf80d67fc6693 Mon Sep 17 00:00:00 2001
From: The3D <emilio@aave.com>
Date: Fri, 23 Oct 2020 16:52:22 +0200
Subject: [PATCH 13/13] Fixed wad functions in WadRayMath

---
 contracts/libraries/math/WadRayMath.sol | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/contracts/libraries/math/WadRayMath.sol b/contracts/libraries/math/WadRayMath.sol
index 696a0e09..a1a8d8f4 100644
--- a/contracts/libraries/math/WadRayMath.sol
+++ b/contracts/libraries/math/WadRayMath.sol
@@ -60,7 +60,7 @@ library WadRayMath {
 
     uint256 result = a * b + halfWAD;
 
-    require((result - halfWAD) / a == b, Errors.MULTIPLICATION_OVERFLOW);
+    require(result >= halfWAD && (result - halfWAD) / a == b, Errors.MULTIPLICATION_OVERFLOW);
 
     return result / WAD;
   }
@@ -76,13 +76,9 @@ library WadRayMath {
 
     uint256 halfB = b / 2;
 
-    uint256 result = a * WAD;
+    uint256 result = a * WAD + halfB;
 
-    require(result / WAD == a, Errors.MULTIPLICATION_OVERFLOW);
-
-    result += halfB;
-
-    require(result >= halfB, Errors.ADDITION_OVERFLOW);
+    require(result >= halfB && (result - halfB) / WAD == a, Errors.MULTIPLICATION_OVERFLOW);
 
     return result / b;
   }