Feat/configurable governance parameters#942
Open
Opulencechuks wants to merge 3 commits into
Open
Conversation
…METER_CHANGE proposal type, UI display of parameters
|
@Opulencechuks Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Contributor
|
Kindly fix conflicts @Opulencechuks |
1 similar comment
Contributor
|
Kindly fix conflicts @Opulencechuks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR closes #599
PR Description: Configurable Governance Parameters
Description
This pull request makes the DAO governance parameters (quorum threshold, approval BPS, and voting period) dynamically configurable. Previously, these parameters were hardcoded in the smart contract. They are now stored in the contract's instance storage and can be configured at runtime by the admin. The values are fetched from the blockchain via frontend hooks and displayed dynamically in a new Governance Parameters card on the DAO dashboard page.
Key Changes
Smart Contract (
contracts/scholarship_treasury/src/lib.rs)VOTING_PERIOD_KEY) and getters/setters forquorum,approval_bps, andvoting_period.set_quorum,set_approval_bps, andset_voting_period(with validation).ProposalKind(DisbursementvsParameterChange) and extended theProposalstruct with variants/fields to allow modifying contract parameters via passed proposals.execute_proposalto apply parameter changes if aParameterChangeproposal is approved.Frontend Hook & Mock (
src/hooks/useGovernance.ts&src/hooks/useGovernance.test.tsx)src/contracts/scholarship_treasury.ts(shim) with stub methods for the new getters.useQueryblock inuseGovernancehook to fetchquorum,approvalBps, andvotingPeriodfrom the contract client.UI Integration (
src/pages/Dao.tsx)useGovernanceinside theDaopage component.quorum(using the 7-decimalformatGovhelper) andvotingPeriod(using locale formatting).How to Test
Run the Rust unit tests inside the
contracts/scholarship_treasurydirectory:cargo testVerify that all tests compile and pass successfully.
Verify that the React mock testing for the governance hook passes:
http://localhost:3000/dao).100instead of a raw1000000000value).