{
    "Function": "addStrategy",
    "File": "contracts/v3/controllers/Controller.sol",
    "Parent Contracts": [
        "contracts/v3/interfaces/IController.sol"
    ],
    "High-Level Calls": [
        "IHarvester",
        "IManager",
        "IManager"
    ],
    "Internal Calls": [
        "onlyStrategy",
        "notHalted",
        "require(bool,string)",
        "require(bool,string)",
        "require(bool,string)",
        "require(bool,string)",
        "onlyStrategist"
    ],
    "Library Calls": [],
    "Low-Level Calls": [],
    "Code": "function addStrategy(\n        address _vault,\n        address _strategy,\n        uint256 _cap,\n        uint256 _timeout\n    )\n        external\n        notHalted\n        onlyStrategist\n        onlyStrategy(_strategy)\n    {\n        require(manager.allowedVaults(_vault), \"!_vault\");\n        require(_vaultDetails[_vault].converter != address(0), \"!converter\");\n        // checking if strategy is already added\n        require(_vaultStrategies[_strategy] == address(0), \"Strategy is already added\"); \n        // get the index of the newly added strategy\n        uint256 index = _vaultDetails[_vault].strategies.length;\n        // ensure we haven't added too many strategies already\n        require(index < maxStrategies, \"!maxStrategies\");\n        // push the strategy to the array of strategies\n        _vaultDetails[_vault].strategies.push(_strategy);\n        // set the cap\n        _vaultDetails[_vault].caps[_strategy] = _cap;\n        // set the index\n        _vaultDetails[_vault].index[_strategy] = index;\n        // store the mapping of strategy to the vault\n        _vaultStrategies[_strategy] = _vault;\n        if (_timeout > 0) {\n            // add it to the harvester\n            IHarvester(manager.harvester()).addStrategy(_vault, _strategy, _timeout);\n        }\n        emit StrategyAdded(_vault, _strategy, _cap);\n    }"
}