```\nfunction withdrawStake(address payable withdrawAddress) external {\n    DepositInfo storage info = deposits[msg.sender];\n    uint256 stake = info.stake;\n    require(stake > 0, "No stake to withdraw");\n    require(info.withdrawTime > 0, "must call unlockStake() first");\n    require(info.withdrawTime <= block.timestamp, "Stake withdrawal is not due");\n    info.unstakeDelaySec = 0;\n    info.withdrawTime = 0;\n    info.stake = 0;\n    emit StakeWithdrawn(msg.sender, withdrawAddress, stake);\n    (bool success,) = withdrawAddress.call{value : stake}("");\n    require(success, "failed to withdraw stake");\n}\n```\n