From 8d0a93212d5d561cdc672d484fcbc109b90c3c6f Mon Sep 17 00:00:00 2001 From: Dmitry Date: Fri, 24 Nov 2023 11:52:12 +0100 Subject: [PATCH] Removing components of ERC4626RouterBase --- .../lib/erc4626/ERC4626RouterBase.sol | 66 ---------- .../lib/erc4626/external/Multicall.sol | 33 ----- .../erc4626/external/PeripheryPayments.sol | 80 ------------ .../lib/erc4626/external/SelfPermit.sol | 66 ---------- .../interfaces/IERC20PermitAllowed.sol | 33 ----- .../external/interfaces/IMulticall.sol | 18 --- .../external/interfaces/ISelfPermit.sol | 82 ------------ .../lib/erc4626/interfaces/IERC4626.sol | 119 ------------------ .../erc4626/interfaces/IERC4626RouterBase.sol | 109 ---------------- 9 files changed, 606 deletions(-) delete mode 100644 core/contracts/lib/erc4626/ERC4626RouterBase.sol delete mode 100644 core/contracts/lib/erc4626/external/Multicall.sol delete mode 100644 core/contracts/lib/erc4626/external/PeripheryPayments.sol delete mode 100644 core/contracts/lib/erc4626/external/SelfPermit.sol delete mode 100644 core/contracts/lib/erc4626/external/interfaces/IERC20PermitAllowed.sol delete mode 100644 core/contracts/lib/erc4626/external/interfaces/IMulticall.sol delete mode 100644 core/contracts/lib/erc4626/external/interfaces/ISelfPermit.sol delete mode 100644 core/contracts/lib/erc4626/interfaces/IERC4626.sol delete mode 100644 core/contracts/lib/erc4626/interfaces/IERC4626RouterBase.sol diff --git a/core/contracts/lib/erc4626/ERC4626RouterBase.sol b/core/contracts/lib/erc4626/ERC4626RouterBase.sol deleted file mode 100644 index 1126b29a9..000000000 --- a/core/contracts/lib/erc4626/ERC4626RouterBase.sol +++ /dev/null @@ -1,66 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later - -// Copied from https://github.com/ERC4626-Alliance/ERC4626-Contracts based on -// the project commit 643cd04 from Apr 20, 2022 - -pragma solidity 0.8.10; - -import {IERC4626, IERC4626RouterBase, ERC20} from "./interfaces/IERC4626RouterBase.sol"; -import {SafeTransferLib} from "solmate/src/utils/SafeTransferLib.sol"; - -import {SelfPermit} from "./external/SelfPermit.sol"; -import {Multicall} from "./external/Multicall.sol"; -import {PeripheryPayments, IWETH9} from "./external/PeripheryPayments.sol"; - -/// @title ERC4626 Router Base Contract -abstract contract ERC4626RouterBase is IERC4626RouterBase, SelfPermit, Multicall, PeripheryPayments { - using SafeTransferLib for ERC20; - - /// @inheritdoc IERC4626RouterBase - function mint( - IERC4626 vault, - address to, - uint256 shares, - uint256 maxAmountIn - ) public payable virtual override returns (uint256 amountIn) { - if ((amountIn = vault.mint(shares, to)) > maxAmountIn) { - revert MaxAmountError(); - } - } - - /// @inheritdoc IERC4626RouterBase - function deposit( - IERC4626 vault, - address to, - uint256 amount, - uint256 minSharesOut - ) public payable virtual override returns (uint256 sharesOut) { - if ((sharesOut = vault.deposit(amount, to)) < minSharesOut) { - revert MinSharesError(); - } - } - - /// @inheritdoc IERC4626RouterBase - function withdraw( - IERC4626 vault, - address to, - uint256 amount, - uint256 maxSharesOut - ) public payable virtual override returns (uint256 sharesOut) { - if ((sharesOut = vault.withdraw(amount, to, msg.sender)) > maxSharesOut) { - revert MaxSharesError(); - } - } - - /// @inheritdoc IERC4626RouterBase - function redeem( - IERC4626 vault, - address to, - uint256 shares, - uint256 minAmountOut - ) public payable virtual override returns (uint256 amountOut) { - if ((amountOut = vault.redeem(shares, to, msg.sender)) < minAmountOut) { - revert MinAmountError(); - } - } -} diff --git a/core/contracts/lib/erc4626/external/Multicall.sol b/core/contracts/lib/erc4626/external/Multicall.sol deleted file mode 100644 index 04392462a..000000000 --- a/core/contracts/lib/erc4626/external/Multicall.sol +++ /dev/null @@ -1,33 +0,0 @@ -// forked from https://github.com/Uniswap/v3-periphery/blob/main/contracts/base/Multicall.sol - -// SPDX-License-Identifier: GPL-2.0-or-later - -// Copied from https://github.com/ERC4626-Alliance/ERC4626-Contracts based on -// the project commit 643cd04 from Apr 20, 2022 - -pragma solidity >=0.7.6; - -import './interfaces/IMulticall.sol'; - -/// @title Multicall -/// @notice Enables calling multiple methods in a single call to the contract -abstract contract Multicall is IMulticall { - /// @inheritdoc IMulticall - function multicall(bytes[] calldata data) public payable override returns (bytes[] memory results) { - results = new bytes[](data.length); - for (uint256 i = 0; i < data.length; i++) { - (bool success, bytes memory result) = address(this).delegatecall(data[i]); - - if (!success) { - // Next 5 lines from https://ethereum.stackexchange.com/a/83577 - if (result.length < 68) revert(); - assembly { - result := add(result, 0x04) - } - revert(abi.decode(result, (string))); - } - - results[i] = result; - } - } -} \ No newline at end of file diff --git a/core/contracts/lib/erc4626/external/PeripheryPayments.sol b/core/contracts/lib/erc4626/external/PeripheryPayments.sol deleted file mode 100644 index 58803152e..000000000 --- a/core/contracts/lib/erc4626/external/PeripheryPayments.sol +++ /dev/null @@ -1,80 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later - -// Copied from https://github.com/ERC4626-Alliance/ERC4626-Contracts based on -// the project commit 643cd04 from Apr 20, 2022 - -pragma solidity >=0.7.5; - -import "solmate/src/utils/SafeTransferLib.sol"; - -/** - @title Periphery Payments - @notice Immutable state used by periphery contracts - Largely Forked from https://github.com/Uniswap/v3-periphery/blob/main/contracts/base/PeripheryPayments.sol - Changes: - * no interface - * no inheritdoc - * add immutable WETH9 in constructor instead of PeripheryImmutableState - * receive from any address - * Solmate interfaces and transfer lib - * casting - * add approve, wrapWETH9 and pullToken -*/ -abstract contract PeripheryPayments { - using SafeTransferLib for *; - - IWETH9 public immutable WETH9; - - constructor(IWETH9 _WETH9) { - WETH9 = _WETH9; - } - - receive() external payable {} - - function approve(ERC20 token, address to, uint256 amount) public payable { - token.safeApprove(to, amount); - } - - function unwrapWETH9(uint256 amountMinimum, address recipient) public payable { - uint256 balanceWETH9 = WETH9.balanceOf(address(this)); - require(balanceWETH9 >= amountMinimum, 'Insufficient WETH9'); - - if (balanceWETH9 > 0) { - WETH9.withdraw(balanceWETH9); - recipient.safeTransferETH(balanceWETH9); - } - } - - function wrapWETH9() public payable { - if (address(this).balance > 0) WETH9.deposit{value: address(this).balance}(); // wrap everything - } - - function pullToken(ERC20 token, uint256 amount, address recipient) public payable { - token.safeTransferFrom(msg.sender, recipient, amount); - } - - function sweepToken( - ERC20 token, - uint256 amountMinimum, - address recipient - ) public payable { - uint256 balanceToken = token.balanceOf(address(this)); - require(balanceToken >= amountMinimum, 'Insufficient token'); - - if (balanceToken > 0) { - token.safeTransfer(recipient, balanceToken); - } - } - - function refundETH() external payable { - if (address(this).balance > 0) SafeTransferLib.safeTransferETH(msg.sender, address(this).balance); - } -} - -abstract contract IWETH9 is ERC20 { - /// @notice Deposit ether to get wrapped ether - function deposit() external payable virtual; - - /// @notice Withdraw wrapped ether to get ether - function withdraw(uint256) external virtual; -} \ No newline at end of file diff --git a/core/contracts/lib/erc4626/external/SelfPermit.sol b/core/contracts/lib/erc4626/external/SelfPermit.sol deleted file mode 100644 index 6151db148..000000000 --- a/core/contracts/lib/erc4626/external/SelfPermit.sol +++ /dev/null @@ -1,66 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later - -// Copied from https://github.com/ERC4626-Alliance/ERC4626-Contracts based on -// the project commit 643cd04 from Apr 20, 2022 - -pragma solidity >=0.5.0; - -import {ERC20} from "solmate/src/tokens/ERC20.sol"; - -import './interfaces/ISelfPermit.sol'; -import './interfaces/IERC20PermitAllowed.sol'; - -/// @title Self Permit -/// @notice Functionality to call permit on any EIP-2612-compliant token for use in the route -/// @dev These functions are expected to be embedded in multicalls to allow EOAs to approve a contract and call a function -/// that requires an approval in a single transaction. -abstract contract SelfPermit is ISelfPermit { - /// @inheritdoc ISelfPermit - function selfPermit( - address token, - uint256 value, - uint256 deadline, - uint8 v, - bytes32 r, - bytes32 s - ) public payable override { - ERC20(token).permit(msg.sender, address(this), value, deadline, v, r, s); - } - - /// @inheritdoc ISelfPermit - function selfPermitIfNecessary( - address token, - uint256 value, - uint256 deadline, - uint8 v, - bytes32 r, - bytes32 s - ) external payable override { - if (ERC20(token).allowance(msg.sender, address(this)) < value) selfPermit(token, value, deadline, v, r, s); - } - - /// @inheritdoc ISelfPermit - function selfPermitAllowed( - address token, - uint256 nonce, - uint256 expiry, - uint8 v, - bytes32 r, - bytes32 s - ) public payable override { - IERC20PermitAllowed(token).permit(msg.sender, address(this), nonce, expiry, true, v, r, s); - } - - /// @inheritdoc ISelfPermit - function selfPermitAllowedIfNecessary( - address token, - uint256 nonce, - uint256 expiry, - uint8 v, - bytes32 r, - bytes32 s - ) external payable override { - if (ERC20(token).allowance(msg.sender, address(this)) < type(uint256).max) - selfPermitAllowed(token, nonce, expiry, v, r, s); - } -} diff --git a/core/contracts/lib/erc4626/external/interfaces/IERC20PermitAllowed.sol b/core/contracts/lib/erc4626/external/interfaces/IERC20PermitAllowed.sol deleted file mode 100644 index 9b991b6f0..000000000 --- a/core/contracts/lib/erc4626/external/interfaces/IERC20PermitAllowed.sol +++ /dev/null @@ -1,33 +0,0 @@ -// forked from https://github.com/Uniswap/v3-periphery/blob/main/contracts/interfaces/external/IERC20PermitAllowed.sol - -// SPDX-License-Identifier: GPL-2.0-or-later - -// Copied from https://github.com/ERC4626-Alliance/ERC4626-Contracts based on -// the project commit 643cd04 from Apr 20, 2022 - -pragma solidity >=0.5.0; - -/// @title Interface for permit -/// @notice Interface used by DAI/CHAI for permit -interface IERC20PermitAllowed { - /// @notice Approve the spender to spend some tokens via the holder signature - /// @dev This is the permit interface used by DAI and CHAI - /// @param holder The address of the token holder, the token owner - /// @param spender The address of the token spender - /// @param nonce The holder's nonce, increases at each call to permit - /// @param expiry The timestamp at which the permit is no longer valid - /// @param allowed Boolean that sets approval amount, true for type(uint256).max and false for 0 - /// @param v Must produce valid secp256k1 signature from the holder along with `r` and `s` - /// @param r Must produce valid secp256k1 signature from the holder along with `v` and `s` - /// @param s Must produce valid secp256k1 signature from the holder along with `r` and `v` - function permit( - address holder, - address spender, - uint256 nonce, - uint256 expiry, - bool allowed, - uint8 v, - bytes32 r, - bytes32 s - ) external; -} \ No newline at end of file diff --git a/core/contracts/lib/erc4626/external/interfaces/IMulticall.sol b/core/contracts/lib/erc4626/external/interfaces/IMulticall.sol deleted file mode 100644 index 4a58f8e0a..000000000 --- a/core/contracts/lib/erc4626/external/interfaces/IMulticall.sol +++ /dev/null @@ -1,18 +0,0 @@ -// forked from https://github.com/Uniswap/v3-periphery/blob/main/contracts/interfaces/IMulticall.sol - -// SPDX-License-Identifier: GPL-2.0-or-later - -// Copied from https://github.com/ERC4626-Alliance/ERC4626-Contracts based on -// the project commit 643cd04 from Apr 20, 2022 - -pragma solidity >=0.7.5; - -/// @title Multicall interface -/// @notice Enables calling multiple methods in a single call to the contract -interface IMulticall { - /// @notice Call multiple functions in the current contract and return the data from all of them if they all succeed - /// @dev The `msg.value` should not be trusted for any method callable from multicall. - /// @param data The encoded function data for each of the calls to make to this contract - /// @return results The results from each of the calls passed in via data - function multicall(bytes[] calldata data) external payable returns (bytes[] memory results); -} diff --git a/core/contracts/lib/erc4626/external/interfaces/ISelfPermit.sol b/core/contracts/lib/erc4626/external/interfaces/ISelfPermit.sol deleted file mode 100644 index c9815b6d9..000000000 --- a/core/contracts/lib/erc4626/external/interfaces/ISelfPermit.sol +++ /dev/null @@ -1,82 +0,0 @@ -// forked from https://github.com/Uniswap/v3-periphery/blob/main/contracts/interfaces/ISelfPermit.sol - -// SPDX-License-Identifier: GPL-2.0-or-later - -// Copied from https://github.com/ERC4626-Alliance/ERC4626-Contracts based on -// the project commit 643cd04 from Apr 20, 2022 - -pragma solidity >=0.7.5; - -/// @title Self Permit -/// @notice Functionality to call permit on any EIP-2612-compliant token for use in the route -interface ISelfPermit { - /// @notice Permits this contract to spend a given token from `msg.sender` - /// @dev The `owner` is always msg.sender and the `spender` is always address(this). - /// @param token The address of the token spent - /// @param value The amount that can be spent of token - /// @param deadline A timestamp, the current blocktime must be less than or equal to this timestamp - /// @param v Must produce valid secp256k1 signature from the holder along with `r` and `s` - /// @param r Must produce valid secp256k1 signature from the holder along with `v` and `s` - /// @param s Must produce valid secp256k1 signature from the holder along with `r` and `v` - function selfPermit( - address token, - uint256 value, - uint256 deadline, - uint8 v, - bytes32 r, - bytes32 s - ) external payable; - - /// @notice Permits this contract to spend a given token from `msg.sender` - /// @dev The `owner` is always msg.sender and the `spender` is always address(this). - /// Can be used instead of #selfPermit to prevent calls from failing due to a frontrun of a call to #selfPermit - /// @param token The address of the token spent - /// @param value The amount that can be spent of token - /// @param deadline A timestamp, the current blocktime must be less than or equal to this timestamp - /// @param v Must produce valid secp256k1 signature from the holder along with `r` and `s` - /// @param r Must produce valid secp256k1 signature from the holder along with `v` and `s` - /// @param s Must produce valid secp256k1 signature from the holder along with `r` and `v` - function selfPermitIfNecessary( - address token, - uint256 value, - uint256 deadline, - uint8 v, - bytes32 r, - bytes32 s - ) external payable; - - /// @notice Permits this contract to spend the sender's tokens for permit signatures that have the `allowed` parameter - /// @dev The `owner` is always msg.sender and the `spender` is always address(this) - /// @param token The address of the token spent - /// @param nonce The current nonce of the owner - /// @param expiry The timestamp at which the permit is no longer valid - /// @param v Must produce valid secp256k1 signature from the holder along with `r` and `s` - /// @param r Must produce valid secp256k1 signature from the holder along with `v` and `s` - /// @param s Must produce valid secp256k1 signature from the holder along with `r` and `v` - function selfPermitAllowed( - address token, - uint256 nonce, - uint256 expiry, - uint8 v, - bytes32 r, - bytes32 s - ) external payable; - - /// @notice Permits this contract to spend the sender's tokens for permit signatures that have the `allowed` parameter - /// @dev The `owner` is always msg.sender and the `spender` is always address(this) - /// Can be used instead of #selfPermitAllowed to prevent calls from failing due to a frontrun of a call to #selfPermitAllowed. - /// @param token The address of the token spent - /// @param nonce The current nonce of the owner - /// @param expiry The timestamp at which the permit is no longer valid - /// @param v Must produce valid secp256k1 signature from the holder along with `r` and `s` - /// @param r Must produce valid secp256k1 signature from the holder along with `v` and `s` - /// @param s Must produce valid secp256k1 signature from the holder along with `r` and `v` - function selfPermitAllowedIfNecessary( - address token, - uint256 nonce, - uint256 expiry, - uint8 v, - bytes32 r, - bytes32 s - ) external payable; -} diff --git a/core/contracts/lib/erc4626/interfaces/IERC4626.sol b/core/contracts/lib/erc4626/interfaces/IERC4626.sol deleted file mode 100644 index bf287736a..000000000 --- a/core/contracts/lib/erc4626/interfaces/IERC4626.sol +++ /dev/null @@ -1,119 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later - -// Copied from https://github.com/ERC4626-Alliance/ERC4626-Contracts based on -// the project commit 643cd04 from Apr 20, 2022 - -pragma solidity 0.8.10; - -import {ERC20} from "solmate/src/tokens/ERC20.sol"; - -/// @title ERC4626 interface -/// See: https://eips.ethereum.org/EIPS/eip-4626 -abstract contract IERC4626 is ERC20 { - /*//////////////////////////////////////////////////////// - Events - ////////////////////////////////////////////////////////*/ - - /// @notice `sender` has exchanged `assets` for `shares`, - /// and transferred those `shares` to `receiver`. - event Deposit(address indexed sender, address indexed receiver, uint256 assets, uint256 shares); - - /// @notice `sender` has exchanged `shares` for `assets`, - /// and transferred those `assets` to `receiver`. - event Withdraw(address indexed sender, address indexed receiver, uint256 assets, uint256 shares); - - /*//////////////////////////////////////////////////////// - Vault properties - ////////////////////////////////////////////////////////*/ - - /// @notice The address of the underlying ERC20 token used for - /// the Vault for accounting, depositing, and withdrawing. - function asset() external view virtual returns (address asset); - - /// @notice Total amount of the underlying asset that - /// is "managed" by Vault. - function totalAssets() external view virtual returns (uint256 totalAssets); - - /*//////////////////////////////////////////////////////// - Deposit/Withdrawal Logic - ////////////////////////////////////////////////////////*/ - - /// @notice Mints `shares` Vault shares to `receiver` by - /// depositing exactly `assets` of underlying tokens. - function deposit(uint256 assets, address receiver) external virtual returns (uint256 shares); - - /// @notice Mints exactly `shares` Vault shares to `receiver` - /// by depositing `assets` of underlying tokens. - function mint(uint256 shares, address receiver) external virtual returns (uint256 assets); - - /// @notice Redeems `shares` from `owner` and sends `assets` - /// of underlying tokens to `receiver`. - function withdraw( - uint256 assets, - address receiver, - address owner - ) external virtual returns (uint256 shares); - - /// @notice Redeems `shares` from `owner` and sends `assets` - /// of underlying tokens to `receiver`. - function redeem( - uint256 shares, - address receiver, - address owner - ) external virtual returns (uint256 assets); - - /*//////////////////////////////////////////////////////// - Vault Accounting Logic - ////////////////////////////////////////////////////////*/ - - /// @notice The amount of shares that the vault would - /// exchange for the amount of assets provided, in an - /// ideal scenario where all the conditions are met. - function convertToShares(uint256 assets) external view virtual returns (uint256 shares); - - /// @notice The amount of assets that the vault would - /// exchange for the amount of shares provided, in an - /// ideal scenario where all the conditions are met. - function convertToAssets(uint256 shares) external view virtual returns (uint256 assets); - - /// @notice Total number of underlying assets that can - /// be deposited by `owner` into the Vault, where `owner` - /// corresponds to the input parameter `receiver` of a - /// `deposit` call. - function maxDeposit(address owner) external view virtual returns (uint256 maxAssets); - - /// @notice Allows an on-chain or off-chain user to simulate - /// the effects of their deposit at the current block, given - /// current on-chain conditions. - function previewDeposit(uint256 assets) external view virtual returns (uint256 shares); - - /// @notice Total number of underlying shares that can be minted - /// for `owner`, where `owner` corresponds to the input - /// parameter `receiver` of a `mint` call. - function maxMint(address owner) external view virtual returns (uint256 maxShares); - - /// @notice Allows an on-chain or off-chain user to simulate - /// the effects of their mint at the current block, given - /// current on-chain conditions. - function previewMint(uint256 shares) external view virtual returns (uint256 assets); - - /// @notice Total number of underlying assets that can be - /// withdrawn from the Vault by `owner`, where `owner` - /// corresponds to the input parameter of a `withdraw` call. - function maxWithdraw(address owner) external view virtual returns (uint256 maxAssets); - - /// @notice Allows an on-chain or off-chain user to simulate - /// the effects of their withdrawal at the current block, - /// given current on-chain conditions. - function previewWithdraw(uint256 assets) external view virtual returns (uint256 shares); - - /// @notice Total number of underlying shares that can be - /// redeemed from the Vault by `owner`, where `owner` corresponds - /// to the input parameter of a `redeem` call. - function maxRedeem(address owner) external view virtual returns (uint256 maxShares); - - /// @notice Allows an on-chain or off-chain user to simulate - /// the effects of their redeemption at the current block, - /// given current on-chain conditions. - function previewRedeem(uint256 shares) external view virtual returns (uint256 assets); -} diff --git a/core/contracts/lib/erc4626/interfaces/IERC4626RouterBase.sol b/core/contracts/lib/erc4626/interfaces/IERC4626RouterBase.sol deleted file mode 100644 index 4154b664b..000000000 --- a/core/contracts/lib/erc4626/interfaces/IERC4626RouterBase.sol +++ /dev/null @@ -1,109 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later - -// Copied from https://github.com/ERC4626-Alliance/ERC4626-Contracts based on -// the project commit 643cd04 from Apr 20, 2022 - -pragma solidity 0.8.10; - -import "./IERC4626.sol"; - -/** - @title ERC4626Router Base Interface - @notice A canonical router between ERC4626 Vaults https://eips.ethereum.org/EIPS/eip-4626 - - The base router is a multicall style router inspired by Uniswap v3 with built-in features for permit, WETH9 wrap/unwrap, and ERC20 token pulling/sweeping/approving. - It includes methods for the four mutable ERC4626 functions deposit/mint/withdraw/redeem as well. - - These can all be arbitrarily composed using the multicall functionality of the router. - - NOTE the router is capable of pulling any approved token from your wallet. This is only possible when your address is msg.sender, but regardless be careful when interacting with the router or ERC4626 Vaults. - The router makes no special considerations for unique ERC20 implementations such as fee on transfer. - There are no built in protections for unexpected behavior beyond enforcing the minSharesOut is received. - */ -interface IERC4626RouterBase { - /************************** Errors **************************/ - - /// @notice thrown when amount of assets received is below the min set by caller - error MinAmountError(); - - /// @notice thrown when amount of shares received is below the min set by caller - error MinSharesError(); - - /// @notice thrown when amount of assets received is above the max set by caller - error MaxAmountError(); - - /// @notice thrown when amount of shares received is above the max set by caller - error MaxSharesError(); - - /************************** Mint **************************/ - - /** - @notice mint `shares` from an ERC4626 vault. - @param vault The ERC4626 vault to mint shares from. - @param to The destination of ownership shares. - @param shares The amount of shares to mint from `vault`. - @param maxAmountIn The max amount of assets used to mint. - @return amountIn the amount of assets used to mint by `to`. - @dev throws MaxAmountError - */ - function mint( - IERC4626 vault, - address to, - uint256 shares, - uint256 maxAmountIn - ) external payable returns (uint256 amountIn); - - /************************** Deposit **************************/ - - /** - @notice deposit `amount` to an ERC4626 vault. - @param vault The ERC4626 vault to deposit assets to. - @param to The destination of ownership shares. - @param amount The amount of assets to deposit to `vault`. - @param minSharesOut The min amount of `vault` shares received by `to`. - @return sharesOut the amount of shares received by `to`. - @dev throws MinSharesError - */ - function deposit( - IERC4626 vault, - address to, - uint256 amount, - uint256 minSharesOut - ) external payable returns (uint256 sharesOut); - - /************************** Withdraw **************************/ - - /** - @notice withdraw `amount` from an ERC4626 vault. - @param vault The ERC4626 vault to withdraw assets from. - @param to The destination of assets. - @param amount The amount of assets to withdraw from vault. - @param minSharesOut The min amount of shares received by `to`. - @return sharesOut the amount of shares received by `to`. - @dev throws MaxSharesError - */ - function withdraw( - IERC4626 vault, - address to, - uint256 amount, - uint256 minSharesOut - ) external payable returns (uint256 sharesOut); - - /************************** Redeem **************************/ - - /** - @notice redeem `shares` shares from an ERC4626 vault. - @param vault The ERC4626 vault to redeem shares from. - @param to The destination of assets. - @param shares The amount of shares to redeem from vault. - @param minAmountOut The min amount of assets received by `to`. - @return amountOut the amount of assets received by `to`. - @dev throws MinAmountError - */ - function redeem( - IERC4626 vault, - address to, - uint256 shares, - uint256 minAmountOut - ) external payable returns (uint256 amountOut); -}