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

Hydro DAO DAO governance support #226

Merged
merged 3 commits into from
Feb 11, 2025
Merged

Hydro DAO DAO governance support #226

merged 3 commits into from
Feb 11, 2025

Conversation

dusan-maksimovic
Copy link
Contributor

@dusan-maksimovic dusan-maksimovic commented Feb 10, 2025

Description

This PR introduces the following changes:

  • Adds 2 new queries (TotalPowerAtHeight and VotingPowerAtHeight) on Hydro contract, which support querying total and specific user voting powers at the given height. Queries allow us to plug-in existing Hydro contract into DAO DAO governance.
  • Adds a new dao-voting-adapter contract that implements DAO DAO voting module queries (all 4 of them). When queried, the contract will forward 2 main queries to the Hydro contract, while Dao and Info queries are implemented by the contract itself. The contract is also necessary because DAO DAO, during instantiation process, can not accept address of an existing voting module SC. Instead, new voting module is instantiated with info provided in the DAO Core instantiation message. In our case, we will instantiate dao-voting-adapter by giving it address of an existing Hydro SC.

Minor changes:

  • Some utility functions such as get_current_user_voting_power(), get_user_voting_power_for_past_round(), to_lockup_with_power(), get_lock_time_weighted_shares() and scale_lockup_power() are moved from contract.rs into utils.rs because they are now used in different places (external queries, compounder cap, governance).
  • Removed filtering of expired user lockups in get_current_user_voting_power() and get_user_voting_power_for_past_round() since they both call to_lockup_with_power() -> get_lock_time_weighted_shares() that handles expired lockups properly already.

Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • Targeted the correct branch
  • Included the necessary unit tests
  • Added/adjusted the necessary interchain tests
  • Added a changelog entry in .changelog
  • Compiled the contracts by using make compile and included content of the artifacts directory into the PR
  • Regenerated front-end schema by using make schema and included generated files into the PR
  • Updated the relevant documentation or specification
  • Reviewed "Files changed" and left comments if necessary
  • Confirmed all CI checks have passed

@dusan-maksimovic dusan-maksimovic self-assigned this Feb 10, 2025
@dusan-maksimovic dusan-maksimovic requested a review from a team as a code owner February 10, 2025 14:03
],
"properties": {
"claims": {
"type": "array",
"items": {
Copy link
Member

Choose a reason for hiding this comment

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

these changes happen because some ordering is not deterministic, right? Since nothing changed here, only the order of elements. might be worth making deterministic (though not as part of this PR, of course)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I've noticed this as well. I think it has something to do with how the tool works on Mac vs. Linux. If I run it now on this branch I would get no diff, but if you run it it would reorder stuff. You can even try this and let me know if I'm right. :)

Copy link
Member

@p-offtermatt p-offtermatt left a comment

Choose a reason for hiding this comment

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

LGTM, great work. Just a few comments, mostly about comments - but nothing major

@dusan-maksimovic dusan-maksimovic merged commit bb035e7 into main Feb 11, 2025
4 checks passed
@dusan-maksimovic dusan-maksimovic deleted the dusan/governance branch February 11, 2025 11:31
dusan-maksimovic added a commit that referenced this pull request Feb 12, 2025
* Introduce compounder cap (#220)

* introduce participant's cap

* Introduce snapshot map for total voting power tracking and handle its population

* Added round<->height tracking and implemented validation for users locking in extra_cap based on their voting power in previous round.

* Introduced USER_LOCKS to be able to calculate users voting power at a given height

* - Added test for compunders cap and fixed couple of minor bugs within the new code
- validate_denom() modified to be able to execute for past rounds as well

* fixing errors after merge from main

* added tests for user lock snapshoting and heght<->round tracking

* added transaction to remove the constants at a specified timestamps

* implementation of migration

* CR required changes

* added SNAPSHOTS_ACTIVATION_HEIGHT

* added migration tests

* added changelogs, recompiled contracts and schemas

* added util function for ICQ results mock

* fixed interchain tests (#222)

* borrow input Deps, Env and MessageInfo whenever possible (#224)

* Allowing to unvote without having to switch to a new vote (#218)

* Refactoring vote and adding unvote feature

* Make clippy happy

* Remove unnecessary unvoted_proposals in process_unvotes

* Adding a test case for unvote

* Update wasms

* Improving readability by adding / restoring comments, renaming variables

* Store vote and voting allowed round directly in process_votes

* Adding new test: attempts to unvote non-existing or not-owned locks should fail

* Adding changelog

* Fix HydroBase.client.ts as generated by make schema

* Addressing Dusan's comments

* Hydro DAO DAO governance support (#226)

* implement hydro DAO DAO governance support

* added changelog

* CR changes

* Prepare release for v3.1.0 (#227)

* Prepare v3.1.0 release

* Regenerate schema

* Regenerate client types

* Change migration and version to v3.1.0

* Fix migration mod

---------

Co-authored-by: arlai <[email protected]>
Co-authored-by: Philip Offtermatt <[email protected]>
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.

2 participants