From 36fce46c93f3043d7c08873323088432c29754f8 Mon Sep 17 00:00:00 2001 From: Merlin <39942523+0xmer1in@users.noreply.github.com> Date: Wed, 11 Sep 2024 15:05:21 +0800 Subject: [PATCH] chore: add migrate function for WooSimpleRewarder (#134) --- contracts/WooSimpleRewarder.sol | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/contracts/WooSimpleRewarder.sol b/contracts/WooSimpleRewarder.sol index 1fcbe61..d207f2b 100644 --- a/contracts/WooSimpleRewarder.sol +++ b/contracts/WooSimpleRewarder.sol @@ -155,6 +155,19 @@ contract WooSimpleRewarder is IRewarder, Ownable, ReentrancyGuard { } } + /// @notice For migrate to new WooSimpleRewarder only + /// @param _users array of user address + /// @param _weAmounts array of user weToken amount they deposited to MasterChef + function migrateUserAmounts(address[] memory _users, uint256[] memory _weAmounts) external onlyOwner { + uint256 length = _users.length; + unchecked { + for (uint256 i = 0; i < length; i++) { + UserInfo storage user = userInfo[_users[i]]; + user.amount = _weAmounts[i]; + } + } + } + /// @notice In case rewarder is stopped before emissions finished, /// @notice this function allows withdrawal of remaining tokens. function emergencyWithdraw() public onlyOwner {