From 90b2625bc0bba598f784240d51f81351b25857ec Mon Sep 17 00:00:00 2001
From: The3D <emilio@aave.com>
Date: Wed, 19 Aug 2020 12:56:39 +0200
Subject: [PATCH] Refactored tests, burn and mint function

---
 contracts/lendingpool/LendingPool.sol         |  7 +-
 .../LendingPoolLiquidationManager.sol         |  4 +-
 contracts/tokenization/AToken.sol             | 74 ++++----------
 deployed-contracts.json                       | 98 ++++++++++---------
 test/atoken-modifiers.spec.ts                 | 10 +-
 test/helpers/actions.ts                       | 28 +++---
 test/helpers/scenario-engine.ts               |  8 +-
 .../scenarios/borrow-repay-stable.json        | 12 +--
 .../scenarios/borrow-repay-variable.json      | 36 +++----
 .../scenarios/interest-redirection.json       | 24 ++---
 ...negatives.json => withdraw-negatives.json} |  6 +-
 .../scenarios/{redeem.json => withdraw.json}  | 38 +++----
 test/helpers/utils/calculations.ts            | 36 ++++---
 13 files changed, 173 insertions(+), 208 deletions(-)
 rename test/helpers/scenarios/{redeem-negatives.json => withdraw-negatives.json} (96%)
 rename test/helpers/scenarios/{redeem.json => withdraw.json} (87%)

diff --git a/contracts/lendingpool/LendingPool.sol b/contracts/lendingpool/LendingPool.sol
index 26d124ab..5dc5a93e 100644
--- a/contracts/lendingpool/LendingPool.sol
+++ b/contracts/lendingpool/LendingPool.sol
@@ -277,7 +277,7 @@ contract LendingPool is ReentrancyGuard, VersionedInitializable {
     }
 
     //minting AToken to user 1:1 with the specific exchange rate
-    aToken.mintOnDeposit(msg.sender, _amount);
+    aToken.mint(msg.sender, _amount);
 
     //transfer to the aToken contract
     IERC20(_reserve).safeTransferFrom(msg.sender, address(aToken), _amount);
@@ -287,8 +287,7 @@ contract LendingPool is ReentrancyGuard, VersionedInitializable {
   }
 
   /**
-   * @dev Redeems the underlying amount of assets requested by _user.
-   * This function is executed by the overlying aToken contract in response to a redeem action.
+   * @dev withdraws the assets of _user.
    * @param _reserve the address of the reserve
    * @param _amount the underlying amount to be redeemed
    **/
@@ -325,7 +324,7 @@ contract LendingPool is ReentrancyGuard, VersionedInitializable {
       usersConfig[msg.sender].setUsingAsCollateral(reserve.index, false);
     }
 
-    aToken.burnOnWithdraw(msg.sender, _amount);
+    aToken.burn(msg.sender, msg.sender, amountToWithdraw);
 
     //solium-disable-next-line
     emit Withdraw(_reserve, msg.sender, _amount, block.timestamp);
diff --git a/contracts/lendingpool/LendingPoolLiquidationManager.sol b/contracts/lendingpool/LendingPoolLiquidationManager.sol
index 04dcb2b9..ff0da778 100644
--- a/contracts/lendingpool/LendingPoolLiquidationManager.sol
+++ b/contracts/lendingpool/LendingPoolLiquidationManager.sol
@@ -146,7 +146,6 @@ contract LendingPoolLiquidationManager is ReentrancyGuard, VersionedInitializabl
 
     vars.userCollateralBalance = IERC20(collateralReserve.aTokenAddress).balanceOf(_user);
 
-
     vars.isCollateralEnabled =
       collateralReserve.configuration.getLiquidationThreshold() > 0 &&
       userConfig.isUsingAsCollateral(collateralReserve.index);
@@ -247,8 +246,7 @@ contract LendingPoolLiquidationManager is ReentrancyGuard, VersionedInitializabl
       collateralReserve.updateInterestRates(_collateral, 0, vars.maxCollateralToLiquidate);
 
       //burn the equivalent amount of atoken
-      vars.collateralAtoken.burnOnLiquidation(_user, vars.maxCollateralToLiquidate);
-      vars.collateralAtoken.transferUnderlyingTo(msg.sender, vars.maxCollateralToLiquidate);
+      vars.collateralAtoken.burn(_user, msg.sender, vars.maxCollateralToLiquidate);
     }
 
     //transfers the principal currency to the aToken
diff --git a/contracts/tokenization/AToken.sol b/contracts/tokenization/AToken.sol
index 24b2943b..c30a07e9 100644
--- a/contracts/tokenization/AToken.sol
+++ b/contracts/tokenization/AToken.sol
@@ -24,14 +24,15 @@ contract AToken is VersionedInitializable, ERC20 {
   uint256 public constant UINT_MAX_VALUE = uint256(-1);
 
   /**
-   * @dev emitted after the redeem action
+   * @dev emitted after aTokens are burned
    * @param _from the address performing the redeem
    * @param _value the amount to be redeemed
    * @param _fromBalanceIncrease the cumulated balance since the last update of the user
    * @param _fromIndex the last index of the user
    **/
-  event BurnOnWithdraw(
+  event Burn(
     address indexed _from,
+    address indexed _target,
     uint256 _value,
     uint256 _fromBalanceIncrease,
     uint256 _fromIndex
@@ -44,22 +45,7 @@ contract AToken is VersionedInitializable, ERC20 {
    * @param _fromBalanceIncrease the cumulated balance since the last update of the user
    * @param _fromIndex the last index of the user
    **/
-  event MintOnDeposit(
-    address indexed _from,
-    uint256 _value,
-    uint256 _fromBalanceIncrease,
-    uint256 _fromIndex
-  );
-
-  /**
-   * @dev emitted during the liquidation action, when the liquidator reclaims the underlying
-   * asset
-   * @param _from the address from which the tokens are being burned
-   * @param _value the amount to be burned
-   * @param _fromBalanceIncrease the cumulated balance since the last update of the user
-   * @param _fromIndex the last index of the user
-   **/
-  event BurnOnLiquidation(
+  event Mint(
     address indexed _from,
     uint256 _value,
     uint256 _fromBalanceIncrease,
@@ -216,10 +202,15 @@ contract AToken is VersionedInitializable, ERC20 {
   }
 
   /**
-   * @dev redeems aToken for the underlying asset
-   * @param _amount the amount being redeemed
+   * @dev burns the aTokens and sends the equivalent amount of underlying to the target.
+   * only lending pools can call this function
+   * @param _amount the amount being burned
    **/
-  function burnOnWithdraw(address _user, uint256 _amount) external onlyLendingPool {
+  function burn(
+    address _user,
+    address _underlyingTarget,
+    uint256 _amount
+  ) external onlyLendingPool {
     //cumulates the balance of the user
     (, uint256 currentBalance, uint256 balanceIncrease) = calculateBalanceIncreaseInternal(_user);
 
@@ -244,19 +235,19 @@ contract AToken is VersionedInitializable, ERC20 {
       userIndex = userIndexes[_user] = pool.getReserveNormalizedIncome(underlyingAssetAddress);
     }
 
-    //transfers the underlying to the user
-    ERC20(underlyingAssetAddress).safeTransfer(_user, _amount);
+    //transfers the underlying to the target
+    ERC20(underlyingAssetAddress).safeTransfer(_underlyingTarget, _amount);
 
-    emit BurnOnWithdraw(msg.sender, _amount, balanceIncrease, userIndex);
+    emit Burn(msg.sender, _underlyingTarget, _amount, balanceIncrease, userIndex);
   }
 
   /**
-   * @dev mints token in the event of users depositing the underlying asset into the lending pool
+   * @dev mints aTokens to _user
    * only lending pools can call this function
    * @param _user the address receiving the minted tokens
    * @param _amount the amount of tokens to mint
    */
-  function mintOnDeposit(address _user, uint256 _amount) external onlyLendingPool {
+  function mint(address _user, uint256 _amount) external onlyLendingPool {
     //cumulates the balance of the user
     (, , uint256 balanceIncrease) = calculateBalanceIncreaseInternal(_user);
 
@@ -271,36 +262,7 @@ contract AToken is VersionedInitializable, ERC20 {
     //mint an equivalent amount of tokens to cover the new deposit
     _mint(_user, _amount.add(balanceIncrease));
 
-    emit MintOnDeposit(_user, _amount, balanceIncrease, index);
-  }
-
-  /**
-   * @dev burns token in the event of a borrow being liquidated, in case the liquidators reclaims the underlying asset
-   * Transfer of the liquidated asset is executed by the lending pool contract.
-   * only lending pools can call this function
-   * @param _account the address from which burn the aTokens
-   * @param _value the amount to burn
-   **/
-  function burnOnLiquidation(address _account, uint256 _value) external onlyLendingPool {
-    //cumulates the balance of the user being liquidated
-    (, uint256 accountBalance, uint256 balanceIncrease, uint256 index) = cumulateBalanceInternal(
-      _account
-    );
-
-    //adds the accrued interest and substracts the burned amount to
-    //the redirected balance
-    updateRedirectedBalanceOfRedirectionAddressInternal(_account, balanceIncrease, _value);
-
-    //burns the requested amount of tokens
-    _burn(_account, _value);
-
-    bool userIndexReset = false;
-    //reset the user data if the remaining balance is 0
-    if (accountBalance.sub(_value) == 0) {
-      userIndexReset = resetDataOnZeroBalanceInternal(_account);
-    }
-
-    emit BurnOnLiquidation(_account, _value, balanceIncrease, userIndexReset ? 0 : index);
+    emit Mint(_user, _amount, balanceIncrease, index);
   }
 
   /**
diff --git a/deployed-contracts.json b/deployed-contracts.json
index b0c89b14..24841c72 100644
--- a/deployed-contracts.json
+++ b/deployed-contracts.json
@@ -5,7 +5,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x666D47050E77ADB0B04076fB35DDcb74e95D1d7C",
+      "address": "0x58F132FBB86E21545A4Bace3C19f1C05d86d7A22",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     }
   },
@@ -15,7 +15,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x1FB61ED838A993b8885Ceb08936524F742F525cf",
+      "address": "0xa4bcDF64Cdd5451b6ac3743B414124A6299B65FF",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     }
   },
@@ -25,7 +25,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0xcBf7A8f676Bf5fa60339ba8dFab867D4a074c604",
+      "address": "0x5A0773Ff307Bf7C71a832dBB5312237fD3437f9F",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     }
   },
@@ -34,7 +34,7 @@
       "address": "0xD9273d497eDBC967F39d419461CfcF382a0A822e"
     },
     "localhost": {
-      "address": "0x26aBe949b24C10cc9b1d33100Cd7fF3Aa5e4C698"
+      "address": "0xD9273d497eDBC967F39d419461CfcF382a0A822e"
     }
   },
   "LendingPoolParametersProvider": {
@@ -52,7 +52,7 @@
       "address": "0x9EC0480CF106d6dc1c7849BA141a56F874170F97"
     },
     "localhost": {
-      "address": "0xaD0FdA3C2D467DEE48DFc3b4C123240F6e90D3c2"
+      "address": "0x9EC0480CF106d6dc1c7849BA141a56F874170F97"
     }
   },
   "LendingPoolDataProvider": {
@@ -65,7 +65,7 @@
       "address": "0x6642B57e4265BAD868C17Fc1d1F4F88DBBA04Aa8"
     },
     "localhost": {
-      "address": "0x29c1e17Ac4aAf9fEE3091A8DdAAf5B7798bcC4b9"
+      "address": "0x6642B57e4265BAD868C17Fc1d1F4F88DBBA04Aa8"
     }
   },
   "PriceOracle": {
@@ -74,7 +74,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0xfdAF4f6e47e854c05bE158993d32872e784F0502",
+      "address": "0x099d9fF8F818290C8b5B7Db5bFca84CEebd2714c",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     }
   },
@@ -84,7 +84,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x8d0FF86F21174b33f86A2673E96e8D7a472659A3",
+      "address": "0xAF6BA11790D1942625C0c2dA07da19AB63845cfF",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     }
   },
@@ -94,7 +94,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0xf6fFAbB561D5b265127459cB7e43c89f58b7cAbe",
+      "address": "0xD83D2773a7873ae2b5f8Fb92097e20a8C64F691E",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     }
   },
@@ -104,7 +104,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x5DAe571bb5B70f9851eeef12E3a43f548dCF923c",
+      "address": "0xf91aC1098F3b154671Ce83290114aaE45ac0225f",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     }
   },
@@ -114,7 +114,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x5a3343A0CF72dC6933362676Bb5831784CaA0014",
+      "address": "0x830bceA96E56DBC1F8578f75fBaC0AF16B32A07d",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     }
   },
@@ -149,7 +149,7 @@
       "address": "0x2cfcA5785261fbC88EFFDd46fCFc04c22525F9e4"
     },
     "localhost": {
-      "address": "0x61751f72Fa303F3bB256707dD3cD368c89E82f1b"
+      "address": "0x2cfcA5785261fbC88EFFDd46fCFc04c22525F9e4"
     }
   },
   "InitializableAdminUpgradeabilityProxy": {
@@ -158,7 +158,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x61751f72Fa303F3bB256707dD3cD368c89E82f1b",
+      "address": "0x2cfcA5785261fbC88EFFDd46fCFc04c22525F9e4",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     }
   },
@@ -167,7 +167,7 @@
       "address": "0x3bDA11B584dDff7F66E0cFe1da1562c92B45db60"
     },
     "localhost": {
-      "address": "0xdF19a9539Fdd701D8334299C6Dd04931e4022303"
+      "address": "0x3bDA11B584dDff7F66E0cFe1da1562c92B45db60"
     }
   },
   "WalletBalanceProvider": {
@@ -176,7 +176,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0xBe6d8642382C241c9B4B50c89574DbF3f4181E7D",
+      "address": "0x392E5355a0e88Bd394F717227c752670fb3a8020",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     }
   },
@@ -186,7 +186,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x8733AfE8174BA7c04c6CD694bD673294079b7E10",
+      "address": "0x7c2C195CD6D34B8F845992d380aADB2730bB9C6F",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     }
   },
@@ -196,7 +196,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0xA8083d78B6ABC328b4d3B714F76F384eCC7147e1",
+      "address": "0x8858eeB3DfffA017D4BCE9801D340D36Cf895CCf",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     }
   },
@@ -206,7 +206,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0xa497f1Ed4edeA8151fECe457aa26e1D6A4318B6A",
+      "address": "0x0078371BDeDE8aAc7DeBfFf451B74c5EDB385Af7",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     }
   },
@@ -216,7 +216,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0xB7b9568073C9e745acD84eEb30F1c32F74Ba4946",
+      "address": "0xf4e77E5Da47AC3125140c470c71cBca77B5c638c",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     }
   },
@@ -226,7 +226,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x64999a4272342C910FB8f6a71C2Ca50b878a8658",
+      "address": "0x3619DbE27d7c1e7E91aA738697Ae7Bc5FC3eACA5",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     }
   },
@@ -236,7 +236,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0xFB6800f1BB30e235587b574F8Ce6c7bba2242276",
+      "address": "0x038B86d9d8FAFdd0a02ebd1A476432877b0107C8",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     }
   },
@@ -246,7 +246,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x832D8fDeeE7Df842796582bC7F804802c2c666fd",
+      "address": "0x1A1FEe7EeD918BD762173e4dc5EfDB8a78C924A8",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     }
   },
@@ -256,7 +256,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x8628E920E86DA923A79A57Ab4282CC9f89E12CEf",
+      "address": "0x500D1d6A4c7D8Ae28240b47c8FCde034D827fD5e",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     }
   },
@@ -266,7 +266,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x04C90bD686E03782737C3f4C6bDC88dc3C92bDec",
+      "address": "0xc4905364b78a742ccce7B890A89514061E47068D",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     }
   },
@@ -276,7 +276,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x002164e9C8425D2F0c7dcde98E63317D305302C5",
+      "address": "0xD6C850aeBFDC46D7F4c207e445cC0d6B0919BDBe",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     }
   },
@@ -286,7 +286,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0xAe407A0bD891d02E495D3E79cE577C17BB61f366",
+      "address": "0x8B5B7a6055E54a36fF574bbE40cf2eA68d5554b3",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     }
   },
@@ -296,7 +296,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x96cf3831338c19F309121D48C12C3aB489FE7D5A",
+      "address": "0xEcc0a6dbC0bb4D51E4F84A315a9e5B0438cAD4f0",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     }
   },
@@ -306,7 +306,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0xfd1346a9ee71839D6103C76Bb63d1592971C23aE",
+      "address": "0x20Ce94F404343aD2752A2D01b43fa407db9E0D00",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     }
   },
@@ -316,7 +316,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x9884cF2d612CdD7031cCaa12dd3Bc69D754fc701",
+      "address": "0x1d80315fac6aBd3EfeEbE97dEc44461ba7556160",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     }
   },
@@ -326,7 +326,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x48fc85A6fcD880e2421586f4F9116f14e854E109",
+      "address": "0x2D8553F9ddA85A9B3259F6Bf26911364B85556F5",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     }
   },
@@ -336,7 +336,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x1bfF9DBd010EF644863918f77aCF79BD35721c13",
+      "address": "0x52d3b94181f8654db2530b0fEe1B19173f519C52",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     }
   },
@@ -346,7 +346,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0xB42D37cB0E78aaCC5980eC6B2EcB98CBeCeB9df7",
+      "address": "0xd15468525c35BDBC1eD8F2e09A00F8a173437f2f",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     }
   },
@@ -356,7 +356,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x8051CFC72E5c27fD752834a854eDD306c254D3b1",
+      "address": "0x7e35Eaf7e8FBd7887ad538D4A38Df5BbD073814a",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     }
   },
@@ -366,7 +366,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x2F16C47532625acE7C652FC5EE7E9a9080B352f5",
+      "address": "0x5bcb88A0d20426e451332eE6C4324b0e663c50E0",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     }
   },
@@ -376,7 +376,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x7483ADEC5d3dA2203CCB2Fc5F837c6F8a1A92099",
+      "address": "0x3521eF8AaB0323004A6dD8b03CE890F4Ea3A13f5",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     }
   },
@@ -386,7 +386,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0xe6688b6Cc79268D2e39f799C08673034a5350F13",
+      "address": "0x53369fd4680FfE3DfF39Fc6DDa9CfbfD43daeA2E",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     }
   },
@@ -396,7 +396,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0xFa58524E6B3E432fb10B41A9fea95BAD32A608eF",
+      "address": "0xB00cC45B4a7d3e1FEE684cFc4417998A1c183e6d",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     }
   },
@@ -406,7 +406,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x666D47050E77ADB0B04076fB35DDcb74e95D1d7C",
+      "address": "0x58F132FBB86E21545A4Bace3C19f1C05d86d7A22",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     }
   },
@@ -415,7 +415,7 @@
       "address": "0x3b050AFb4ac4ACE646b31fF3639C1CD43aC31460"
     },
     "localhost": {
-      "address": "0x02BB514187B830d6A2111197cd7D8cb60650B970"
+      "address": "0x3b050AFb4ac4ACE646b31fF3639C1CD43aC31460"
     }
   },
   "StableDebtToken": {
@@ -424,7 +424,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0xbC15a5eEA769cfB4BA6d7574c9942f0b8C40Ae03",
+      "address": "0xA0AB1cB92A4AF81f84dCd258155B5c25D247b54E",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     }
   },
@@ -434,13 +434,13 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x3c3AB51fF33032159e82E1FDEe6503dEd082F1d9",
+      "address": "0x5f7134cd38C826a7649f9Cc47dda24d834DD2967",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     }
   },
   "AToken": {
     "localhost": {
-      "address": "0x2d17b3E44e413F1fDa30E569895863EeD139CE6B",
+      "address": "0xE91bBe8ee03560E3dda2786f95335F5399813Ca0",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "buidlerevm": {
@@ -454,7 +454,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0xc2517909aE3cFacC0283EB8FB917EAe273a3aE9e",
+      "address": "0x7f23223A2FAf869962B38f5eC4aAB7f37454A45e",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     }
   },
@@ -464,7 +464,7 @@
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     },
     "localhost": {
-      "address": "0x501A498e8FDA589038d6526C2153a9fdc9d8eDD2",
+      "address": "0xf784709d2317D872237C4bC22f867d1BAe2913AB",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     }
   },
@@ -472,12 +472,20 @@
     "buidlerevm": {
       "address": "0x6aaF7e94e099291a94ed8E245c90f4766CE9bB7C",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
+    },
+    "localhost": {
+      "address": "0x1203D1b97BF6E546c00C45Cda035D3010ACe1180",
+      "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     }
   },
   "MockVariableDebtToken": {
     "buidlerevm": {
       "address": "0x40A939911b662656C0EE71c19B954DB1911Dc8e3",
       "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
+    },
+    "localhost": {
+      "address": "0x8733AfE8174BA7c04c6CD694bD673294079b7E10",
+      "deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
     }
   }
-}
\ No newline at end of file
+}
diff --git a/test/atoken-modifiers.spec.ts b/test/atoken-modifiers.spec.ts
index c3f54a51..97115c0c 100644
--- a/test/atoken-modifiers.spec.ts
+++ b/test/atoken-modifiers.spec.ts
@@ -5,16 +5,14 @@ import {ProtocolErrors} from '../helpers/types';
 makeSuite('AToken: Modifiers', (testEnv: TestEnv) => {
   const {INVALID_POOL_CALLER_MSG_1} = ProtocolErrors;
 
-  it('Tries to invoke mintOnDeposit not being the LendingPool', async () => {
+  it('Tries to invoke mint not being the LendingPool', async () => {
     const {deployer, aDai} = testEnv;
-    await expect(aDai.mintOnDeposit(deployer.address, '1')).to.be.revertedWith(
-      INVALID_POOL_CALLER_MSG_1
-    );
+    await expect(aDai.mint(deployer.address, '1')).to.be.revertedWith(INVALID_POOL_CALLER_MSG_1);
   });
 
-  it('Tries to invoke burnOnLiquidation not being the LendingPool', async () => {
+  it('Tries to invoke burn not being the LendingPool', async () => {
     const {deployer, aDai} = testEnv;
-    await expect(aDai.burnOnLiquidation(deployer.address, '1')).to.be.revertedWith(
+    await expect(aDai.burn(deployer.address, deployer.address, '1')).to.be.revertedWith(
       INVALID_POOL_CALLER_MSG_1
     );
   });
diff --git a/test/helpers/actions.ts b/test/helpers/actions.ts
index b39627d5..cb5e3fe4 100644
--- a/test/helpers/actions.ts
+++ b/test/helpers/actions.ts
@@ -2,9 +2,9 @@ import BigNumber from 'bignumber.js';
 
 import {
   calcExpectedReserveDataAfterDeposit,
-  calcExpectedReserveDataAfterRedeem,
+  calcExpectedReserveDataAfterWithdraw,
   calcExpectedUserDataAfterDeposit,
-  calcExpectedUserDataAfterRedeem,
+  calcExpectedUserDataAfterWithdraw,
   calcExpectedReserveDataAfterBorrow,
   calcExpectedUserDataAfterBorrow,
   calcExpectedReserveDataAfterRepay,
@@ -206,7 +206,7 @@ export const deposit = async (
   }
 };
 
-export const redeem = async (
+export const withdraw = async (
   reserveSymbol: string,
   amount: string,
   user: SignerWithAddress,
@@ -214,6 +214,8 @@ export const redeem = async (
   testEnv: TestEnv,
   revertMessage?: string
 ) => {
+  const {pool} = testEnv;
+
   const {
     aTokenInstance,
     reserve,
@@ -221,17 +223,17 @@ export const redeem = async (
     reserveData: reserveDataBefore,
   } = await getDataBeforeAction(reserveSymbol, user.address, testEnv);
 
-  let amountToRedeem = '0';
+  let amountToWithdraw = '0';
 
   if (amount !== '-1') {
-    amountToRedeem = (await convertToCurrencyDecimals(reserve, amount)).toString();
+    amountToWithdraw = (await convertToCurrencyDecimals(reserve, amount)).toString();
   } else {
-    amountToRedeem = MAX_UINT_AMOUNT;
+    amountToWithdraw = MAX_UINT_AMOUNT;
   }
 
   if (expectedResult === 'success') {
     const txResult = await waitForTx(
-      await aTokenInstance.connect(user.signer).redeem(amountToRedeem)
+      await pool.connect(user.signer).withdraw(reserve, amountToWithdraw)
     );
 
     const {
@@ -242,15 +244,15 @@ export const redeem = async (
 
     const {txCost, txTimestamp} = await getTxCostAndTimestamp(txResult);
 
-    const expectedReserveData = calcExpectedReserveDataAfterRedeem(
-      amountToRedeem,
+    const expectedReserveData = calcExpectedReserveDataAfterWithdraw(
+      amountToWithdraw,
       reserveDataBefore,
       userDataBefore,
       txTimestamp
     );
 
-    const expectedUserData = calcExpectedUserDataAfterRedeem(
-      amountToRedeem,
+    const expectedUserData = calcExpectedUserDataAfterWithdraw(
+      amountToWithdraw,
       reserveDataBefore,
       expectedReserveData,
       userDataBefore,
@@ -259,7 +261,7 @@ export const redeem = async (
       txCost
     );
 
-    const actualAmountRedeemed = userDataBefore.currentATokenBalance.minus(
+    const actualAmountWithdrawn = userDataBefore.currentATokenBalance.minus(
       expectedUserData.currentATokenBalance
     );
 
@@ -273,7 +275,7 @@ export const redeem = async (
     //   );
     // });
   } else if (expectedResult === 'revert') {
-    await expect(aTokenInstance.connect(user.signer).redeem(amountToRedeem), revertMessage).to.be
+    await expect(pool.connect(user.signer).withdraw(reserve, amountToWithdraw), revertMessage).to.be
       .reverted;
   }
 };
diff --git a/test/helpers/scenario-engine.ts b/test/helpers/scenario-engine.ts
index 2bfbd760..735d3b84 100644
--- a/test/helpers/scenario-engine.ts
+++ b/test/helpers/scenario-engine.ts
@@ -4,7 +4,7 @@ import {
   approve,
   deposit,
   borrow,
-  redeem,
+  withdraw,
   repay,
   setUseAsCollateral,
   swapBorrowRateMode,
@@ -102,15 +102,15 @@ const executeAction = async (action: Action, users: SignerWithAddress[], testEnv
       }
       break;
 
-    case 'redeem':
+    case 'withdraw':
       {
         const {amount} = action.args;
 
         if (!amount || amount === '') {
-          throw `Invalid amount to redeem from the ${reserve} reserve`;
+          throw `Invalid amount to withdraw from the ${reserve} reserve`;
         }
 
-        await redeem(reserve, amount, user, expected, testEnv, revertMessage);
+        await withdraw(reserve, amount, user, expected, testEnv, revertMessage);
       }
       break;
     case 'borrow':
diff --git a/test/helpers/scenarios/borrow-repay-stable.json b/test/helpers/scenarios/borrow-repay-stable.json
index f63bd2bd..aa79bf66 100644
--- a/test/helpers/scenarios/borrow-repay-stable.json
+++ b/test/helpers/scenarios/borrow-repay-stable.json
@@ -122,10 +122,10 @@
       ]
     },
     {
-      "description": "User 0 redeems the deposited DAI plus interest",
+      "description": "User 0 withdraws the deposited DAI plus interest",
       "actions": [
         {
-          "name": "redeem",
+          "name": "withdraw",
           "args": {
             "reserve": "DAI",
             "amount": "-1",
@@ -178,7 +178,7 @@
       ]
     },
     {
-      "description": "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 redeems",
+      "description": "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",
       "actions": [
         {
           "name": "mint",
@@ -475,7 +475,7 @@
           "expected": "success"
         },
         {
-          "name": "redeem",
+          "name": "withdraw",
           "args": {
             "reserve": "DAI",
             "amount": "-1",
@@ -486,7 +486,7 @@
       ]
     },
     {
-      "description": "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 redeems",
+      "description": "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",
       "actions": [
         {
           "name": "mint",
@@ -593,7 +593,7 @@
           "expected": "success"
         },
         {
-          "name": "redeem",
+          "name": "withdraw",
           "args": {
             "reserve": "DAI",
             "amount": "-1",
diff --git a/test/helpers/scenarios/borrow-repay-variable.json b/test/helpers/scenarios/borrow-repay-variable.json
index 1ae42ea0..46c17610 100644
--- a/test/helpers/scenarios/borrow-repay-variable.json
+++ b/test/helpers/scenarios/borrow-repay-variable.json
@@ -185,10 +185,10 @@
       ]
     },
     {
-      "description": "User 0 redeems the deposited DAI plus interest",
+      "description": "User 0 withdraws the deposited DAI plus interest",
       "actions": [
         {
-          "name": "redeem",
+          "name": "withdraw",
           "args": {
             "reserve": "DAI",
             "amount": "-1",
@@ -199,10 +199,10 @@
       ]
     },
     {
-      "description": "User 1 redeems the collateral",
+      "description": "User 1 withdraws the collateral",
       "actions": [
         {
-          "name": "redeem",
+          "name": "withdraw",
           "args": {
             "reserve": "WETH",
 
@@ -420,10 +420,10 @@
       ]
     },
     {
-      "description": "User 0 redeems the deposited WETH plus interest",
+      "description": "User 0 withdraws the deposited WETH plus interest",
       "actions": [
         {
-          "name": "redeem",
+          "name": "withdraw",
           "args": {
             "reserve": "WETH",
 
@@ -435,10 +435,10 @@
       ]
     },
     {
-      "description": "User 1 redeems the collateral",
+      "description": "User 1 withdraws the collateral",
       "actions": [
         {
-          "name": "redeem",
+          "name": "withdraw",
           "args": {
             "reserve": "LINK",
             "amount": "-1",
@@ -600,10 +600,10 @@
       ]
     },
     {
-      "description": "User 0 redeems the deposited USDC plus interest",
+      "description": "User 0 withdraws the deposited USDC plus interest",
       "actions": [
         {
-          "name": "redeem",
+          "name": "withdraw",
           "args": {
             "reserve": "USDC",
             "amount": "-1",
@@ -614,10 +614,10 @@
       ]
     },
     {
-      "description": "User 1 redeems the collateral",
+      "description": "User 1 withdraws the collateral",
       "actions": [
         {
-          "name": "redeem",
+          "name": "withdraw",
           "args": {
             "reserve": "WETH",
             "amount": "-1",
@@ -713,10 +713,10 @@
       ]
     },
     {
-      "description": "user 3 redeems the 0.1 ETH",
+      "description": "user 3 withdraws the 0.1 ETH",
       "actions": [
         {
-          "name": "redeem",
+          "name": "withdraw",
           "args": {
             "reserve": "WETH",
 
@@ -813,10 +813,10 @@
       ]
     },
     {
-      "description": "user 3 redeems the 0.1 ETH",
+      "description": "user 3 withdraws the 0.1 ETH",
       "actions": [
         {
-          "name": "redeem",
+          "name": "withdraw",
           "args": {
             "reserve": "WETH",
 
@@ -828,7 +828,7 @@
       ]
     },
     {
-      "description": "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 redeems",
+      "description": "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",
       "actions": [
         {
           "name": "mint",
@@ -946,7 +946,7 @@
           "expected": "success"
         },
         {
-          "name": "redeem",
+          "name": "withdraw",
           "args": {
             "reserve": "DAI",
             "amount": "-1",
diff --git a/test/helpers/scenarios/interest-redirection.json b/test/helpers/scenarios/interest-redirection.json
index a89199bf..8ed00d1f 100644
--- a/test/helpers/scenarios/interest-redirection.json
+++ b/test/helpers/scenarios/interest-redirection.json
@@ -104,7 +104,7 @@
       ]
     },
     {
-      "description": "User 1 borrows another 100 DAI, repay the whole amount. Users 0 and User 2 redeem",
+      "description": "User 1 borrows another 100 DAI, repay the whole amount. Users 0 and User 2 withdraw",
       "actions": [
         {
           "name": "borrow",
@@ -146,7 +146,7 @@
           "expected": "success"
         },
         {
-          "name": "redeem",
+          "name": "withdraw",
           "args": {
             "reserve": "DAI",
             "amount": "-1",
@@ -155,7 +155,7 @@
           "expected": "success"
         },
         {
-          "name": "redeem",
+          "name": "withdraw",
           "args": {
             "reserve": "DAI",
             "amount": "-1",
@@ -166,7 +166,7 @@
       ]
     },
     {
-      "description": "User 0 deposits 1000 DAI, redirects interest to user 2, user 1 borrows 100 DAI. After one year, user 0 redirects interest back to himself, user 1 borrows another 100 DAI and after another year repays the whole amount. Users 0 and User 2 redeem",
+      "description": "User 0 deposits 1000 DAI, redirects interest to user 2, user 1 borrows 100 DAI. After one year, user 0 redirects interest back to himself, user 1 borrows another 100 DAI and after another year repays the whole amount. Users 0 and User 2 withdraw",
       "actions": [
         {
           "name": "deposit",
@@ -246,7 +246,7 @@
           "expected": "success"
         },
         {
-          "name": "redeem",
+          "name": "withdraw",
           "args": {
             "reserve": "DAI",
             "amount": "-1",
@@ -255,7 +255,7 @@
           "expected": "success"
         },
         {
-          "name": "redeem",
+          "name": "withdraw",
           "args": {
             "reserve": "DAI",
             "amount": "-1",
@@ -266,7 +266,7 @@
       ]
     },
     {
-      "description": "User 0 deposits 1000 DAI, redirects interest to user 2, user 1 borrows 100 DAI. After one year, user 2 redirects interest to user 3. user 1 borrows another 100 DAI, user 0 deposits another 100 DAI. User 1 repays the whole amount. Users 0, 2 first 1 DAI, then everything. User 3 redeems",
+      "description": "User 0 deposits 1000 DAI, redirects interest to user 2, user 1 borrows 100 DAI. After one year, user 2 redirects interest to user 3. user 1 borrows another 100 DAI, user 0 deposits another 100 DAI. User 1 repays the whole amount. Users 0, 2 first 1 DAI, then everything. User 3 withdraws",
       "actions": [
         {
           "name": "deposit",
@@ -355,7 +355,7 @@
           "expected": "success"
         },
         {
-          "name": "redeem",
+          "name": "withdraw",
           "args": {
             "reserve": "DAI",
             "amount": "1",
@@ -364,7 +364,7 @@
           "expected": "success"
         },
         {
-          "name": "redeem",
+          "name": "withdraw",
           "args": {
             "reserve": "DAI",
             "amount": "1",
@@ -373,7 +373,7 @@
           "expected": "success"
         },
         {
-          "name": "redeem",
+          "name": "withdraw",
           "args": {
             "reserve": "DAI",
             "amount": "-1",
@@ -382,7 +382,7 @@
           "expected": "success"
         },
         {
-          "name": "redeem",
+          "name": "withdraw",
           "args": {
             "reserve": "DAI",
             "amount": "-1",
@@ -391,7 +391,7 @@
           "expected": "success"
         },
         {
-          "name": "redeem",
+          "name": "withdraw",
           "args": {
             "reserve": "DAI",
             "amount": "-1",
diff --git a/test/helpers/scenarios/redeem-negatives.json b/test/helpers/scenarios/withdraw-negatives.json
similarity index 96%
rename from test/helpers/scenarios/redeem-negatives.json
rename to test/helpers/scenarios/withdraw-negatives.json
index 982a41a1..1fb070f5 100644
--- a/test/helpers/scenarios/redeem-negatives.json
+++ b/test/helpers/scenarios/withdraw-negatives.json
@@ -33,7 +33,7 @@
         },
 
         {
-          "name": "redeem",
+          "name": "withdraw",
           "args": {
             "reserve": "DAI",
             "amount": "0",
@@ -48,7 +48,7 @@
       "description": "Users 0 tries to redeem 1100 DAI from the 1000 DAI deposited (revert expected)",
       "actions": [
         {
-          "name": "redeem",
+          "name": "withdraw",
           "args": {
             "reserve": "DAI",
             "amount": "1100",
@@ -100,7 +100,7 @@
           "expected": "success"
         },
         {
-          "name": "redeem",
+          "name": "withdraw",
           "args": {
             "reserve": "WETH",
 
diff --git a/test/helpers/scenarios/redeem.json b/test/helpers/scenarios/withdraw.json
similarity index 87%
rename from test/helpers/scenarios/redeem.json
rename to test/helpers/scenarios/withdraw.json
index f8e6670d..4a679b22 100644
--- a/test/helpers/scenarios/redeem.json
+++ b/test/helpers/scenarios/withdraw.json
@@ -1,6 +1,6 @@
 {
-  "title": "LendingPool: Redeem",
-  "description": "Redeem function.",
+  "title": "LendingPool: withdraw",
+  "description": "withdraw function.",
   "stories": [
     {
       "description": "User 0 Deposits 1000 DAI in an empty reserve",
@@ -34,10 +34,10 @@
       ]
     },
     {
-      "description": "User 0 redeems half of the deposited DAI",
+      "description": "User 0 withdraws half of the deposited DAI",
       "actions": [
         {
-          "name": "redeem",
+          "name": "withdraw",
           "args": {
             "reserve": "DAI",
             "amount": "500",
@@ -48,10 +48,10 @@
       ]
     },
     {
-      "description": "User 0 redeems remaining half of the deposited DAI",
+      "description": "User 0 withdraws remaining half of the deposited DAI",
       "actions": [
         {
-          "name": "redeem",
+          "name": "withdraw",
           "args": {
             "reserve": "DAI",
             "amount": "-1",
@@ -93,10 +93,10 @@
       ]
     },
     {
-      "description": "User 0 redeems half of the deposited USDC",
+      "description": "User 0 withdraws half of the deposited USDC",
       "actions": [
         {
-          "name": "redeem",
+          "name": "withdraw",
           "args": {
             "reserve": "USDC",
             "amount": "500",
@@ -107,10 +107,10 @@
       ]
     },
     {
-      "description": "User 0 redeems remaining half of the deposited USDC",
+      "description": "User 0 withdraws remaining half of the deposited USDC",
       "actions": [
         {
-          "name": "redeem",
+          "name": "withdraw",
           "args": {
             "reserve": "USDC",
             "amount": "-1",
@@ -153,10 +153,10 @@
       ]
     },
     {
-      "description": "User 0 redeems half of the deposited ETH",
+      "description": "User 0 withdraws half of the deposited ETH",
       "actions": [
         {
-          "name": "redeem",
+          "name": "withdraw",
           "args": {
             "reserve": "WETH",
 
@@ -168,10 +168,10 @@
       ]
     },
     {
-      "description": "User 0 redeems remaining half of the deposited ETH",
+      "description": "User 0 withdraws remaining half of the deposited ETH",
       "actions": [
         {
-          "name": "redeem",
+          "name": "withdraw",
           "args": {
             "reserve": "WETH",
 
@@ -183,7 +183,7 @@
       ]
     },
     {
-      "description": "Users 0 and 1 Deposit 1000 DAI, both redeem",
+      "description": "Users 0 and 1 Deposit 1000 DAI, both withdraw",
       "actions": [
         {
           "name": "mint",
@@ -221,7 +221,7 @@
           "expected": "success"
         },
         {
-          "name": "redeem",
+          "name": "withdraw",
           "args": {
             "reserve": "DAI",
             "amount": "-1",
@@ -230,7 +230,7 @@
           "expected": "success"
         },
         {
-          "name": "redeem",
+          "name": "withdraw",
           "args": {
             "reserve": "DAI",
             "amount": "-1",
@@ -241,7 +241,7 @@
       ]
     },
     {
-      "description": "Users 0 deposits 1000 DAI, user 1 Deposit 1000 USDC and 1 WETH, borrows 100 DAI. User 1 tries to redeem all the USDC",
+      "description": "Users 0 deposits 1000 DAI, user 1 Deposit 1000 USDC and 1 WETH, borrows 100 DAI. User 1 tries to withdraw all the USDC",
       "actions": [
         {
           "name": "mint",
@@ -333,7 +333,7 @@
           "expected": "success"
         },
         {
-          "name": "redeem",
+          "name": "withdraw",
           "args": {
             "reserve": "USDC",
             "amount": "-1",
diff --git a/test/helpers/utils/calculations.ts b/test/helpers/utils/calculations.ts
index 34c25069..293c04ac 100644
--- a/test/helpers/utils/calculations.ts
+++ b/test/helpers/utils/calculations.ts
@@ -57,7 +57,7 @@ export const calcExpectedUserDataAfterDeposit = (
   if (userDataBeforeAction.currentATokenBalance.eq(0)) {
     expectedUserData.usageAsCollateralEnabled = true;
   } else {
-    //if user is redeeming everything, usageAsCollateralEnabled must be false
+    //if the user is withdrawing everything, usageAsCollateralEnabled must be false
     if (expectedUserData.currentATokenBalance.eq(0)) {
       expectedUserData.usageAsCollateralEnabled = false;
     } else {
@@ -115,8 +115,8 @@ export const calcExpectedUserDataAfterDeposit = (
   return expectedUserData;
 };
 
-export const calcExpectedUserDataAfterRedeem = (
-  amountRedeemed: string,
+export const calcExpectedUserDataAfterWithdraw = (
+  amountWithdrawn: string,
   reserveDataBeforeAction: ReserveData,
   reserveDataAfterAction: ReserveData,
   userDataBeforeAction: UserReserveData,
@@ -132,12 +132,12 @@ export const calcExpectedUserDataAfterRedeem = (
     txTimestamp
   );
 
-  if (amountRedeemed == MAX_UINT_AMOUNT) {
-    amountRedeemed = aTokenBalance.toFixed(0);
+  if (amountWithdrawn == MAX_UINT_AMOUNT) {
+    amountWithdrawn = aTokenBalance.toFixed(0);
   }
 
   expectedUserData.principalATokenBalance = expectedUserData.currentATokenBalance = aTokenBalance.minus(
-    amountRedeemed
+    amountWithdrawn
   );
 
   expectedUserData.currentStableDebt = expectedUserData.principalStableDebt = calcExpectedStableDebtTokenBalance(
@@ -162,7 +162,7 @@ export const calcExpectedUserDataAfterRedeem = (
   if (userDataBeforeAction.currentATokenBalance.eq(0)) {
     expectedUserData.usageAsCollateralEnabled = true;
   } else {
-    //if user is redeeming everything, usageAsCollateralEnabled must be false
+    //if the user is withdrawing everything, usageAsCollateralEnabled must be false
     if (expectedUserData.currentATokenBalance.eq(0)) {
       expectedUserData.usageAsCollateralEnabled = false;
     } else {
@@ -175,9 +175,9 @@ export const calcExpectedUserDataAfterRedeem = (
   if (reserveDataBeforeAction.address === configuration.ethereumAddress) {
     expectedUserData.walletBalance = userDataBeforeAction.walletBalance
       .minus(txCost)
-      .plus(amountRedeemed);
+      .plus(amountWithdrawn);
   } else {
-    expectedUserData.walletBalance = userDataBeforeAction.walletBalance.plus(amountRedeemed);
+    expectedUserData.walletBalance = userDataBeforeAction.walletBalance.plus(amountWithdrawn);
   }
 
   expectedUserData.redirectedBalance = userDataBeforeAction.redirectedBalance;
@@ -199,7 +199,7 @@ export const calcExpectedUserDataAfterRedeem = (
     expectedUserData,
     userDataBeforeAction.redirectionAddressRedirectedBalance,
     new BigNumber(0),
-    new BigNumber(amountRedeemed)
+    new BigNumber(amountWithdrawn)
   );
 
   return expectedUserData;
@@ -255,8 +255,8 @@ export const calcExpectedReserveDataAfterDeposit = (
   return expectedReserveData;
 };
 
-export const calcExpectedReserveDataAfterRedeem = (
-  amountRedeemed: string,
+export const calcExpectedReserveDataAfterWithdraw = (
+  amountWithdrawn: string,
   reserveDataBeforeAction: ReserveData,
   userDataBeforeAction: UserReserveData,
   txTimestamp: BigNumber
@@ -265,8 +265,8 @@ export const calcExpectedReserveDataAfterRedeem = (
 
   expectedReserveData.address = reserveDataBeforeAction.address;
 
-  if (amountRedeemed == MAX_UINT_AMOUNT) {
-    amountRedeemed = calcExpectedATokenBalance(
+  if (amountWithdrawn == MAX_UINT_AMOUNT) {
+    amountWithdrawn = calcExpectedATokenBalance(
       reserveDataBeforeAction,
       userDataBeforeAction,
       txTimestamp
@@ -274,11 +274,11 @@ export const calcExpectedReserveDataAfterRedeem = (
   }
 
   expectedReserveData.totalLiquidity = new BigNumber(reserveDataBeforeAction.totalLiquidity).minus(
-    amountRedeemed
+    amountWithdrawn
   );
   expectedReserveData.availableLiquidity = new BigNumber(
     reserveDataBeforeAction.availableLiquidity
-  ).minus(amountRedeemed);
+  ).minus(amountWithdrawn);
 
   expectedReserveData.totalBorrowsStable = reserveDataBeforeAction.totalBorrowsStable;
   expectedReserveData.totalBorrowsVariable = reserveDataBeforeAction.totalBorrowsVariable;
@@ -1262,10 +1262,9 @@ const calcCompoundedInterest = (
   currentTimestamp: BigNumber,
   lastUpdateTimestamp: BigNumber
 ) => {
-
   const timeDifference = currentTimestamp.minus(lastUpdateTimestamp);
 
-  if(timeDifference.eq(0)){
+  if (timeDifference.eq(0)) {
     return new BigNumber(RAY);
   }
 
@@ -1288,7 +1287,6 @@ const calcCompoundedInterest = (
     .plus(ratePerSecond.times(timeDifference))
     .plus(secondTerm)
     .plus(thirdTerm);
-      
 };
 
 const calcExpectedInterestRates = (