{
    "Function": "initialStake",
    "File": "contracts/Sherlock.sol",
    "Parent Contracts": [
        "node_modules/@openzeppelin/contracts/security/Pausable.sol",
        "node_modules/@openzeppelin/contracts/access/Ownable.sol",
        "node_modules/@openzeppelin/contracts/token/ERC721/ERC721.sol",
        "node_modules/@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol",
        "contracts/interfaces/ISherlock.sol",
        "node_modules/@openzeppelin/contracts/token/ERC721/IERC721.sol",
        "node_modules/@openzeppelin/contracts/utils/introspection/ERC165.sol",
        "node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol",
        "node_modules/@openzeppelin/contracts/utils/Context.sol",
        "contracts/interfaces/ISherlockStrategy.sol",
        "contracts/interfaces/ISherlockPayout.sol",
        "contracts/interfaces/ISherlockGov.sol",
        "contracts/interfaces/ISherlockStake.sol"
    ],
    "High-Level Calls": [
        "SafeERC20"
    ],
    "Internal Calls": [
        "revert ZeroArgument()",
        "revert ZeroArgument()",
        "_stake",
        "whenNotPaused",
        "totalTokenBalanceStakers",
        "_safeMint",
        "revert InvalidArgument()"
    ],
    "Library Calls": [
        "safeTransferFrom"
    ],
    "Low-Level Calls": [],
    "Code": "function initialStake(\n    uint256 _amount,\n    uint256 _period,\n    address _receiver\n  ) external override whenNotPaused returns (uint256 _id, uint256 _sher) {\n    if (_amount == 0) revert ZeroArgument();\n    // Makes sure the period is a whitelisted period\n    if (!stakingPeriods[_period]) revert InvalidArgument();\n    if (address(_receiver) == address(0)) revert ZeroArgument();\n    // Adds 1 to the ID of the last NFT created for the new NFT ID\n    _id = ++nftCounter;\n\n    // Transfers the USDC from the msg.sender to this contract for the amount specified (this is the staking action)\n    token.safeTransferFrom(msg.sender, address(this), _amount);\n\n    uint256 stakeShares_;\n    uint256 totalStakeShares_ = totalStakeShares;\n    // _amount of tokens divided by the \"before\" total amount of tokens, multiplied by the \"before\" amount of stake shares\n    if (totalStakeShares_ != 0)\n      stakeShares_ = (_amount * totalStakeShares_) / (totalTokenBalanceStakers() - _amount);\n      // If this is the first stake ever, we just mint stake shares equal to the amount of USDC staked\n    else stakeShares_ = _amount;\n\n    // Assigns this NFT ID the calc'd amount of stake shares above\n    stakeShares[_id] = stakeShares_;\n    // Adds the newly created stake shares to the total amount of stake shares\n    totalStakeShares += stakeShares_;\n\n    // Locks up the USDC amount and calcs the SHER token amount to receive on unstake\n    _sher = _stake(_amount, _period, _id, _receiver);\n\n    // This is an ERC-721 function that creates an NFT and sends it to the receiver\n    _safeMint(_receiver, _id);\n  }"
}