{
    "Function": "_sellPath",
    "File": "contracts/routers/StrategyRouter.sol",
    "Parent Contracts": [
        "contracts/helpers/StrategyTypes.sol",
        "contracts/interfaces/IStrategyRouter.sol"
    ],
    "High-Level Calls": [
        "IERC20"
    ],
    "Internal Calls": [
        "_delegateSwap"
    ],
    "Library Calls": [],
    "Low-Level Calls": [],
    "Code": "function _sellPath(\n        TradeData memory data,\n        uint256 amount,\n        address token,\n        address strategy\n    ) internal {\n        if (amount > 0) {\n            for (int256 i = int256(data.adapters.length-1); i >= 0; i--) { //this doesn't work with uint256?? wtf solidity\n                uint256 _amount;\n                address _tokenIn;\n                address _tokenOut;\n                address _from;\n                address _to;\n                if (uint256(i) == data.adapters.length-1) {\n                    _tokenIn = token;\n                    _amount = amount;\n                    _from = strategy;\n                } else {\n                    _tokenIn = data.path[uint256(i)];\n                    _from = address(this);\n                    _amount = IERC20(_tokenIn).balanceOf(_from);\n                }\n                if (uint256(i) == 0) {\n                    _tokenOut = weth;\n                    _to = strategy;\n                } else {\n                    _tokenOut = data.path[uint256(i-1)];\n                    _to = address(this);\n                }\n                _delegateSwap(\n                    data.adapters[uint256(i)],\n                    _amount,\n                    1,\n                    _tokenIn,\n                    _tokenOut,\n                    _from,\n                    _to\n                );\n            }\n        }\n    }"
}