{
    "Function": "_repayToken",
    "File": "contracts/routers/FullRouter.sol",
    "Parent Contracts": [
        "contracts/routers/StrategyRouter.sol",
        "contracts/helpers/StrategyTypes.sol",
        "contracts/interfaces/IStrategyRouter.sol"
    ],
    "High-Level Calls": [
        "IStrategy",
        "IStrategy",
        "StrategyLibrary",
        "StrategyLibrary",
        "SignedSafeMath",
        "SignedSafeMath"
    ],
    "Internal Calls": [
        "_repayPath"
    ],
    "Library Calls": [
        "getRange",
        "getExpectedTokenValue",
        "add",
        "sub"
    ],
    "Low-Level Calls": [],
    "Code": "function _repayToken(\n        address strategy,\n        address token,\n        uint256 total,\n        int256 estimatedValue\n    ) internal {\n        int256 expectedValue = StrategyLibrary.getExpectedTokenValue(total, strategy, token);\n        int256 rebalanceRange =\n            StrategyLibrary.getRange(\n                expectedValue,\n                IStrategy(strategy).rebalanceThreshold()\n            );\n        TradeData memory tradeData = IStrategy(strategy).getTradeData(token);\n        // We still call _repayPath even if amountInWeth == 0 because we need to check if leveraged tokens need to be deleveraged\n        uint256 amountInWeth = estimatedValue < expectedValue.add(rebalanceRange) ? uint256(-estimatedValue.sub(expectedValue)) : 0;\n        _repayPath(\n            tradeData,\n            amountInWeth,\n            total,\n            strategy\n        );\n    }"
}