Skip to content

Commit

Permalink
Use remainingRewards to calculate updated rewardsAdded
Browse files Browse the repository at this point in the history
  • Loading branch information
corddry committed Nov 28, 2024
1 parent 7dd8e0e commit 57adbe3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/WrappedVault.sol
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ contract WrappedVault is Ownable, InitializableERC20, IWrappedVault {

uint256 remainingRewards = rewardsInterval.rate * (rewardsInterval.end - newStart);
uint256 rate = (rewardsAdded - frontendFeeTaken - protocolFeeTaken + remainingRewards) / (newEnd - newStart);
rewardsAdded = (rate - rewardsInterval.rate) * (newEnd - newStart) + frontendFeeTaken + protocolFeeTaken;
rewardsAdded = rate * (newEnd - newStart) - remainingRewards + frontendFeeTaken + protocolFeeTaken;

if (rate < rewardsInterval.rate) revert RateCannotDecrease();

Expand Down

0 comments on commit 57adbe3

Please sign in to comment.