Skip to content

Instantly share code, notes, and snippets.

@percybolmer
Last active May 8, 2021 04:41
Show Gist options
  • Save percybolmer/d610d63b8f6690580c2174b127a55e33 to your computer and use it in GitHub Desktop.
Save percybolmer/d610d63b8f6690580c2174b127a55e33 to your computer and use it in GitHub Desktop.
/**
* @notice
* removeStake removes a stake from the stakes mapping and returns the amount to the owner
*/
function removeStake(uint256 _stake) public {
require(stakes[msg.sender] >= _stake, "Cannot withdraw more than you have staked");
// Remove by subtracting the money unstaked
stakes[msg.sender] = stakes[msg.sender] - _stake;
// Return staked tokens to user
_mint(msg.sender, _stake);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment