Skip to content

Commit

Permalink
adds withdraw
Browse files Browse the repository at this point in the history
  • Loading branch information
WalidOfNow committed Jun 13, 2024
1 parent 9460dcf commit c8c1f26
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions mainnet-contracts/src/based-contracts/PufToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,18 @@ contract PufToken is ERC20, ERC20Permit {

_mint(msg.sender, amount);
}

function withdraw(uint256 amount) external onlyDepositor {
if (balanceOf(msg.sender) < amount) {
revert InsufficientBalance();
}

_burn(msg.sender, amount);

if (!IERC20(originalToken).transfer(msg.sender, amount)) {
revert TransferFailed();
}
}
}

interface IMigrator {
Expand Down

0 comments on commit c8c1f26

Please sign in to comment.