{
    "Function": "slitherConstructorConstantVariables",
    "File": "contracts/vaults/yVault/Controller.sol",
    "Parent Contracts": [
        "node_modules/@openzeppelin/contracts/access/AccessControl.sol",
        "node_modules/@openzeppelin/contracts/utils/introspection/ERC165.sol",
        "node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol",
        "node_modules/@openzeppelin/contracts/access/IAccessControl.sol",
        "node_modules/@openzeppelin/contracts/utils/Context.sol"
    ],
    "High-Level Calls": [],
    "Internal Calls": [
        "keccak256(bytes)"
    ],
    "Library Calls": [],
    "Low-Level Calls": [],
    "Code": "contract Controller is AccessControl {\n    using SafeERC20 for IERC20;\n\n    bytes32 public constant STRATEGIST_ROLE = keccak256(\"STRATEGIST_ROLE\");\n\n    IERC20 public immutable jpeg;\n    address public feeAddress;\n\n    mapping(IERC20 => address) public vaults;\n    mapping(IERC20 => IStrategy) public strategies;\n    mapping(IERC20 => mapping(IStrategy => bool)) public approvedStrategies;\n\n    /// @param _feeAddress The address to send fees to\n    constructor(address _jpeg, address _feeAddress) {\n        _setupRole(DEFAULT_ADMIN_ROLE, msg.sender);\n        setFeeAddress(_feeAddress);\n        jpeg = IERC20(_jpeg);\n    }\n\n    /// @notice Allows the DAO to set the fee receiver address\n    /// @param _feeAddress The new fee receiver address\n    function setFeeAddress(address _feeAddress)\n        public\n        onlyRole(DEFAULT_ADMIN_ROLE)\n    {\n        require(_feeAddress != address(0), \"INVALID_FEE_ADDRESS\");\n        feeAddress = _feeAddress;\n    }\n\n    /// @notice Allows the strategist to set the vault for a token\n    /// @param _token The token to set the vault for\n    /// @param _vault The vault address\n    function setVault(IERC20 _token, address _vault)\n        external\n        onlyRole(STRATEGIST_ROLE)\n    {\n        require(vaults[_token] == address(0), \"ALREADY_HAS_VAULT\");\n        require(_vault != address(0), \"INVALID_VAULT\");\n        vaults[_token] = _vault;\n    }\n\n    /// @notice Allows the DAO to approve a strategy for a token\n    /// @param _token The strategy's target token\n    /// @param _strategy The strategy for the token\n    function approveStrategy(IERC20 _token, IStrategy _strategy)\n        external\n        onlyRole(DEFAULT_ADMIN_ROLE)\n    {\n        require(address(_token) != address(0), \"INVALID_TOKEN\");\n        require(address(_strategy) != address(0), \"INVALID_STRATEGY\");\n\n        approvedStrategies[_token][_strategy] = true;\n    }\n\n    /// @notice Allows the DAO to revoke a strategy for a token\n    /// @param _token The strategy's target token\n    /// @param _strategy The strategy to revoke\n    function revokeStrategy(IERC20 _token, IStrategy _strategy)\n        external\n        onlyRole(DEFAULT_ADMIN_ROLE)\n    {\n        require(address(_token) != address(0), \"INVALID_TOKEN\");\n        require(address(_strategy) != address(0), \"INVALID_STRATEGY\");\n\n        approvedStrategies[_token][_strategy] = false;\n    }\n\n    /// @notice Allows the members of the `STRATEGIST_ROLE` to change between approved strategies for `_token`\n    /// @param _token The token to change strategy for\n    /// @param _strategy The strategy to change to\n    function setStrategy(IERC20 _token, IStrategy _strategy)\n        external\n        onlyRole(STRATEGIST_ROLE)\n    {\n        require(\n            approvedStrategies[_token][_strategy] == true,\n            \"STRATEGY_NOT_APPROVED\"\n        );\n\n        IStrategy _current = strategies[_token];\n        if (address(_current) != address(0)) {\n            //withdraw all funds from the current strategy\n            _current.withdrawAll();\n            _current.withdraw(address(jpeg));\n        }\n        strategies[_token] = _strategy;\n    }\n\n    /// @notice Allows anyone to deposit tokens from this contract to the token's strategy. Usually called by a vault after having sent tokens to this contract.\n    /// @param _token The token to deposit\n    /// @param _amount The amount of tokens to deposit\n    function earn(IERC20 _token, uint256 _amount) external {\n        IStrategy strategy = strategies[_token];\n        _token.safeTransfer(address(strategy), _amount);\n        strategy.deposit();\n    }\n\n    /// @return The amount of tokens held by `_token`'s strategy\n    /// @param _token The token to check\n    function balanceOf(IERC20 _token) external view returns (uint256) {\n        return strategies[_token].balanceOf();\n    }\n\n    /// @return The amount of JPEG available to be withdrawn from `_token`'s strategy\n    /// @param _token The token to check\n    function balanceOfJPEG(IERC20 _token) external view returns (uint256) {\n        return strategies[_token].balanceOfJPEG();\n    }\n\n    /// @notice Allows members of the `STRATEGIST_ROLE` to withdraw all strategy tokens from a strategy (e.g. In case of a bug in the strategy)\n    /// The tokens will be sent to the token's vault\n    /// @param _token The token to withdraw\n    function withdrawAll(IERC20 _token) external onlyRole(STRATEGIST_ROLE) {\n        strategies[_token].withdrawAll();\n    }\n\n    /// @notice Allows members of the `STRATEGIST_ROLE` to withdraw tokens stuck in this constract\n    /// @param _token The token to withdraw\n    /// @param _amount The amount of tokens to withdraw\n    function inCaseTokensGetStuck(IERC20 _token, uint256 _amount)\n        external\n        onlyRole(STRATEGIST_ROLE)\n    {\n        _token.safeTransfer(msg.sender, _amount);\n    }\n\n    /// @notice Allows members of the `STRATEGIST_ROLE` to withdraw non strategy tokens from a strategy\n    /// @param _strategy The strategy to withdraw from\n    /// @param _token The token to withdraw\n    function inCaseStrategyTokensGetStuck(IStrategy _strategy, address _token)\n        external\n        onlyRole(STRATEGIST_ROLE)\n    {\n        _strategy.withdraw(_token);\n    }\n\n    /// @notice Allows a vault to withdraw strategy tokens from a strategy (usually done during withdrawals from vaults)\n    /// @param _token The token to withdraw\n    /// @param _amount The amount of tokens to withdraw\n    function withdraw(IERC20 _token, uint256 _amount) public {\n        require(msg.sender == vaults[_token], \"NOT_VAULT\");\n        strategies[_token].withdraw(_amount);\n    }\n\n    /// @notice Allows the vault for token `_token` to withdraw JPEG from\n    /// `_token`'s strategy\n    /// @param _token The strategy's token\n    /// @param _to The address to send JPEG to\n    function withdrawJPEG(\n        IERC20 _token,\n        address _to\n    ) external {\n        require(msg.sender == vaults[_token], \"NOT_VAULT\");\n        strategies[_token].withdrawJPEG(_to);\n    }\n}"
}