Skip to content

Commit

Permalink
Allow individual masterchefs to update in case only one needs to be u…
Browse files Browse the repository at this point in the history
…pdated.
  • Loading branch information
0xnavigator committed May 3, 2023
1 parent 329ee7e commit 68e6cc9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/AMasterchefBase.sol
Expand Up @@ -126,7 +126,6 @@ abstract contract AMasterchefBase is Ownable {
/// @notice Adds rewards to the pool and updates the reward rate.
/// Must add and evenly distribute rewards through the rewardsDuration.
function updateRewards(uint256 amount) external virtual onlyOwner {
require(amount != 0, 'Masterchef: Nothing to update');
require(totalAllocPoint != 0, 'Masterchef: Must initiate a pool before updating rewards');
IERC20(REWARD_TOKEN).safeTransferFrom(msg.sender, address(this), amount);

Expand Down
8 changes: 6 additions & 2 deletions src/FeeSplitter.sol
Expand Up @@ -128,8 +128,12 @@ contract FeeSplitter is Ownable {
pendingBucketTokenIn = 0;
remainingBucketsTokenIn = 0;

Masterchef(MASTERCHEF_0).updateRewards(mc0TokenIn);
Masterchef(MASTERCHEF_1).updateRewards(mc1TokenIn);
if (mc0TokenIn != 0) {
Masterchef(MASTERCHEF_0).updateRewards(mc0TokenIn);
}
if (mc1TokenIn != 0) {
Masterchef(MASTERCHEF_1).updateRewards(mc1TokenIn);
}

emit UpdateFees(msg.sender, totalExchangedIn, mc0TokenIn, mc1TokenIn);
}
Expand Down
1 change: 0 additions & 1 deletion test/Audit.t.sol
Expand Up @@ -78,7 +78,6 @@ contract AuditTest is ABaseExit10Test {
skip(1 days);

// Call updateFees with 0 amount
vm.expectRevert(bytes('Masterchef: Nothing to update'));
FeeSplitter(feeSplitter).updateFees(0);

console.log('MC0 RewardRate:', masterchef0.rewardRate());
Expand Down

0 comments on commit 68e6cc9

Please sign in to comment.