Skip to content

Commit

Permalink
chore: add comment in _burnBadDebt + lint
Browse files Browse the repository at this point in the history
  • Loading branch information
ianflexa authored and sakulstra committed Oct 16, 2024
1 parent f5389a4 commit c4c438e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/Aave-v3.3-features.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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.
Expand Down
3 changes: 3 additions & 0 deletions src/contracts/protocol/libraries/logic/LiquidationLogic.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit c4c438e

Please sign in to comment.