DA0-DA0 / dao-contracts

CosmWasm smart contracts for Interchain DAOs.
https://docs.daodao.zone
BSD 3-Clause "New" or "Revised" License
202 stars 132 forks source link

staking rewards distribution followup #835

Closed bekauz closed 2 weeks ago

bekauz commented 1 month ago

reworks the existing staking rewards distribution logic.

contract now functions as a factory for distributing staking rewards. there is no more main voting power contract; each denom to be distributed needs to specify where to draw its voting power from.

reward rate is derived from the RewardEmissionConfig which describes how many udenoms (Uint128) are to be distributed per time duration (blocks/seconds).

introduces a shutdown option which claws back any undistributed rewards back to the treasury.

also implemented a suite test builder because the current unit test file was about to exceed 3000 lines of code (mostly because of copy pasting the setup in every test). however not all tests are present - this is a pending todo.

bekauz commented 2 weeks ago

removing the reward emission config updates for now as this pr is big enough. added next steps in #839 .

codecov[bot] commented 2 weeks ago

Codecov Report

Attention: Patch coverage is 96.87375% with 78 lines in your changes missing coverage. Please review.

Project coverage is 96.28%. Comparing base (87485be) to head (acc5fed). Report is 1 commits behind head on development.

:exclamation: Current head acc5fed differs from pull request most recent head 3f7eb1c

Please upload reports for the commit 3f7eb1c to get more accurate results.

Files Patch % Lines
...ution/dao-rewards-distributor/src/testing/suite.rs 94.58% 31 Missing :warning:
...ibution/dao-rewards-distributor/src/testing/mod.rs 93.56% 15 Missing :warning:
...stribution/dao-rewards-distributor/src/contract.rs 96.90% 14 Missing :warning:
.../distribution/dao-rewards-distributor/src/state.rs 76.66% 14 Missing :warning:
...ts/distribution/dao-rewards-distributor/src/msg.rs 88.88% 4 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## development #835 +/- ## =============================================== + Coverage 96.26% 96.28% +0.02% =============================================== Files 209 217 +8 Lines 53514 56009 +2495 =============================================== + Hits 51513 53931 +2418 - Misses 2001 2078 +77 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.