{
    "Function": "_deposit",
    "File": "contracts/rubiconPools/BathToken.sol",
    "Parent Contracts": [],
    "High-Level Calls": [
        "IERC20",
        "IERC20",
        "SafeMath",
        "SafeMath",
        "IERC20",
        "SafeMath"
    ],
    "Internal Calls": [
        "underlyingBalance",
        "_mint",
        "underlyingBalance"
    ],
    "Library Calls": [
        "sub",
        "div",
        "mul"
    ],
    "Low-Level Calls": [],
    "Code": "function _deposit(uint256 assets, address receiver)\n        internal\n        returns (uint256 shares)\n    {\n        uint256 _pool = underlyingBalance();\n        uint256 _before = underlyingToken.balanceOf(address(this));\n\n        // **Assume caller is depositor**\n        underlyingToken.transferFrom(msg.sender, address(this), assets);\n        uint256 _after = underlyingToken.balanceOf(address(this));\n        assets = _after.sub(_before); // Additional check for deflationary tokens\n\n        (totalSupply == 0) ? shares = assets : shares = (\n            assets.mul(totalSupply)\n        ).div(_pool);\n\n        // Send shares to designated target\n        _mint(receiver, shares);\n        emit LogDeposit(\n            assets,\n            underlyingToken,\n            shares,\n            msg.sender,\n            underlyingBalance(),\n            outstandingAmount,\n            totalSupply\n        );\n        emit Deposit(msg.sender, msg.sender, assets, shares);\n    }"
}