{
    "Function": "withdraw",
    "File": "contracts/ConvexStakingWrapper.sol",
    "Parent Contracts": [
        "node_modules/@openzeppelin/contracts/security/Pausable.sol",
        "node_modules/@openzeppelin/contracts/security/ReentrancyGuard.sol",
        "node_modules/@openzeppelin/contracts/access/Ownable.sol",
        "node_modules/@openzeppelin/contracts/utils/Context.sol"
    ],
    "High-Level Calls": [
        "MasterChef",
        "MasterChef",
        "SafeERC20",
        "IRewardStaking",
        "IRewardStaking"
    ],
    "Internal Calls": [
        "require(bool,string)",
        "nonReentrant",
        "currentEpoch",
        "require(bool,string)",
        "_checkpoint",
        "currentEpoch"
    ],
    "Library Calls": [
        "safeTransfer"
    ],
    "Low-Level Calls": [],
    "Code": "function withdraw(uint256 _pid, uint256 _amount) external nonReentrant {\n        WithdrawRequest memory request = withdrawRequest[_pid][msg.sender];\n        require(request.epoch < currentEpoch() && deposits[_pid][msg.sender].epoch + 1 < currentEpoch(), \"wait\");\n        require(request.amount >= _amount, \"too much\");\n        _checkpoint(_pid, msg.sender);\n        deposits[_pid][msg.sender].amount -= uint192(_amount);\n        if (_amount > 0) {\n            IRewardStaking(convexPool[_pid]).withdrawAndUnwrap(_amount, false);\n            IERC20 lpToken = IERC20(\n                IRewardStaking(convexPool[_pid]).poolInfo(_pid).lptoken\n            );\n            lpToken.safeTransfer(msg.sender, _amount);\n            uint256 pid = masterChef.pid(address(lpToken));\n            masterChef.withdraw(msg.sender, pid, _amount);\n        }\n        delete withdrawRequest[_pid][msg.sender];\n        //events\n        emit Withdrawn(msg.sender, _amount);\n    }"
}