From a314dd4b102974967c5f8ed11948d5210d65ff2f Mon Sep 17 00:00:00 2001 From: Ian Lucas Date: Sun, 6 Oct 2024 10:51:28 -0400 Subject: [PATCH] Minor comment cleanup --- .../contracts/src/token/ERC1155/RedeemOptimizerFIFO.sol | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/contracts/src/token/ERC1155/RedeemOptimizerFIFO.sol b/packages/contracts/src/token/ERC1155/RedeemOptimizerFIFO.sol index f4887165f..d9608b903 100644 --- a/packages/contracts/src/token/ERC1155/RedeemOptimizerFIFO.sol +++ b/packages/contracts/src/token/ERC1155/RedeemOptimizerFIFO.sol @@ -108,10 +108,10 @@ contract RedeemOptimizerFIFO is IRedeemOptimizer { if (amountFound + amountAtPeriod > optimizerParams.amountToFind) { uint256 amountToInclude = optimizerParams.amountToFind - amountFound; // we only need the amount that brings us to amountToFind - // the assets here include principal + interest. to utilize convertToShares() we want principal amount only - // the following ratio holds: partialShares/totalShares = partialReturns/totalReturns - // so, partialShares = ((partialReturns * totalShares) / totalReturns) - uint256 sharesToInclude = sharesAtPeriod.mulDiv(amountToInclude, amountAtPeriod); // also works for shares, when shares = amounts, sharesAtPeriod / sharesAtPeriod = 1 + // in the assets case, the amounts include principal AND returns. we want the shares on deposit, which is the principal only. + // use this ratio: partialShares / totalShares = partialAssets / totalAssets + // partialShares = (partialAssets * totalShares) / totalAssets + uint256 sharesToInclude = sharesAtPeriod.mulDiv(amountToInclude, amountAtPeriod); // only include equivalent amount of shares for the amountToInclude assets cacheSharesAtPeriods[arrayIndex] =