The newly introduced ERC4626 standard provides functions for depositing and withdrawing funds to a vault, but it is unclear to me how the designers envisioned adding custom slippage rates from the function method:
function deposit(uint256 assets, address receiver) public virtual returns (uint256 shares);
There's mention that slippage rates should be included in the preview functions (e.g., previewDeposit), but what would the best-practice solution look like to add per-interaction slippage with this? My only thoughts here are:
- somehow set-it in a mapping prior to calling the deposit function but that seems unnecessarily cumbersome.
- implement standard slippage of e.g., 3% and add a custom deposit function that does support slippage
In any case, neither of these would be 'standard'.