{
    "Function": "deposit",
    "File": "src/contracts/strategies/StrategyBase.sol",
    "Parent Contracts": [
        "src/contracts/interfaces/IStrategy.sol",
        "src/contracts/permissions/Pausable.sol",
        "src/contracts/interfaces/IPausable.sol",
        "lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol"
    ],
    "High-Level Calls": [],
    "Internal Calls": [
        "require(bool,string)",
        "require(bool,string)",
        "onlyWhenNotPaused",
        "_tokenBalance",
        "require(bool,string)",
        "onlyStrategyManager"
    ],
    "Library Calls": [],
    "Low-Level Calls": [],
    "Code": "function deposit(IERC20 token, uint256 amount)\n        external\n        virtual\n        override\n        onlyWhenNotPaused(PAUSED_DEPOSITS)\n        onlyStrategyManager\n        returns (uint256 newShares)\n    {\n        require(token == underlyingToken, \"StrategyBase.deposit: Can only deposit underlyingToken\");\n\n        /**\n         * @notice calculation of newShares *mirrors* `underlyingToShares(amount)`, but is different since the balance of `underlyingToken`\n         * has already been increased due to the `strategyManager` transferring tokens to this strategy prior to calling this function\n         */\n        if (totalShares == 0) {\n            newShares = amount;\n        } else {\n            uint256 priorTokenBalance = _tokenBalance() - amount;\n            if (priorTokenBalance == 0) {\n                newShares = amount;\n            } else {\n                newShares = (amount * totalShares) / priorTokenBalance;\n            }\n        }\n\n        // checks to ensure correctness / avoid edge case where share rate can be massively inflated as a 'griefing' sort of attack\n        require(newShares != 0, \"StrategyBase.deposit: newShares cannot be zero\");\n        uint256 updatedTotalShares = totalShares + newShares;\n        require(updatedTotalShares >= MIN_NONZERO_TOTAL_SHARES,\n            \"StrategyBase.deposit: updated totalShares amount would be nonzero but below MIN_NONZERO_TOTAL_SHARES\");\n\n        // update total share amount\n        totalShares = updatedTotalShares;\n        return newShares;\n    }"
}