From 104ea2e6d3f9668f5f13e5aa6312c9a5b2785baf Mon Sep 17 00:00:00 2001 From: MathisGD Date: Thu, 8 Aug 2024 09:46:45 +0200 Subject: [PATCH] docs: add two comments --- src/MetaMorpho.sol | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/MetaMorpho.sol b/src/MetaMorpho.sol index 2f5d69ca..96e2c7b8 100644 --- a/src/MetaMorpho.sol +++ b/src/MetaMorpho.sol @@ -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) {