-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove deprecated features #888
base: refactor/aave-v3-origin
Are you sure you want to change the base?
Conversation
|
||
return (isInEMode, oracle.getAssetPrice(asset), assetUnit); | ||
uint256 reserveIndex = _pool.getReserveData(underlying).id; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this call costs a lot of gas, and isn't very ergonomic. Another approach would be to do this call upfront, and use the values from it in sub-functions (in the same way that the config
parameter is passed around).
The solution proposed in this PR is meant to minimize changes though, but a refactoring PR could be made on top
/// @dev Computes the valid lower bound for ltv and lt for a given CategoryEModeId, conditions required by Aave's code. | ||
/// https://github.com/aave/aave-v3-core/blob/94e571f3a7465201881a59555314cd550ccfda57/contracts/protocol/pool/PoolConfigurator.sol#L369-L376 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not longer a restriction on Aave
market.eModeCategoryId = uint8(reserve.configuration.getEModeCategory()); | ||
market.eModeCategory = pool.getEModeCategoryData(market.eModeCategoryId); | ||
market.eModeCollateralConfig = pool.getEModeCategoryCollateralConfig(eModeCategoryId); | ||
market.eModeCollateralBitmap = pool.getEModeCategoryCollateralBitmap(eModeCategoryId); | ||
market.eModeBorrowableBitmap = pool.getEModeCategoryBorrowableBitmap(eModeCategoryId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those calls are done here, to respect the design choice of this repo: do all the calls to the pool in this file, and have the TestMarketLib
not depend on the pool. This is why in the test the isCollateralInEMode
and isBorrowableInEMode
are not done in the exact same way than on src
require(collateralConfig.liquidationThreshold != 0, "not activated e-mode"); | ||
require( | ||
pool.getEModeCategoryCollateralBitmap(eModeCategoryId).isReserveEnabledOnBitmap(lsdNativeIndex), | ||
"wrong e-mode category" | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Verify the guess that LSD category ID is 1
…factor/remove-deprecated
@@ -92,7 +92,6 @@ abstract contract MorphoInternal is MorphoStorage { | |||
market.underlying = underlying; | |||
market.aToken = reserve.aTokenAddress; | |||
market.variableDebtToken = reserve.variableDebtTokenAddress; | |||
market.stableDebtToken = reserve.stableDebtTokenAddress; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe not necessary to do this change ?
This PR removes the use of deprecated features. Changes inside
src
:getEModeCategory
, as there is not one category per asset anymore. Instead, the code verifies that assets are enabled in the current e-mode. Note that assets can now be enabled as collateral and/or as borrowable in a given e-mode categorygetEModeCategoryData
withgetEModeCategoryCollateralConfig
, and changes the corresponding structDataTypes.EModeCategoryLegacy
withDataTypes.CollateralConfig