diff --git a/src/mocks/MockCellar.sol b/src/mocks/MockCellar.sol index 6c14bfb7f..be3646e90 100644 --- a/src/mocks/MockCellar.sol +++ b/src/mocks/MockCellar.sol @@ -1,18 +1,18 @@ // SPDX-License-Identifier: Apache-2.0 pragma solidity 0.8.13; -import { Cellar, ERC20 } from "src/base/Cellar.sol"; +// import { Cellar, ERC20 } from "src/base/Cellar.sol"; -contract MockCellar is Cellar { - constructor( - ERC20 _asset, - string memory _name, - string memory _symbol - ) Cellar(_asset, _name, _symbol) {} +// contract MockCellar is Cellar { +// constructor( +// ERC20 _asset, +// string memory _name, +// string memory _symbol +// ) Cellar(_asset, _name, _symbol) {} - function totalAssets() public view override returns (uint256) { - return asset.balanceOf(address(this)); - } +// function totalAssets() public view override returns (uint256) { +// return asset.balanceOf(address(this)); +// } - function accrue() public override {} -} +// function accrue() public override {} +// } diff --git a/src/mocks/MockMultipositionCellar.sol b/src/mocks/MockMultipositionCellar.sol index 9fd0a2840..054e9ab70 100644 --- a/src/mocks/MockMultipositionCellar.sol +++ b/src/mocks/MockMultipositionCellar.sol @@ -1,70 +1,70 @@ // SPDX-License-Identifier: Apache-2.0 pragma solidity 0.8.13; -import { MultipositionCellar } from "src/base/MultipositionCellar.sol"; -import { ERC20 } from "@solmate/tokens/ERC20.sol"; -import { SafeTransferLib } from "@solmate/utils/SafeTransferLib.sol"; -import { ERC4626 } from "src/base/ERC4626.sol"; -import { Math } from "src/utils/Math.sol"; - -import { ISwapRouter } from "../interfaces/ISwapRouter.sol"; -import { MockSwapRouter } from "./MockSwapRouter.sol"; - -import "../Errors.sol"; - -contract MockMultipositionCellar is MultipositionCellar { - using SafeTransferLib for ERC20; - using Math for uint256; - - constructor( - ERC20 _asset, - ERC4626[] memory _positions, - address[][] memory _paths, - uint32[] memory _maxSlippages, - ISwapRouter _swapRouter, - string memory _name, - string memory _symbol, - uint8 _decimals - ) MultipositionCellar(_asset, _positions, _paths, _maxSlippages, _swapRouter, _name, _symbol, _decimals) {} - - function convertToAssets(ERC20 positionAsset, uint256 assets) public view override returns (uint256) { - return MockSwapRouter(address(swapRouter)).convert(address(positionAsset), address(asset), assets); - } - - function depositIntoPosition( - ERC4626 position, - uint256 assets, - address receiver - ) external returns (uint256 shares) { - require((shares = previewDeposit(convertToAssets(position.asset(), assets))) != 0, "ZERO_SHARES"); - - ERC20 positionAsset = position.asset(); - positionAsset.safeTransferFrom(msg.sender, address(this), assets); - - _mint(receiver, shares); - - _depositIntoPosition(position, assets); - } - - function withdrawFromPosition( - ERC4626 position, - uint256 assets, - address receiver, - address owner - ) external returns (uint256 shares) { - shares = previewWithdraw(convertToAssets(position.asset(), assets)); - - if (msg.sender != owner) { - uint256 allowed = allowance[owner][msg.sender]; // Saves gas for limited approvals. - - if (allowed != type(uint256).max) allowance[owner][msg.sender] = allowed - shares; - } - - _burn(owner, shares); - - _withdrawFromPosition(position, assets); - - ERC20 positionAsset = position.asset(); - positionAsset.safeTransfer(receiver, assets); - } -} +// import { MultipositionCellar } from "src/base/MultipositionCellar.sol"; +// import { ERC20 } from "@solmate/tokens/ERC20.sol"; +// import { SafeTransferLib } from "@solmate/utils/SafeTransferLib.sol"; +// import { ERC4626 } from "src/base/ERC4626.sol"; +// import { Math } from "src/utils/Math.sol"; + +// import { ISwapRouter } from "../interfaces/ISwapRouter.sol"; +// import { MockSwapRouter } from "./MockSwapRouter.sol"; + +// import "../Errors.sol"; + +// contract MockMultipositionCellar is MultipositionCellar { +// using SafeTransferLib for ERC20; +// using Math for uint256; + +// constructor( +// ERC20 _asset, +// ERC4626[] memory _positions, +// address[][] memory _paths, +// uint32[] memory _maxSlippages, +// ISwapRouter _swapRouter, +// string memory _name, +// string memory _symbol, +// uint8 _decimals +// ) MultipositionCellar(_asset, _positions, _paths, _maxSlippages, _swapRouter, _name, _symbol, _decimals) {} + +// function convertToAssets(ERC20 positionAsset, uint256 assets) public view override returns (uint256) { +// return MockSwapRouter(address(swapRouter)).convert(address(positionAsset), address(asset), assets); +// } + +// function depositIntoPosition( +// ERC4626 position, +// uint256 assets, +// address receiver +// ) external returns (uint256 shares) { +// require((shares = previewDeposit(convertToAssets(position.asset(), assets))) != 0, "ZERO_SHARES"); + +// ERC20 positionAsset = position.asset(); +// positionAsset.safeTransferFrom(msg.sender, address(this), assets); + +// _mint(receiver, shares); + +// _depositIntoPosition(position, assets); +// } + +// function withdrawFromPosition( +// ERC4626 position, +// uint256 assets, +// address receiver, +// address owner +// ) external returns (uint256 shares) { +// shares = previewWithdraw(convertToAssets(position.asset(), assets)); + +// if (msg.sender != owner) { +// uint256 allowed = allowance[owner][msg.sender]; // Saves gas for limited approvals. + +// if (allowed != type(uint256).max) allowance[owner][msg.sender] = allowed - shares; +// } + +// _burn(owner, shares); + +// _withdrawFromPosition(position, assets); + +// ERC20 positionAsset = position.asset(); +// positionAsset.safeTransfer(receiver, assets); +// } +// }