From 8da0891c9a2ea4edb48b5736f1308e9e636cdf60 Mon Sep 17 00:00:00 2001 From: Tamara Ringas Date: Fri, 22 Nov 2024 10:19:11 +0200 Subject: [PATCH 1/4] chore: update natspec --- lib/pigeon copy | 1 + src/router-plus/SuperformRouterPlus.sol | 1 + 2 files changed, 2 insertions(+) create mode 160000 lib/pigeon copy diff --git a/lib/pigeon copy b/lib/pigeon copy new file mode 160000 index 000000000..e318c3e06 --- /dev/null +++ b/lib/pigeon copy @@ -0,0 +1 @@ +Subproject commit e318c3e06895c1fa07439bf225bb2c755463e7c8 diff --git a/src/router-plus/SuperformRouterPlus.sol b/src/router-plus/SuperformRouterPlus.sol index a3d379e45..c25c7873f 100644 --- a/src/router-plus/SuperformRouterPlus.sol +++ b/src/router-plus/SuperformRouterPlus.sol @@ -627,6 +627,7 @@ contract SuperformRouterPlus is ISuperformRouterPlus, BaseSuperformRouterPlus { /// @notice deposits ERC4626 vault shares into superform /// @param vault_ The ERC4626 vault to redeem from /// @param args Rest of the arguments to deposit 4626 + /// @param arrayLength The length of the array of deposit4626 calls function _deposit4626(address vault_, Deposit4626Args calldata args, uint256 arrayLength) internal { _transferERC20In(IERC20(vault_), args.receiverAddressSP, args.amount); IERC4626 vault = IERC4626(vault_); From fb89fe5a689543602f2058bb60d252f014734f48 Mon Sep 17 00:00:00 2001 From: Tamara Ringas Date: Fri, 22 Nov 2024 10:45:15 +0200 Subject: [PATCH 2/4] fix: add remainder to _deposit() call in _deposit4626() --- src/router-plus/SuperformRouterPlus.sol | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/router-plus/SuperformRouterPlus.sol b/src/router-plus/SuperformRouterPlus.sol index c25c7873f..a7166f35c 100644 --- a/src/router-plus/SuperformRouterPlus.sol +++ b/src/router-plus/SuperformRouterPlus.sol @@ -640,10 +640,12 @@ contract SuperformRouterPlus is ISuperformRouterPlus, BaseSuperformRouterPlus { uint256 amountIn = _validateAndGetAmountIn(args.depositCallData, amountRedeemed); - uint256 msgValue = msg.value / arrayLength; address router = _getAddress(keccak256("SUPERFORM_ROUTER")); - _deposit(router, asset, amountIn, msgValue, args.depositCallData); + uint256 valuePerItem = (msg.value - (msg.value % arrayLength)) / arrayLength; + uint256 remainingValue = msg.value % arrayLength; + + _deposit(router, asset, amountIn, valuePerItem + remainingValue, args.depositCallData); _tokenRefunds(router, assetAdr, args.receiverAddressSP, balanceBefore); From 92c1cb2f9f99155572fc1ff905ee59127ca9564d Mon Sep 17 00:00:00 2001 From: Tamara Ringas Date: Fri, 22 Nov 2024 10:52:43 +0200 Subject: [PATCH 3/4] fix: rm pigeon-copy from lib --- lib/pigeon copy | 1 - 1 file changed, 1 deletion(-) delete mode 160000 lib/pigeon copy diff --git a/lib/pigeon copy b/lib/pigeon copy deleted file mode 160000 index e318c3e06..000000000 --- a/lib/pigeon copy +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e318c3e06895c1fa07439bf225bb2c755463e7c8 From 4648402dc1834944a838ce99884e29d8f0339ae6 Mon Sep 17 00:00:00 2001 From: Tamara Ringas Date: Fri, 22 Nov 2024 15:24:48 +0200 Subject: [PATCH 4/4] chore: assign valueToDeposit as a variable --- src/router-plus/SuperformRouterPlus.sol | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/router-plus/SuperformRouterPlus.sol b/src/router-plus/SuperformRouterPlus.sol index a7166f35c..0dc13467a 100644 --- a/src/router-plus/SuperformRouterPlus.sol +++ b/src/router-plus/SuperformRouterPlus.sol @@ -641,11 +641,14 @@ contract SuperformRouterPlus is ISuperformRouterPlus, BaseSuperformRouterPlus { uint256 amountIn = _validateAndGetAmountIn(args.depositCallData, amountRedeemed); address router = _getAddress(keccak256("SUPERFORM_ROUTER")); + uint256 valueToDeposit; + { + uint256 valuePerItem = (msg.value - (msg.value % arrayLength)) / arrayLength; + uint256 remainingValue = msg.value % arrayLength; + valueToDeposit = valuePerItem + remainingValue; + } - uint256 valuePerItem = (msg.value - (msg.value % arrayLength)) / arrayLength; - uint256 remainingValue = msg.value % arrayLength; - - _deposit(router, asset, amountIn, valuePerItem + remainingValue, args.depositCallData); + _deposit(router, asset, amountIn, valueToDeposit, args.depositCallData); _tokenRefunds(router, assetAdr, args.receiverAddressSP, balanceBefore);