From 773ae1b11f309ee8c4e0b1c0d22b9bfa41beae0d Mon Sep 17 00:00:00 2001 From: Daniel Wang <99078276+dantaik@users.noreply.github.com> Date: Sun, 29 Sep 2024 07:40:36 +0800 Subject: [PATCH] feat(protocol): allow owner to update recipient in TokenUnlock (#18184) Co-authored-by: David --- .../contracts/layer1/team/tokenunlock/TokenUnlock.sol | 7 ++++++- .../protocol/script/layer1/tokenunlock/exercise1.data.json | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/protocol/contracts/layer1/team/tokenunlock/TokenUnlock.sol b/packages/protocol/contracts/layer1/team/tokenunlock/TokenUnlock.sol index 8b1250d49a..a951d647c1 100644 --- a/packages/protocol/contracts/layer1/team/tokenunlock/TokenUnlock.sol +++ b/packages/protocol/contracts/layer1/team/tokenunlock/TokenUnlock.sol @@ -66,6 +66,11 @@ contract TokenUnlock is EssentialContract { _; } + modifier onlyRecipientOrOwner() { + if (msg.sender != recipient && msg.sender != owner()) revert PERMISSION_DENIED(); + _; + } + /// @notice Initializes the contract. /// @param _owner The contract owner address. /// @param _rollupAddressManager The rollup address manager. @@ -151,7 +156,7 @@ contract TokenUnlock is EssentialContract { IERC20(resolve(LibStrings.B_TAIKO_TOKEN, false)).safeTransfer(recipient, amount); } - function changeRecipient(address _newRecipient) external onlyRecipient { + function changeRecipient(address _newRecipient) external onlyRecipientOrOwner { if (_newRecipient == address(0) || _newRecipient == recipient) { revert INVALID_PARAM(); } diff --git a/packages/protocol/script/layer1/tokenunlock/exercise1.data.json b/packages/protocol/script/layer1/tokenunlock/exercise1.data.json index c47271254f..3bf88371ae 100644 --- a/packages/protocol/script/layer1/tokenunlock/exercise1.data.json +++ b/packages/protocol/script/layer1/tokenunlock/exercise1.data.json @@ -501,7 +501,7 @@ }, { "proxy": "0x2Da30e14dE6a5fcE16a5Ea72199De76cebDC876C", - "recipient": "0x9c0c06ddbb72f70820d7e55b6b77db175d400fba", + "recipient": "0xf7a0cd60e3b6ab4523a5f54e9a410258895b138d", "vestAmount": 4013867 }, {