Skip to content

Commit

Permalink
fix: update msg.value in _deposit4626()
Browse files Browse the repository at this point in the history
  • Loading branch information
TamaraRingas committed Oct 25, 2024
1 parent af6ed66 commit 9ede180
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/router-plus/SuperformRouterPlus.sol
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ contract SuperformRouterPlus is ISuperformRouterPlus, BaseSuperformRouterPlus {
if (!whitelistedSelectors[Actions.DEPOSIT][_parseSelectorMem(args[i].depositCallData)]) {
revert INVALID_DEPOSIT_SELECTOR();
}
_deposit4626(vaults_[i], args[i]);
_deposit4626(vaults_[i], args[i], vaults_.length);
}
}

Expand Down Expand Up @@ -603,7 +603,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
function _deposit4626(address vault_, Deposit4626Args calldata args) internal {
function _deposit4626(address vault_, Deposit4626Args calldata args, uint256 arrayLength) internal {
_transferERC20In(IERC20(vault_), args.receiverAddressSP, args.amount);
IERC4626 vault = IERC4626(vault_);
address assetAdr = vault.asset();
Expand All @@ -617,8 +617,9 @@ contract SuperformRouterPlus is ISuperformRouterPlus, BaseSuperformRouterPlus {
revert INVALID_DEPOSIT_SELECTOR();
}

uint256 msgValue = msg.value / arrayLength;
address router = _getAddress(keccak256("SUPERFORM_ROUTER"));
_deposit(router, asset, amountRedeemed, msg.value, args.depositCallData);
_deposit(router, asset, amountRedeemed, msgValue, args.depositCallData);

_tokenRefunds(router, assetAdr, args.receiverAddressSP, balanceBefore);

Expand Down

0 comments on commit 9ede180

Please sign in to comment.