Skip to content

Commit

Permalink
docs: add two comments
Browse files Browse the repository at this point in the history
  • Loading branch information
MathisGD committed Aug 8, 2024
1 parent 7ab940b commit 104ea2e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/MetaMorpho.sol
Original file line number Diff line number Diff line change
Expand Up @@ -888,17 +888,19 @@ contract MetaMorpho is ERC4626, ERC20Permit, Ownable2Step, Multicall, IMetaMorph
/// @return newTotalAssets the new totalSupply.
/// @return newLostAssets the new lostAssets.
function _accruedSupplyAndAssets() internal view returns (uint256, uint256, uint256) {
// The assets that the vault has on Morpho.
uint256 realTotalAssets;
for (uint256 i; i < withdrawQueue.length; ++i) {
realTotalAssets += MORPHO.expectedSupplyAssets(_marketParams(withdrawQueue[i]), address(this));
}

uint256 newLostAssets;
// Handle the case where the vault lost some assets.
// If the vault lost some assets (realTotalAssets decreased), lostAssets is increased.
if (realTotalAssets < lastTotalAssets - lostAssets) newLostAssets = lastTotalAssets - realTotalAssets;
// If it did not, lostAssets stays the same.
else newLostAssets = lostAssets;
uint256 newTotalAssets = realTotalAssets + newLostAssets;

uint256 newTotalAssets = realTotalAssets + newLostAssets;
uint256 totalInterest = newTotalAssets.zeroFloorSub(lastTotalAssets);
uint256 feeShares;
if (totalInterest != 0 && fee != 0) {
Expand Down

0 comments on commit 104ea2e

Please sign in to comment.