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

Feat/morpho is borrowing any #123

Merged
merged 5 commits into from Jun 16, 2023
Merged

Conversation

crispymangoes
Copy link
Collaborator

@crispymangoes crispymangoes commented Jun 15, 2023

This PR fixes the Morpho Aave V2 debt token adaptor logic so that calling the strategist repay function will always repay the full amount of debt, where as before it would sometimes leave 1 wei of debt behind.

In addition to the above it also removes the isLiquid configuration bool from the Morpho Aave V2 aToken adaptor, and instead reads the cellars userMarkets to determine if the cellar has any active loans. If the cellar has no active loans, the aToken position is liquid, otherwise the aToken position is illiquid.

Copy link
Contributor

@0xEinCodes 0xEinCodes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, changes have been discussed with Auditor as well. The only thing I might ask for is to add a couple of lines in the main PR message here of what the intent of this PR is for future reference.

@@ -97,12 +97,10 @@ contract MorphoAaveV2ATokenAdaptor is BaseAdaptor, MorphoRewardHandler {
/**
* @notice Uses configuration data to determine if the position is liquid or not.
*/

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This natSpec comment is not longer accurate

) public view override returns (uint256) {
bool isLiquid = abi.decode(configData, (bool));
if (!isLiquid) return 0;
function withdrawableFrom(bytes memory adaptorData, bytes memory) public view override returns (uint256) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kingofclubstroyDev comment is right. Also please add params descriptions.

Copy link
Contributor

@0xEinCodes 0xEinCodes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me other than one change request on nat spec. You can address that with the other fixes from the audit. :)

@crispymangoes crispymangoes merged commit ac9547f into main Jun 16, 2023
2 checks passed
@crispymangoes crispymangoes deleted the feat/morpho-is-borrowing-any branch June 16, 2023 16:14
@crispymangoes crispymangoes mentioned this pull request Jun 16, 2023
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.

None yet

3 participants