{
    "Function": "_leverage",
    "File": "contracts/routers/FullRouter.sol",
    "Parent Contracts": [
        "contracts/routers/StrategyRouter.sol",
        "contracts/helpers/StrategyTypes.sol",
        "contracts/interfaces/IStrategyRouter.sol"
    ],
    "High-Level Calls": [
        "IERC20",
        "IStrategy"
    ],
    "Internal Calls": [
        "_buyPath"
    ],
    "Library Calls": [],
    "Low-Level Calls": [],
    "Code": "function _leverage(\n        address strategy,\n        address leverageItem,\n        uint256 leverageLiquidity,\n        bool lastItem\n    ) internal returns (uint256) {\n        uint256 wethBalance = IERC20(weth).balanceOf(address(this));\n        if (wethBalance > 0) {\n            uint256 leverageAmount;\n            if (lastItem) {\n                // If it is the last item being leveraged, use all remaining weth\n                leverageAmount = wethBalance;\n            } else {\n                leverageAmount = leverageLiquidity > wethBalance ? wethBalance : leverageLiquidity;\n            }\n            _buyPath(\n                IStrategy(strategy).getTradeData(leverageItem),\n                leverageAmount,\n                leverageItem,\n                strategy,\n                address(this)\n            );\n            return leverageAmount;\n        }\n    }"
}