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

Reward distributor improvements #881

Merged
merged 8 commits into from
Sep 12, 2024
Merged

Reward distributor improvements #881

merged 8 commits into from
Sep 12, 2024

Conversation

NoahSaso
Copy link
Member

@NoahSaso NoahSaso commented Sep 11, 2024

This does a few things:

  1. Adds an undistributed rewards query to the distributor so that you can check how many rewards would be withdrawn.

  2. Fixes a bug pausing an already expired linear distribution. This isn't a vulnerability, but it should be possible, and there was just a minor logic error.

  3. Adds the ability to fund the most recent distribution, without knowing its ID. This is useful when creating CW20 distributions. Because we can't verify the sender of a CW20 token send contract execution, we can't allow creating new distributions with initial CW20 funds (since the contract owner must create new distributions). Instead, the DAO can create a distribution AND fund the latest distribution (without knowing its ID) in one proposal.

  4. Adds an open_funding flag so the owner can decide if a distribution can be funded by accounts other than the owner. The owner can always fund a distribution.

  5. Fixes a bug causing pending rewards and undistributed rewards queries to fail if a linear distribution has not yet been funded.

@NoahSaso NoahSaso changed the title Add undistributed rewards query to distributor, and fix pausing Add undistributed rewards query to distributor, and fix pausing expired linear distributions Sep 11, 2024
Copy link

codecov bot commented Sep 11, 2024

Codecov Report

Attention: Patch coverage is 99.20792% with 4 lines in your changes missing coverage. Please review.

Project coverage is 96.67%. Comparing base (a417f9d) to head (5267dfe).
Report is 1 commits behind head on development.

Files with missing lines Patch % Lines
...stribution/dao-rewards-distributor/src/contract.rs 95.16% 3 Missing ⚠️
...ution/dao-rewards-distributor/src/testing/suite.rs 98.63% 1 Missing ⚠️
Additional details and impacted files
@@               Coverage Diff               @@
##           development     #881      +/-   ##
===============================================
+ Coverage        96.64%   96.67%   +0.03%     
===============================================
  Files              241      241              
  Lines            65544    65993     +449     
===============================================
+ Hits             63347    63802     +455     
+ Misses            2197     2191       -6     

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

@NoahSaso NoahSaso changed the title Add undistributed rewards query to distributor, and fix pausing expired linear distributions Add undistributed rewards query to distributor, fix pausing expired linear distributions, and add ability to fund latest distribution Sep 11, 2024
@NoahSaso NoahSaso changed the title Add undistributed rewards query to distributor, fix pausing expired linear distributions, and add ability to fund latest distribution Reward distributor improvements Sep 11, 2024
Copy link
Collaborator

@bekauz bekauz left a comment

Choose a reason for hiding this comment

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

great findings, especially the one to do with pausing an already expired distribution. totally missed it before.

lgtm!

@NoahSaso NoahSaso merged commit 05c982b into development Sep 12, 2024
8 of 9 checks passed
@NoahSaso NoahSaso deleted the noah/distributor-fix branch September 12, 2024 22:02
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