```\nrouter = ISwapRouter(\_router);\nuint256 amountOut;\nuint256 swap;\nif(swapAmount < 0) {\n    //swap token1 for token0\n\n    swap = uint256(swapAmount \* -1);\n    IHypervisor(pos).token1().transferFrom(msg.sender, address(this), deposit1+swap);\n    amountOut = router.exactInput(\n        ISwapRouter.ExactInputParams(\n            path,\n            address(this),\n            block.timestamp + swapLife,\n            swap,\n            deposit0\n        )\n    );\n}\nelse{\n    //swap token1 for token0\n    swap = uint256(swapAmount);\n    IHypervisor(pos).token0().transferFrom(msg.sender, address(this), deposit0+swap);\n\n    amountOut = router.exactInput(\n        ISwapRouter.ExactInputParams(\n            path,\n            address(this),\n            block.timestamp + swapLife,\n            swap,\n            deposit1\n        )\n    );     \n}\n```\n