Hypervisor - Multiple “sandwiching” front running vectors
The amount of tokens received from `UniswapV3Pool` functions might be manipulated by front-runners due to the decentralized nature of AMMs, where the order of transactions can not be pre-determined. A potential “sandwicher” may insert a buying order before the user's call to `Hypervisor.rebalance` for instance, and a sell order after.\\nMore specifically, calls to `pool.swap`, `pool.mint`, `pool.burn` are susceptible to “sandwiching” vectors.\\n`Hypervisor.rebalance`\\n```\\nif (swapQuantity != 0) {\\n    pool.swap(\\n        address(this),\\n        swapQuantity > 0,\\n        swapQuantity > 0 ? swapQuantity : -swapQuantity,\\n        swapQuantity > 0 ? TickMath.MIN\\_SQRT\\_RATIO + 1 : TickMath.MAX\\_SQRT\\_RATIO - 1,\\n        abi.encode(address(this))\\n    );\\n}\\n```\\n\\n```\\nfunction \\_mintLiquidity(\\n    int24 tickLower,\\n    int24 tickUpper,\\n    uint128 liquidity,\\n    address payer\\n) internal returns (uint256 amount0, uint256 amount1) {\\n    if (liquidity > 0) {\\n        (amount0, amount1) = pool.mint(\\n            address(this),\\n            tickLower,\\n            tickUpper,\\n            liquidity,\\n            abi.encode(payer)\\n        );\\n    }\\n}\\n```\\n\\n```\\nfunction \\_burnLiquidity(\\n    int24 tickLower,\\n    int24 tickUpper,\\n    uint128 liquidity,\\n    address to,\\n    bool collectAll\\n) internal returns (uint256 amount0, uint256 amount1) {\\n    if (liquidity > 0) {\\n        // Burn liquidity\\n        (uint256 owed0, uint256 owed1) = pool.burn(tickLower, tickUpper, liquidity);\\n\\n        // Collect amount owed\\n        uint128 collect0 = collectAll ? type(uint128).max : \\_uint128Safe(owed0);\\n        uint128 collect1 = collectAll ? type(uint128).max : \\_uint128Safe(owed1);\\n        if (collect0 > 0 || collect1 > 0) {\\n            (amount0, amount1) = pool.collect(to, tickLower, tickUpper, collect0, collect1);\\n        }\\n    }\\n}\\n```\\n
Consider adding an `amountMin` parameter(s) to ensure that at least the `amountMin` of tokens was received.
```\\nif (swapQuantity != 0) {\\n    pool.swap(\\n        address(this),\\n        swapQuantity > 0,\\n        swapQuantity > 0 ? swapQuantity : -swapQuantity,\\n        swapQuantity > 0 ? TickMath.MIN\\_SQRT\\_RATIO + 1 : TickMath.MAX\\_SQRT\\_RATIO - 1,\\n        abi.encode(address(this))\\n    );\\n}\\n```\\n