Skip to content

Add support for Strategist to harvest rewards#2853

Merged
shahthepro merged 9 commits intomasterfrom
shah/claim-rewards-v2
Apr 1, 2026
Merged

Add support for Strategist to harvest rewards#2853
shahthepro merged 9 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 54.54545% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 53.26%. Comparing base (1a8b465) to head (bca69e1).
⚠️ Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
...acts/automation/ClaimStrategyRewardsSafeModule.sol 0.00% 6 Missing ⚠️
.../contracts/utils/InitializableAbstractStrategy.sol 83.33% 2 Missing ⚠️
...acts/contracts/strategies/BaseCurveAMOStrategy.sol 0.00% 1 Missing ⚠️
...strategies/crosschain/CrossChainMasterStrategy.sol 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2853      +/-   ##
==========================================
+ Coverage   49.10%   53.26%   +4.16%     
==========================================
  Files         112      112              
  Lines        4835     4844       +9     
  Branches     1338     1343       +5     
==========================================
+ Hits         2374     2580     +206     
+ Misses       2457     2259     -198     
- Partials        4        5       +1     

☔ 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

Comment thread contracts/contracts/utils/InitializableAbstractStrategy.sol Outdated
Comment thread contracts/deploy/mainnet/187_upgrade_curve_amo_morpho_harvester.js
Comment thread contracts/deploy/mainnet/187_upgrade_curve_amo_morpho_harvester.js
Comment thread contracts/deploy/mainnet/187_upgrade_curve_amo_morpho_harvester.js
sparrowDom
sparrowDom previously approved these changes Mar 31, 2026
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

* @notice Collect accumulated reward token and send to Vault.
* No-ops when the harvester address is not set.
*/
function collectRewardTokens() external virtual onlyHarvester nonReentrant {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The onlyHarvester modifier was renamed to onlyHarvesterOrStrategist (line 165) but this function still references the old name. This breaks compilation:

DeclarationError: Identifier not found or not unique.
   --> contracts/utils/InitializableAbstractStrategy.sol:124:53

Should be onlyHarvesterOrStrategist here too.

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.

Thanks, fixed

clement-ux
clement-ux previously approved these changes Apr 1, 2026
@shahthepro shahthepro merged commit 3ef29c0 into master Apr 1, 2026
14 of 18 checks passed
@shahthepro shahthepro deleted the shah/claim-rewards-v2 branch April 1, 2026 09:58
clement-ux added a commit that referenced this pull request Apr 13, 2026
…gist modifier

Align test expectations with master's PR #2853 which allows strategist
to call collectRewardTokens.
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.

4 participants