From 4475e814dc6688989995be934952261405ca93e4 Mon Sep 17 00:00:00 2001 From: Piotr Date: Tue, 21 Nov 2023 10:52:15 +0100 Subject: [PATCH] fix: remove recipients array copy --- src/FeeCalculator.sol | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/FeeCalculator.sol b/src/FeeCalculator.sol index 7c63be5..1951021 100644 --- a/src/FeeCalculator.sol +++ b/src/FeeCalculator.sol @@ -41,18 +41,17 @@ contract FeeCalculator is IDepositFeeCalculator, IRedemptionFeeCalculator { } function distributeFeeAmongShares(uint256 totalFee) private view returns (address[] memory recipients, uint256[] memory feesDenominatedInPoolTokens) { - recipients = new address[](_recipients.length); feesDenominatedInPoolTokens = new uint256[](_recipients.length); uint256 restFee = totalFee; for (uint i = 0; i < _recipients.length; i++) { - recipients[i] = _recipients[i]; feesDenominatedInPoolTokens[i] = (totalFee * _shares[i]) / 100; restFee -= feesDenominatedInPoolTokens[i]; } require(restFee >= 0); + recipients = _recipients; feesDenominatedInPoolTokens[0] += restFee;//we give rest of the fee (if any) to the first recipient }