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

Fix borrowing balance structure & cToken conversion #25

Closed
wants to merge 1 commit into from

Conversation

MathisGD
Copy link
Collaborator

@MathisGD MathisGD commented Jul 24, 2021

#26

@MathisGD MathisGD self-assigned this Jul 24, 2021
@MathisGD MathisGD changed the title Draft: Feat/morpho rewards Fix borrowing balance structure & cToken conversion Jul 25, 2021
uint256 remainingToBorrowOnComp = (_moveLendersFromCompToMorpho(
amountInCDai,
msg.sender
) * cDaiExchangeRate) / 1e18; // In underlying.
borrowingBalanceOf[msg.sender].onMorpho +=
((amountInCDai - remainingToBorrowOnComp) / cDaiExchangeRate) *
Copy link
Contributor

Choose a reason for hiding this comment

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

remainingToBorrowOnComp is not in cDAI here

require(
borrowedAssetPriceMantissa != 0 &&
collateralAssetPriceMantissa != 0,
"Oracle failed"
);
uint256 numerator = _borrowedAmount *
uint256 totalBorrowedAmount = _borrowedAmountOnCompound +
_borrowedAmountOnMorpho; // in underlying
Copy link
Contributor

Choose a reason for hiding this comment

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

In underlying.

@@ -435,6 +447,9 @@ contract CompoundModuleETH is ReentrancyGuard {
borrowingBalanceOf[_borrower].onComp;
uint256 remainingAmountToMoveInCDai = (remainingToSupplyToComp *
1e18) / cDaiToken.exchangeRateCurrent(); // In cToken.
borrowingBalanceOf[_borrower].onMorpho -=
Copy link
Contributor

Choose a reason for hiding this comment

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

This is equal to remainingToSupplyToComp

fixup! fix: borrower balance on Morpho
@MathisGD
Copy link
Collaborator Author

@MerlinEgalite I made the changes you suggested, and removed the cToken conversions commit

@MathisGD MathisGD closed this Jul 25, 2021
@MathisGD MathisGD deleted the feat/morpho-rewards branch July 25, 2021 12:35
pakim249CAL added a commit that referenced this pull request Dec 13, 2022
Remove set as collateral (Spearbit #25)
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

2 participants