From 7eb610c890838f3921a7c03b12c24aafa3e03047 Mon Sep 17 00:00:00 2001 From: Lasse Herskind <16536249+LHerskind@users.noreply.github.com> Date: Tue, 1 Jun 2021 11:04:52 +0200 Subject: [PATCH] fix: Replace _safeRewardsTransfer by IERC20 safeTransfer directly --- .../protocol/tokenization/StaticATokenLM.sol | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/contracts/protocol/tokenization/StaticATokenLM.sol b/contracts/protocol/tokenization/StaticATokenLM.sol index e22aa3e9..006f869e 100644 --- a/contracts/protocol/tokenization/StaticATokenLM.sol +++ b/contracts/protocol/tokenization/StaticATokenLM.sol @@ -457,7 +457,6 @@ contract StaticATokenLM is ERC20 { * @dev Claims rewards from the `_incentivesController` and update `accRewardstokenPerShare` */ function updateRewards() public { - // Only need to claim rewards when once per block. Check with the _incentivesController if (block.number > lastRewardBlock) { lastRewardBlock = block.number; uint256 _supply = totalSupply(); @@ -496,26 +495,11 @@ contract StaticATokenLM is ERC20 { uint256 reward = _getClaimableRewards(user, balance); // Remember that this is converting to wad if (reward > 0) { unclaimedRewards[user] = 0; - _safeRewardTransfer(user, reward); + IERC20(currentRewardToken).safeTransfer(user, reward); _updateRewardDebt(user, balance); } } - /** - * @dev Safe transfer of the rewards, taking into account rounding errors to - * allow the last user to retrieve funds if 1 wei off etc - * @param to The address to receive rewards - * @param amount The amount of rewards to receive in WAD - */ - function _safeRewardTransfer(address to, uint256 amount) internal { - uint256 rewardBal = IERC20(currentRewardToken).balanceOf(address(this)); - if (amount > rewardBal) { - IERC20(currentRewardToken).safeTransfer(to, rewardBal); - } else { - IERC20(currentRewardToken).safeTransfer(to, amount); - } - } - /** * @dev Update the rewardDebt for a user with balance as his balance * @param user The user to update