@@ -627,6 +627,7 @@ contract SuperformRouterPlus is ISuperformRouterPlus, BaseSuperformRouterPlus {
627
627
/// @notice deposits ERC4626 vault shares into superform
628
628
/// @param vault_ The ERC4626 vault to redeem from
629
629
/// @param args Rest of the arguments to deposit 4626
630
+ /// @param arrayLength The length of the array of deposit4626 calls
630
631
function _deposit4626 (address vault_ , Deposit4626Args calldata args , uint256 arrayLength ) internal {
631
632
_transferERC20In (IERC20 (vault_), args.receiverAddressSP, args.amount);
632
633
IERC4626 vault = IERC4626 (vault_);
@@ -639,10 +640,15 @@ contract SuperformRouterPlus is ISuperformRouterPlus, BaseSuperformRouterPlus {
639
640
640
641
uint256 amountIn = _validateAndGetAmountIn (args.depositCallData, amountRedeemed);
641
642
642
- uint256 msgValue = msg .value / arrayLength;
643
643
address router = _getAddress (keccak256 ("SUPERFORM_ROUTER " ));
644
+ uint256 valueToDeposit;
645
+ {
646
+ uint256 valuePerItem = (msg .value - (msg .value % arrayLength)) / arrayLength;
647
+ uint256 remainingValue = msg .value % arrayLength;
648
+ valueToDeposit = valuePerItem + remainingValue;
649
+ }
644
650
645
- _deposit (router, asset, amountIn, msgValue , args.depositCallData);
651
+ _deposit (router, asset, amountIn, valueToDeposit , args.depositCallData);
646
652
647
653
_tokenRefunds (router, assetAdr, args.receiverAddressSP, balanceBefore);
648
654
0 commit comments