From 32d9f266cc0023962dce1273b1770ef82489af98 Mon Sep 17 00:00:00 2001 From: Daniel Wang Date: Thu, 25 Jul 2024 12:43:08 +0800 Subject: [PATCH 1/4] Update TokenUnlock.sol --- .../contracts/team/tokenunlock/TokenUnlock.sol | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/protocol/contracts/team/tokenunlock/TokenUnlock.sol b/packages/protocol/contracts/team/tokenunlock/TokenUnlock.sol index 88d716b63d..9ebf151734 100644 --- a/packages/protocol/contracts/team/tokenunlock/TokenUnlock.sol +++ b/packages/protocol/contracts/team/tokenunlock/TokenUnlock.sol @@ -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 some withdrawable tokens. /// @param _to The address the token will be sent to. /// @param _amount The amount of tokens to withdraw. function withdraw( @@ -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(); From e9338e4e532de7f1f84f34d488708785a2562537 Mon Sep 17 00:00:00 2001 From: Daniel Wang Date: Thu, 25 Jul 2024 12:44:33 +0800 Subject: [PATCH 2/4] Update mainnet-contract-logs-L1.md --- packages/protocol/deployments/mainnet-contract-logs-L1.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/protocol/deployments/mainnet-contract-logs-L1.md b/packages/protocol/deployments/mainnet-contract-logs-L1.md index 4b554f33cc..eae241f9d6 100644 --- a/packages/protocol/deployments/mainnet-contract-logs-L1.md +++ b/packages/protocol/deployments/mainnet-contract-logs-L1.md @@ -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 From 3598aee52e953e747f0ded91d87e01ddd0254920 Mon Sep 17 00:00:00 2001 From: Daniel Wang <99078276+dantaik@users.noreply.github.com> Date: Thu, 25 Jul 2024 12:48:17 +0800 Subject: [PATCH 3/4] Update packages/protocol/contracts/team/tokenunlock/TokenUnlock.sol --- packages/protocol/contracts/team/tokenunlock/TokenUnlock.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/protocol/contracts/team/tokenunlock/TokenUnlock.sol b/packages/protocol/contracts/team/tokenunlock/TokenUnlock.sol index 9ebf151734..6e5585299d 100644 --- a/packages/protocol/contracts/team/tokenunlock/TokenUnlock.sol +++ b/packages/protocol/contracts/team/tokenunlock/TokenUnlock.sol @@ -126,7 +126,7 @@ contract TokenUnlock is EssentialContract { IERC20(resolve(LibStrings.B_TAIKO_TOKEN, false)).safeTransfer(_proverSet, _amount); } - /// @notice Withdraws some 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( From a3dd9498bbe2f8a2a1822683ae45de588addc1df Mon Sep 17 00:00:00 2001 From: Daniel Wang Date: Thu, 25 Jul 2024 14:29:52 +0800 Subject: [PATCH 4/4] Update TokenUnlock.sol --- packages/protocol/contracts/team/tokenunlock/TokenUnlock.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/protocol/contracts/team/tokenunlock/TokenUnlock.sol b/packages/protocol/contracts/team/tokenunlock/TokenUnlock.sol index 6e5585299d..a854cdc96c 100644 --- a/packages/protocol/contracts/team/tokenunlock/TokenUnlock.sol +++ b/packages/protocol/contracts/team/tokenunlock/TokenUnlock.sol @@ -145,7 +145,7 @@ contract TokenUnlock is EssentialContract { } /// @notice Withdraws all tokens to the recipient address. - function withdrawToRecipient() external nonReentrant { + function withdraw() external nonReentrant { uint256 amount = amountWithdrawable(); emit TokenWithdrawn(recipient, amount); IERC20(resolve(LibStrings.B_TAIKO_TOKEN, false)).safeTransfer(recipient, amount);