{
    "Function": "_swapSupportingFeeOnTransferTokens",
    "File": "src/LBRouter.sol",
    "Parent Contracts": [
        "src/interfaces/ILBRouter.sol"
    ],
    "High-Level Calls": [
        "IJoePair",
        "IJoePair",
        "IJoePair",
        "IERC20",
        "IERC20",
        "ILBPair",
        "ILBPair"
    ],
    "Internal Calls": [],
    "Library Calls": [],
    "Low-Level Calls": [],
    "Code": "function _swapSupportingFeeOnTransferTokens(\n        address[] memory _pairs,\n        uint256[] memory _pairBinSteps,\n        IERC20[] memory _tokenPath,\n        address _to\n    ) private {\n        IERC20 _token;\n        uint256 _binStep;\n        address _recipient;\n        address _pair;\n\n        IERC20 _tokenNext = _tokenPath[0];\n\n        unchecked {\n            for (uint256 i; i < _pairs.length; ++i) {\n                _pair = _pairs[i];\n                _binStep = _pairBinSteps[i];\n\n                _token = _tokenNext;\n                _tokenNext = _tokenPath[i + 1];\n\n                _recipient = i + 1 == _pairs.length ? _to : _pairs[i + 1];\n\n                if (_binStep == 0) {\n                    (uint256 _reserve0, uint256 _reserve1, ) = IJoePair(_pair).getReserves();\n                    if (_token < _tokenNext) {\n                        uint256 _balance = _token.balanceOf(_pair);\n                        uint256 _amountOut = (_reserve1 * (_balance - _reserve0) * 997) / (_balance * 1_000);\n\n                        IJoePair(_pair).swap(0, _amountOut, _recipient, \"\");\n                    } else {\n                        uint256 _balance = _token.balanceOf(_pair);\n                        uint256 _amountOut = (_reserve0 * (_balance - _reserve1) * 997) / (_balance * 1_000);\n\n                        IJoePair(_pair).swap(_amountOut, 0, _recipient, \"\");\n                    }\n                } else {\n                    ILBPair(_pair).swap(_tokenNext == ILBPair(_pair).tokenY(), _recipient);\n                }\n            }\n        }\n    }"
}