{
    "Function": "_withdraw",
    "File": "contracts/rubiconPools/BathToken.sol",
    "Parent Contracts": [],
    "High-Level Calls": [
        "IERC20",
        "SafeMath",
        "SafeMath",
        "SafeMath",
        "SafeMath",
        "SafeMath",
        "IERC20"
    ],
    "Internal Calls": [
        "distributeBonusTokenRewards",
        "_burn",
        "underlyingBalance",
        "underlyingBalance"
    ],
    "Library Calls": [
        "mul",
        "mul",
        "sub",
        "div",
        "div"
    ],
    "Low-Level Calls": [],
    "Code": "function _withdraw(uint256 _shares, address receiver)\n        internal\n        returns (uint256 amountWithdrawn)\n    {\n        uint256 _initialTotalSupply = totalSupply;\n\n        // Distribute network rewards first in order to handle bonus token == underlying token case; it only releases vested tokens in this call\n        distributeBonusTokenRewards(receiver, _shares, _initialTotalSupply);\n\n        uint256 r = (underlyingBalance().mul(_shares)).div(_initialTotalSupply);\n        _burn(msg.sender, _shares);\n        uint256 _fee = r.mul(feeBPS).div(10000);\n        // If FeeTo == address(0) then the fee is effectively accrued by the pool\n        if (feeTo != address(0)) {\n            underlyingToken.transfer(feeTo, _fee);\n        }\n        amountWithdrawn = r.sub(_fee);\n        underlyingToken.transfer(receiver, amountWithdrawn);\n\n        emit LogWithdraw(\n            amountWithdrawn,\n            underlyingToken,\n            _shares,\n            msg.sender,\n            _fee,\n            feeTo,\n            underlyingBalance(),\n            outstandingAmount,\n            totalSupply\n        );\n        emit Withdraw(\n            msg.sender,\n            receiver,\n            msg.sender,\n            amountWithdrawn,\n            _shares\n        );\n    }"
}