Skip to content
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

Open
wants to merge 12 commits into
base: refactor/aave-v3-origin
Choose a base branch
from

Conversation

QGarchery
Copy link
Contributor

@QGarchery QGarchery commented Oct 16, 2024

This PR removes the use of deprecated features. Changes inside src:

  • removes the use of the stable debt token
  • removes the use of e-mode price sources
  • removes the use of 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 category
  • replaces getEModeCategoryData with getEModeCategoryCollateralConfig, and changes the corresponding struct DataTypes.EModeCategoryLegacy with DataTypes.CollateralConfig

@QGarchery QGarchery self-assigned this Oct 16, 2024
@QGarchery QGarchery changed the title chore: in the middle of TestMarketLib Remove deprecated features Oct 16, 2024
@MathisGD MathisGD mentioned this pull request Oct 16, 2024

return (isInEMode, oracle.getAssetPrice(asset), assetUnit);
uint256 reserveIndex = _pool.getReserveData(underlying).id;
Copy link
Contributor Author

@QGarchery QGarchery Oct 16, 2024

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

Comment on lines -234 to -235
/// @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
Copy link
Contributor Author

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);
Copy link
Contributor Author

@QGarchery QGarchery Oct 16, 2024

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

Comment on lines +24 to +28
require(collateralConfig.liquidationThreshold != 0, "not activated e-mode");
require(
pool.getEModeCategoryCollateralBitmap(eModeCategoryId).isReserveEnabledOnBitmap(lsdNativeIndex),
"wrong e-mode category"
);
Copy link
Contributor Author

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

@@ -92,7 +92,6 @@ abstract contract MorphoInternal is MorphoStorage {
market.underlying = underlying;
market.aToken = reserve.aTokenAddress;
market.variableDebtToken = reserve.variableDebtTokenAddress;
market.stableDebtToken = reserve.stableDebtTokenAddress;
Copy link
Contributor Author

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 ?

@QGarchery QGarchery linked an issue Oct 17, 2024 that may be closed by this pull request
@QGarchery QGarchery marked this pull request as ready for review October 17, 2024 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Document build method
1 participant