diff --git a/docs/Aave-v3.3-features.md b/docs/Aave-v3.3-features.md index 36a7daed..ffd0f8bf 100644 --- a/docs/Aave-v3.3-features.md +++ b/docs/Aave-v3.3-features.md @@ -99,6 +99,7 @@ By flipping the masks: ``` The access can be simplified: + ``` function getLtv(DataTypes.ReserveConfigurationMap memory self) internal pure returns (uint256) { - return self.data & ~LTV_MASK; @@ -108,7 +109,6 @@ function getLtv(DataTypes.ReserveConfigurationMap memory self) internal pure ret Which slightly reduces gas & code-size. The effect is getting more meaningful for accounts holding multiple collateral & borrow positions. - ### 3. Additional getters When analyzing ecosystem contracts we noticed that a lot of contracts have to pay excess gas due to the lack of fine grained getters on the protocol. diff --git a/src/contracts/protocol/libraries/logic/LiquidationLogic.sol b/src/contracts/protocol/libraries/logic/LiquidationLogic.sol index 07fbb152..e69b212d 100644 --- a/src/contracts/protocol/libraries/logic/LiquidationLogic.sol +++ b/src/contracts/protocol/libraries/logic/LiquidationLogic.sol @@ -612,6 +612,9 @@ library LiquidationLogic { IVariableDebtToken vToken = IVariableDebtToken(currentReserve.variableDebtTokenAddress); // Fetch the scaled balance first as it is more gas-efficient uint256 userDebt = vToken.scaledBalanceOf(user); + // Prior v3.1, there were cases where, after liquidation, the `isBorrowing` flag was left on + // even after the user debt was fully repaid, so to avoid this function reverting in the `_burnScaled` + // (see ScaledBalanceTokenBase contract), we check for any debt remaining. if (userDebt != 0) { // Scale up the debt balance userDebt = userDebt.rayMul(reserveCache.nextVariableBorrowIndex);