{
    "Function": "execute",
    "File": "contracts/SherBuy.sol",
    "Parent Contracts": [],
    "High-Level Calls": [
        "IERC20",
        "ISherClaim",
        "SafeERC20",
        "ISherlock",
        "SafeERC20"
    ],
    "Internal Calls": [
        "viewCapitalRequirements"
    ],
    "Library Calls": [
        "safeTransferFrom",
        "safeTransferFrom"
    ],
    "Low-Level Calls": [],
    "Code": "function execute(uint256 _sherAmountWant) external {\n    // Calculate the capital requirements\n    // Check how much SHER can actually be bought\n    (uint256 sherAmount, uint256 stake, uint256 price) = viewCapitalRequirements(_sherAmountWant);\n\n    // Transfer usdc from user to this, for staking (max is approved in constructor)\n    usdc.safeTransferFrom(msg.sender, address(this), stake);\n    // Transfer usdc from user to receiver, for payment of the SHER\n    usdc.safeTransferFrom(msg.sender, receiver, price);\n\n    // Stake usdc and send NFT to user\n    sherlockPosition.initialStake(stake, PERIOD, msg.sender);\n    // Approve in function as this contract will hold SHER tokens\n    sher.approve(address(sherClaim), sherAmount);\n    // Add bought SHER tokens to timelock for user\n    sherClaim.add(msg.sender, sherAmount);\n\n    // Emit event about the purchase\n    emit Purchase(msg.sender, sherAmount, stake, price);\n  }"
}