{
    "Function": "slitherConstructorConstantVariables",
    "File": "contracts/v3/strategies/BaseStrategy.sol",
    "Parent Contracts": [
        "contracts/v3/interfaces/IStrategy.sol"
    ],
    "High-Level Calls": [],
    "Internal Calls": [],
    "Library Calls": [],
    "Low-Level Calls": [],
    "Code": "abstract contract BaseStrategy is IStrategy {\n    using SafeERC20 for IERC20;\n    using Address for address;\n    using SafeMath for uint256;\n\n    uint256 public constant ONE_HUNDRED_PERCENT = 10000;\n\n    address public immutable override want;\n    address public immutable override weth;\n    address public immutable controller;\n    IManager public immutable override manager;\n    string public override name;\n    ISwap public override router;\n\n    /**\n     * @param _controller The address of the controller\n     * @param _manager The address of the manager\n     * @param _want The desired token of the strategy\n     * @param _weth The address of WETH\n     * @param _router The address of the router for swapping tokens\n     */\n    constructor(\n        string memory _name,\n        address _controller,\n        address _manager,\n        address _want,\n        address _weth,\n        address _router\n    ) public {\n        name = _name;\n        want = _want;\n        controller = _controller;\n        manager = IManager(_manager);\n        weth = _weth;\n        router = ISwap(_router);\n        IERC20(_weth).safeApprove(address(_router), type(uint256).max);\n    }\n\n    /**\n     * GOVERNANCE-ONLY FUNCTIONS\n     */\n\n    /**\n     * @notice Approves a token address to be spent by an address\n     * @param _token The address of the token\n     * @param _spender The address of the spender\n     * @param _amount The amount to spend\n     */\n    function approveForSpender(\n        IERC20 _token,\n        address _spender,\n        uint256 _amount\n    )\n        external\n    {\n        require(msg.sender == manager.governance(), \"!governance\");\n        _token.safeApprove(_spender, 0);\n        _token.safeApprove(_spender, _amount);\n    }\n\n    /**\n     * @notice Sets the address of the ISwap-compatible router\n     * @param _router The address of the router\n     */\n    function setRouter(\n        address _router\n    )\n        external\n    {\n        require(msg.sender == manager.governance(), \"!governance\");\n        router = ISwap(_router);\n        IERC20(weth).safeApprove(address(_router), 0);\n        IERC20(weth).safeApprove(address(_router), type(uint256).max);\n    }\n\n    /**\n     * CONTROLLER-ONLY FUNCTIONS\n     */\n\n    /**\n     * @notice Deposits funds to the strategy's pool\n     */\n    function deposit()\n        external\n        override\n        onlyController\n    {\n        _deposit();\n    }\n\n    /**\n     * @notice Harvest funds in the strategy's pool\n     */\n    function harvest(\n        uint256 _estimatedWETH,\n        uint256 _estimatedYAXIS\n    )\n        external\n        override\n        onlyController\n    {\n        _harvest(_estimatedWETH, _estimatedYAXIS);\n    }\n\n    /**\n     * @notice Sends stuck want tokens in the strategy to the controller\n     */\n    function skim()\n        external\n        override\n        onlyController\n    {\n        IERC20(want).safeTransfer(controller, balanceOfWant());\n    }\n\n    /**\n     * @notice Sends stuck tokens in the strategy to the controller\n     * @param _asset The address of the token to withdraw\n     */\n    function withdraw(\n        address _asset\n    )\n        external\n        override\n        onlyController\n    {\n        require(want != _asset, \"want\");\n\n        IERC20 _assetToken = IERC20(_asset);\n        uint256 _balance = _assetToken.balanceOf(address(this));\n        _assetToken.safeTransfer(controller, _balance);\n    }\n\n    /**\n     * @notice Initiated from a vault, withdraws funds from the pool\n     * @param _amount The amount of the want token to withdraw\n     */\n    function withdraw(\n        uint256 _amount\n    )\n        external\n        override\n        onlyController\n    {\n        uint256 _balance = balanceOfWant();\n        if (_balance < _amount) {\n            _amount = _withdrawSome(_amount.sub(_balance));\n            _amount = _amount.add(_balance);\n        }\n\n        IERC20(want).safeTransfer(controller, _amount);\n    }\n\n    /**\n     * @notice Withdraws all funds from the strategy\n     */\n    function withdrawAll()\n        external\n        override\n        onlyController\n    {\n        _withdrawAll();\n\n        uint256 _balance = IERC20(want).balanceOf(address(this));\n\n        IERC20(want).safeTransfer(controller, _balance);\n    }\n\n    /**\n     * EXTERNAL VIEW FUNCTIONS\n     */\n\n    /**\n     * @notice Returns the strategy's balance of the want token plus the balance of pool\n     */\n    function balanceOf()\n        external\n        view\n        override\n        returns (uint256)\n    {\n        return balanceOfWant().add(balanceOfPool());\n    }\n\n    /**\n     * PUBLIC VIEW FUNCTIONS\n     */\n\n    /**\n     * @notice Returns the balance of the pool\n     * @dev Must be implemented by the strategy\n     */\n    function balanceOfPool()\n        public\n        view\n        virtual\n        override\n        returns (uint256);\n\n    /**\n     * @notice Returns the balance of the want token on the strategy\n     */\n    function balanceOfWant()\n        public\n        view\n        override\n        returns (uint256)\n    {\n        return IERC20(want).balanceOf(address(this));\n    }\n\n    /**\n     * INTERNAL FUNCTIONS\n     */\n\n    function _deposit()\n        internal\n        virtual;\n\n    function _harvest(\n        uint256 _estimatedWETH,\n        uint256 _estimatedYAXIS\n    )\n        internal\n        virtual;\n\n    function _payHarvestFees(\n        address _poolToken,\n        uint256 _estimatedWETH,\n        uint256 _estimatedYAXIS\n    )\n        internal\n        returns (uint256 _wethBal)\n    {\n        uint256 _amount = IERC20(_poolToken).balanceOf(address(this));\n        _swapTokens(_poolToken, weth, _amount, _estimatedWETH);\n        _wethBal = IERC20(weth).balanceOf(address(this));\n\n        if (_wethBal > 0) {\n            // get all the necessary variables in a single call\n            (\n                address yaxis,\n                address treasury,\n                uint256 treasuryFee\n            ) = manager.getHarvestFeeInfo();\n\n            uint256 _fee;\n\n            // pay the treasury with YAX\n            if (treasuryFee > 0 && treasury != address(0)) {\n                _fee = _wethBal.mul(treasuryFee).div(ONE_HUNDRED_PERCENT);\n                _swapTokens(weth, yaxis, _fee, _estimatedYAXIS);\n                IERC20(yaxis).safeTransfer(treasury, IERC20(yaxis).balanceOf(address(this)));\n            }\n\n            // return the remaining WETH balance\n            _wethBal = IERC20(weth).balanceOf(address(this));\n        }\n    }\n\n    function _swapTokens(\n        address _input,\n        address _output,\n        uint256 _amount,\n        uint256 _expected\n    )\n        internal\n    {\n        address[] memory path = new address[](2);\n        path[0] = _input;\n        path[1] = _output;\n        router.swapExactTokensForTokens(\n            _amount,\n            _expected,\n            path,\n            address(this),\n            // The deadline is a hardcoded value that is far in the future.\n            1e10\n        );\n    }\n\n    function _withdraw(\n        uint256 _amount\n    )\n        internal\n        virtual;\n\n    function _withdrawAll()\n        internal\n        virtual;\n\n    function _withdrawSome(\n        uint256 _amount\n    )\n        internal\n        returns (uint256)\n    {\n        uint256 _before = IERC20(want).balanceOf(address(this));\n        _withdraw(_amount);\n        uint256 _after = IERC20(want).balanceOf(address(this));\n        _amount = _after.sub(_before);\n\n        return _amount;\n    }\n\n    /**\n     * MODIFIERS\n     */\n\n    modifier onlyStrategist() {\n        require(msg.sender == manager.strategist(), \"!strategist\");\n        _;\n    }\n\n    modifier onlyController() {\n        require(msg.sender == controller, \"!controller\");\n        _;\n    }\n}"
}