ManagedLeveragedVault::deposit() slippage control on collVaultShares is not intuitive
Summary
ManagedLeveragedVault::deposit() has slippage control for collVaultShares but it applies to the full deposited collateral when the user only gets a share of it due to entry fees.
Vulnerability Detail
The deposit function is:
function deposit(uint256 assets, address receiver, AddCollParams calldata params)
public
notPaused
nonReentrant
returns (uint256 shares)
{
BoycoVaultStorage storage b$ = _getBoycoVaultStorage();
shares = _deposit(assets, receiver);
IERC20(asset()).forceApprove(address(b$.collVault), assets);
uint256 collVaultShares = b$.collVault.deposit(assets, address(this));
if (collVaultShares < params.minSharesOut) revert VaultSlippage(params.minSharesOut, collVaultShares);
_addColl(collVaultShares, params.upperHint, params.lowerHint);
}The user deposits assets and pays entry fees. However, the params.minSharesOut parameter is compared against collVaultShares, which comes from converting the whole assets deposited into collateral vault shares. This can be unexpected for users as slippage control on a deposit function should be on the amount the user actually gets (assets minus entry fees), but it currently compares against all assets deposited.
Impact
UX issues. Some users may be caught off guard but it only leads to reverts at max.
Code Snippet
Tool Used
Manual Review
Recommendation
Apply slippage control to the net collVaultShares the user mints.