From f46acd53cdf11e1fa822164bf09b1765dea8603b Mon Sep 17 00:00:00 2001 From: arcantheon Date: Thu, 20 Jun 2024 20:18:09 +0530 Subject: [PATCH] Moved transfer at the end --- contracts/rewarder/Rewarder.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/rewarder/Rewarder.sol b/contracts/rewarder/Rewarder.sol index 8aeda817..a159b36e 100644 --- a/contracts/rewarder/Rewarder.sol +++ b/contracts/rewarder/Rewarder.sol @@ -298,7 +298,6 @@ contract Rewarder is Ownable, Initializable, ReentrancyGuard { if (rewardsToSend > _rewarderRwdBalance) { rewardsToSend = _rewarderRwdBalance; } - IERC20(REWARD_TOKEN).safeTransfer(_farm, rewardsToSend); } else { rewardsToSend = 0; } @@ -312,6 +311,7 @@ contract Rewarder is Ownable, Initializable, ReentrancyGuard { farmRewardConfigs[_farm].rewardRate = rewardRate; emit RewardCalibrated(_farm, rewardsToSend, rewardRate); _setRewardRate(_farm, rewardRate, farmRewardConfig.nonLockupRewardPer); + if (rewardsToSend != 0) IERC20(REWARD_TOKEN).safeTransfer(_farm, rewardsToSend); } /// @notice Function to set reward rate in the farm.