-
Notifications
You must be signed in to change notification settings - Fork 21
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
Conversation
f93dd92
to
8983c32
Compare
8983c32
to
b5a8915
Compare
contracts/CompoundModuleETH.sol
Outdated
uint256 remainingToBorrowOnComp = (_moveLendersFromCompToMorpho( | ||
amountInCDai, | ||
msg.sender | ||
) * cDaiExchangeRate) / 1e18; // In underlying. | ||
borrowingBalanceOf[msg.sender].onMorpho += | ||
((amountInCDai - remainingToBorrowOnComp) / cDaiExchangeRate) * |
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.
remainingToBorrowOnComp
is not in cDAI here
contracts/CompoundModuleETH.sol
Outdated
require( | ||
borrowedAssetPriceMantissa != 0 && | ||
collateralAssetPriceMantissa != 0, | ||
"Oracle failed" | ||
); | ||
uint256 numerator = _borrowedAmount * | ||
uint256 totalBorrowedAmount = _borrowedAmountOnCompound + | ||
_borrowedAmountOnMorpho; // in underlying |
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.
In underlying.
contracts/CompoundModuleETH.sol
Outdated
@@ -435,6 +447,9 @@ contract CompoundModuleETH is ReentrancyGuard { | |||
borrowingBalanceOf[_borrower].onComp; | |||
uint256 remainingAmountToMoveInCDai = (remainingToSupplyToComp * | |||
1e18) / cDaiToken.exchangeRateCurrent(); // In cToken. | |||
borrowingBalanceOf[_borrower].onMorpho -= |
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 equal to remainingToSupplyToComp
fixup! fix: borrower balance on Morpho
b5a8915
to
0c351b8
Compare
@MerlinEgalite I made the changes you suggested, and removed the cToken conversions commit |
Remove set as collateral (Spearbit #25)
#26