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

Abstract IncentivesContract logic, adapt Staked Incentives Controller and Pull Reward Incentives Controller #6

Merged
merged 12 commits into from
Nov 16, 2021

Conversation

kartojal
Copy link
Contributor

@kartojal kartojal commented Aug 23, 2021

Changes

  • Add BaseIncentivesController abstract contract
  • Adapt StakedIncentives to inherit new abstract contract without any internal change.
  • Add PullRewardsIncentivesController contract that inherits Base contracts and at claim does ERC20 transfer from external reward vault.
  • Add deployment scripts.

Reasoning

As @miguelmtzinf pointed out, the last iteration of the BaseIncentivesController had the same logic than the Staked Incentives contracts so makes sense to extract the logic into an abstract contract and them and in this way we can create new customized incentives controllers without touching the core logic or storage of the rewards distribution.

@codecov-commenter
Copy link

codecov-commenter commented Aug 23, 2021

Codecov Report

Merging #6 (c02a737) into master (ad534cd) will decrease coverage by 0.14%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master      #6      +/-   ##
=========================================
- Coverage    1.95%   1.80%   -0.15%     
=========================================
  Files           9      11       +2     
  Lines         205     221      +16     
  Branches       28      29       +1     
=========================================
  Hits            4       4              
- Misses        201     217      +16     
Impacted Files Coverage Δ
...cts/incentives/PullRewardsIncentivesController.sol 0.00% <0.00%> (ø)
...cts/incentives/StakedTokenIncentivesController.sol 0.00% <0.00%> (ø)
...racts/incentives/base/BaseIncentivesController.sol 0.00% <0.00%> (ø)
contracts/incentives/base/DistributionManager.sol 0.00% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ad534cd...c02a737. Read the comment docs.

@miguelmtzinf
Copy link

Should we update the StakedTokenIncentivesController making it inheriting the BaseIncentivesController ?

@kartojal
Copy link
Contributor Author

Should we update the StakedTokenIncentivesController making it inheriting the BaseIncentivesController ?

I think is better to not encapsulate it more deeper.

@kartojal kartojal changed the title feat: Added base ERC20 incentives controller contract Abstract IncentivesContract logic, adapt Staked Incentives Controller and Pull Reward Incentives Controller Oct 18, 2021
Copy link

@LHerskind LHerskind left a comment

Choose a reason for hiding this comment

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

Added some comments for the contracts, mostly look good to me. Have not reviewed tests and config yet.

* @dev update the rewards vault address, only allowed by the Rewards admin
* @param rewardsVault The address of the rewards vault
**/
function setRewardsVault(address rewardsVault) external onlyEmissionManager {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a risk of updating the rewardsVault, but leaving existing token emissions? For token contract updates, would be fine, but if switching tokens could be an issue. Probably can just be handled with clear documentation but can consider include smart contract options.

Potential options
Clearly document that existing emissions will remain for the new token
Clear all emmissions on setRewardsVault
Add a parameters to setRewardsVault and include a call to update emissions

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If the EmissionManager changes the rewards vault, it will not change the current token as is inmmutable, just the source where "pull" and transfer the reward token. In my opinion emissions could still be the same and if the "reward vault" has sufficient tokens the incentives will not stop.

The rewards vault can be an EOA or smart contract with the sole purpose of pulling the reward tokens from this contract to the incentivized accounts.

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense +1

Copy link

@LHerskind LHerskind left a comment

Choose a reason for hiding this comment

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

Looks good to me

@stevenvaleri stevenvaleri merged commit 2492c20 into master Nov 16, 2021
@stevenvaleri stevenvaleri deleted the feat/base-incentives-controller branch November 16, 2021 14:09
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.

5 participants