Skip to content

Commit

Permalink
feat(supplementary-contracts): allow any users to withdraw to recipie…
Browse files Browse the repository at this point in the history
…nt (#17194)
  • Loading branch information
dantaik authored May 15, 2024
1 parent cd51442 commit 2792150
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,16 @@ contract TokenUnlocking is OwnableUpgradeable, ReentrancyGuardUpgradeable {

/// @notice Withdraws all withdrawable tokens.
/// @param _to The address the token will be sent to.
function withdraw(address _to) external onlyRecipient nonReentrant {
function withdraw(address _to) external nonReentrant {
uint256 amount = amountWithdrawable();
if (amount == 0) revert NOT_WITHDRAWABLE();

amountWithdrawn += amount;
address to = _to == address(0) ? recipient : _to;
if (to != recipient && msg.sender != recipient) {
revert PERMISSION_DENIED();
}

amountWithdrawn += amount;
emit TokenWithdrawn(to, amount);

IERC20(taikoToken).safeTransfer(to, amount);
Expand Down

0 comments on commit 2792150

Please sign in to comment.