Skip to content

Add support for Strategist to harvest rewards#2853

Open
shahthepro wants to merge 7 commits intomasterfrom
shah/claim-rewards-v2
Open

Add support for Strategist to harvest rewards#2853
shahthepro wants to merge 7 commits intomasterfrom
shah/claim-rewards-v2

Conversation

@shahthepro
Copy link
Copy Markdown
Collaborator

@shahthepro shahthepro commented Mar 23, 2026

Code Change

Right now, only harvesterAddr can call the collectRewardTokens on the strategies. This changeset will also allow the Strategist/Guardian to call it. It allows Harvester address to be different from the caller. It also enables the 2/8 to change the Harvester address.

The harvesterAddress zero-check is done in both internal and external function. It's because some strategies inherit the internal method, while other inherit the public method. If we do it in one place and forget to do this in the inherited strategies, the rewards could end up going to address(0). Right now, it won't happen because only harvester can call the rewards. It might not be the case going forward.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 23, 2026

Codecov Report

❌ Patch coverage is 42.85714% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 46.96%. Comparing base (1a8b465) to head (692241e).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...acts/automation/ClaimStrategyRewardsSafeModule.sol 0.00% 6 Missing ⚠️
.../contracts/utils/InitializableAbstractStrategy.sol 75.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2853      +/-   ##
==========================================
- Coverage   49.10%   46.96%   -2.14%     
==========================================
  Files         112      112              
  Lines        4835     4842       +7     
  Branches     1338     1342       +4     
==========================================
- Hits         2374     2274     -100     
- Misses       2457     2564     +107     
  Partials        4        4              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@shahthepro shahthepro changed the title Forwards Rewards To CoW Harvester Add support for Strategist to harvest rewards Mar 24, 2026
* remain in the strategy until the harvester is unpaused or reset.
*/
function collectRewardTokens() external virtual onlyHarvester nonReentrant {
if (harvesterAddress == address(0) || harvesterPaused) {
Copy link
Copy Markdown
Collaborator

@naddison36 naddison36 Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this if statement is duplicated in _collectRewardTokens

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, that's intentional and have left a comment about it as well. It's because some strategies inherit the internal method, while other inherit the public method. If we do it in one place and forget to do this in the inherited strategies, the rewards could end up going to address(0). Right now, it won't happen because only harvester can call the rewards. It might not be the case going forward.

Copy link
Copy Markdown
Member

@sparrowDom sparrowDom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some comments, otherwise looks good

Copy link
Copy Markdown
Member

@sparrowDom sparrowDom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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