Add support for Strategist to harvest rewards#2853
Add support for Strategist to harvest rewards#2853shahthepro wants to merge 7 commits intomasterfrom
Conversation
Codecov Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
| * remain in the strategy until the harvester is unpaused or reset. | ||
| */ | ||
| function collectRewardTokens() external virtual onlyHarvester nonReentrant { | ||
| if (harvesterAddress == address(0) || harvesterPaused) { |
There was a problem hiding this comment.
this if statement is duplicated in _collectRewardTokens
There was a problem hiding this comment.
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.
sparrowDom
left a comment
There was a problem hiding this comment.
Left some comments, otherwise looks good
Code Change
Right now, only
harvesterAddrcan call thecollectRewardTokenson 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.