Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comments on clearing last collect #427

Merged
merged 4 commits into from
May 28, 2024
Merged

Conversation

DanielVF
Copy link
Contributor

@DanielVF DanielVF commented May 23, 2024

During the audit we made the following two changes:

Removed from FixedRateRewardsSource.sol initialize:

 _setRewardsPerSecond(_rewardsPerSecond); // removed

Added to FixedRateRewardsSource.sol _setRewardsPerSecond:

if (_config.rewardsPerSecond == 0) {
   _config.lastCollect = uint64(block.timestamp);
}

These make it so that when rewards are enabled on the contract, the lastCollect is reset to the current time, and thus no rewards will be paid out for the period when the rewards were set to zero.

In other case, as before, the contract will pay out pending rewards from the lastCollect at the newly set rate. Calling collectRewards before setting the rate allows precise reward payments for past rewards.

This PR just updates the comments on this change.

contracts/FixedRateRewardsSource.sol Outdated Show resolved Hide resolved
@DanielVF DanielVF merged commit 81cfc64 into master May 28, 2024
4 checks passed
@DanielVF DanielVF deleted the DanielVF/comments-update branch May 28, 2024 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants