{
    "Function": "removeStrategy",
    "File": "contracts/v3/controllers/Controller.sol",
    "Parent Contracts": [
        "contracts/v3/interfaces/IController.sol"
    ],
    "High-Level Calls": [
        "IHarvester",
        "SafeMath",
        "IManager",
        "IStrategy",
        "IManager"
    ],
    "Internal Calls": [
        "require(bool,string)",
        "notHalted",
        "onlyStrategist"
    ],
    "Library Calls": [
        "sub"
    ],
    "Low-Level Calls": [],
    "Code": "function removeStrategy(\n        address _vault,\n        address _strategy,\n        uint256 _timeout\n    )\n        external\n        notHalted\n        onlyStrategist\n    {\n        require(manager.allowedVaults(_vault), \"!_vault\");\n        VaultDetail storage vaultDetail = _vaultDetails[_vault];\n        // get the index of the strategy to remove\n        uint256 index = vaultDetail.index[_strategy];\n        // get the index of the last strategy\n        uint256 tail = vaultDetail.strategies.length.sub(1);\n        // get the address of the last strategy\n        address replace = vaultDetail.strategies[tail];\n        // replace the removed strategy with the tail\n        vaultDetail.strategies[index] = replace;\n        // set the new index for the replaced strategy\n        vaultDetail.index[replace] = index;\n        // remove the duplicate replaced strategy\n        vaultDetail.strategies.pop();\n        // remove the strategy's index\n        delete vaultDetail.index[_strategy];\n        // remove the strategy's cap\n        delete vaultDetail.caps[_strategy];\n        // remove the strategy's balance\n        delete vaultDetail.balances[_strategy];\n        // remove the mapping of strategy to the vault\n        delete _vaultStrategies[_strategy];\n        // pull funds from the removed strategy to the vault\n        IStrategy(_strategy).withdrawAll();\n        // remove the strategy from the harvester\n        IHarvester(manager.harvester()).removeStrategy(_vault, _strategy, _timeout);\n        emit StrategyRemoved(_vault, _strategy);\n    }"
}