Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(protocol): allow any address to withdraw token to the recipient address #17843

Merged
merged 4 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions packages/protocol/contracts/team/tokenunlock/TokenUnlock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ contract TokenUnlock is EssentialContract {
IERC20(resolve(LibStrings.B_TAIKO_TOKEN, false)).safeTransfer(_proverSet, _amount);
}

/// @notice Withdraws all withdrawable tokens.
/// @notice Withdraws tokens by the recipient.
/// @param _to The address the token will be sent to.
/// @param _amount The amount of tokens to withdraw.
function withdraw(
Expand All @@ -140,12 +140,17 @@ contract TokenUnlock is EssentialContract {
nonReentrant
{
if (_amount > amountWithdrawable()) revert NOT_WITHDRAWABLE();

emit TokenWithdrawn(_to, _amount);

IERC20(resolve(LibStrings.B_TAIKO_TOKEN, false)).safeTransfer(_to, _amount);
}

/// @notice Withdraws all tokens to the recipient address.
function withdrawToRecipient() external nonReentrant {
uint256 amount = amountWithdrawable();
emit TokenWithdrawn(recipient, amount);
IERC20(resolve(LibStrings.B_TAIKO_TOKEN, false)).safeTransfer(recipient, amount);
}

function changeRecipient(address _newRecipient) external onlyRecipient {
if (_newRecipient == address(0) || _newRecipient == recipient) {
revert INVALID_PARAM();
Expand Down
3 changes: 3 additions & 0 deletions packages/protocol/deployments/mainnet-contract-logs-L1.md
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,9 @@
- impl: `0x035AFfC82612de31E9Db2259B9482D0Dd53B7819`
- logs:
- deployed @commit`bca493f` @tx`0x0a4a63715257b766ca06e7e87ee25088d557c460e50120208b31666c83fc68bc`
- todo:
- deploy a new version with `withdrawToRecipient` function
- upgrade `0x2Bc21D70BDe29a8E6576F7aCD979029058f2eeF9` with the new implementation

### prover_set

Expand Down