You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/3.5/Aave-v3.5-features.md
+67Lines changed: 67 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -91,3 +91,70 @@ Example: The user transfers `100`, but due to rounding he loses `102` balance. T
91
91
- Note: This is a non-breaking change. The migration from no return value to a `uint256` return value is not expected to break any existing integrations.
92
92
- In previous versions of the protocol, `Mint` and `Burn` events on `AToken` and `VariableDebtToken` did not always perfectly reflect the amount minted and burned due to imprecision in the calculation of the `amountToMint` and `amountToBurn` variables. In v3.5, the `value` emitted in `Mint` and `Burn` events now always accurately reflects the difference between the previous upscaled balance and the new upscaled balance. For `AToken` transfers, the `Transfer` event emits the input amount, while the `BalanceTransfer` event emits the precise scaled amount being transferred. Due to the new rounding logic, the actual change in unscaled balance might differ slightly from the input amount.
93
93
- The control flow of `borrow` has been altered. While in previous versions of the protocol the `borrow` function would first check the hf limitations, from v3.5.0 the healthfactor check is performed at the end. Moving the check allows to de-duplicate the healthfactor related calculations and avoids issues due to non-equivalence in some edge cases.
94
+
95
+
### Changelog
96
+
97
+
- General changes:
98
+
- Changed conversions between scaled and unscaled amounts:
99
+
- In the `AToken` contract:
100
+
- The `balanceOf` and `totalSupply` functions now round down (from scaled to unscaled).
101
+
- The `mint` function now rounds down (from unscaled to scaled).
102
+
- The `burn` function now rounds up (from unscaled to scaled).
103
+
- Calculations of a transfer's scaled amount now round up in `AToken` (from unscaled to scaled).
104
+
- In the `VariableDebtToken` contract:
105
+
- The `balanceOf` and `totalSupply` functions now round up (from scaled to unscaled).
106
+
- The `mint` function now rounds up (from unscaled to scaled).
107
+
- The `burn` function now rounds down (from unscaled to scaled).
108
+
-`Pool` contract:
109
+
- The `finalizeTransfer` function now accepts scaled amounts instead of unscaled amounts. This avoids the precision loss caused by rounding the unscaled parameters.
110
+
- The `eliminateReserveDeficit` function now returns the actual amount of deficit that was covered.
111
+
-`AToken` contract:
112
+
- The following functions now accept a `scaledAmount` parameter instead of the `amount` parameter, which avoids the precision loss caused by rounding the `amount` parameter:
113
+
-`mint`
114
+
-`mintToTreasury`
115
+
-`transferOnLiquidation`
116
+
- The `burn` function now accepts a new `scaledAmount` argument, which is the scaled amount of tokens to be burned. This avoids the precision loss caused by rounding the `amount` parameter.
117
+
- Changed the logic and math of the allowance decrease in the `transferFrom` function.
118
+
-`VariableDebtToken` contract:
119
+
- The `mint` function now accepts a new `scaledAmount` argument, which is the scaled amount of tokens to be minted. This avoids the precision loss caused by rounding the `amount` parameter.
120
+
- The `burn` function now accepts a `scaledAmount` parameter instead of the `amount` parameter, which avoids the precision loss caused by rounding the `amount` parameter.
121
+
- Added new state variables `__unusedGap` and `__DEPRECATED_AND_NEVER_TO_BE_REUSED`.
122
+
- Changed the logic and math of the borrow allowance decrease in the `mint` function.
123
+
-`DebtTokenBase` contract:
124
+
- Changed the logic and math of the borrow allowance decrease in the `_decreaseBorrowAllowance` function.
125
+
-`IncentivizedERC20` contract:
126
+
- Added a new `_spendAllowance` function, which is used to decrease the allowance of a spender.
127
+
-`ScaledBalanceTokenBase` contract:
128
+
- The following functions now accept scaled amounts instead of unscaled amounts:
129
+
-`_mintScaled`
130
+
-`_burnScaled`
131
+
- Changed the math of the `amountToMint` variable in the `_mintScaled` function.
132
+
- Changed the math of the `amountToBurn` and `amountToMint` variables in the `_burnScaled` function.
133
+
- Libraries:
134
+
-`BorrowLogic` library:
135
+
- The `executeBorrow` function now checks the health factor and the LTV of a user after the borrow operation by calling the new `ValidationLogic.validateHFAndLtv` function.
136
+
- In the `executeRepay` function, the contract now checks the health factor of a user (`user`, not `onBehalfOf`) after the repay operation when the user is repaying with `ATokens`.
137
+
-`FlashLoanLogic` library:
138
+
- The `executeFlashLoan` function now rounds up the protocol fees for flash loans of type `0`.
139
+
-`GenericLogic` library:
140
+
- In the `calculateUserAccountData` function, the precision in health factor calculations has been improved.
141
+
- In the `calculateAvailableBorrows` function, the `availableBorrowsInBaseCurrency` variable is now rounded down.
142
+
- In the `_getUserDebtInBaseCurrency` function, the amount in the base currency is now rounded up.
143
+
-`LiquidationLogic` library:
144
+
- The `executeEliminateDeficit` function now returns the actual amount of deficit that was covered.
145
+
- In the `executeLiquidationCall` function, some rounding behavior has been changed:
146
+
- The `borrowerReserveDebtInBaseCurrency` variable is now rounded up.
147
+
- The `isDebtMoreThanLeftoverThreshold` variable is now rounded up.
148
+
- In the `_calculateAvailableCollateralToLiquidate` function, the `debtAmountNeeded` variable is now rounded up when `maxCollateralToLiquidate > borrowerCollateralBalance`.
149
+
-`ReserveLogic` library:
150
+
- In the `_accrueToTreasury` function, the `totalDebtAccrued` variable is now rounded down.
151
+
-`SupplyLogic` library:
152
+
- The `executeFinalizeTransfer` function now accepts scaled amounts instead of unscaled amounts.
153
+
-`ValidationLogic` library:
154
+
- The following functions now accept scaled parameters instead of unscaled parameters, which avoids the precision loss caused by rounding unscaled parameters:
155
+
-`validateSupply`
156
+
-`validateWithdraw`
157
+
-`validateBorrow`
158
+
-`validateRepay`
159
+
- The `validateBorrow` function no longer checks the user's health factor and LTV before the borrow operation.
160
+
- A new `TokenMath` library has been added. It contains functions to perform conversions between scaled and unscaled amounts for A/V tokens.
0 commit comments