fix: integrate staked tokens for governance voting power#447
Merged
Devsol-01 merged 5 commits intoDevsol-01:mainfrom Mar 30, 2026
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@binayyub4211 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! 🚀 |
Owner
|
@binayyub4211 please failing pipeline |
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.
closes #444
PR Description: Governance Token Integration
Summary
Updated the governance module to use the native token's staked balance for voting power calculation, replacing the historical lifetime_deposited metric. This ensures that a user's governance weight accurately reflects their current active stake in the contract.
Changes
Governance Module: Modified
get_voting_power
in
governance.rs
to fetch and return the user's current total_balance.
Balance Synchronization: Updated the
goal
and
group
modules to correctly maintain the User::total_balance field during all deposit, contribution, and withdrawal operations.
Verification: Added a new unit test
test_voting_power_decreases_after_withdraw
in
governance_tests.rs
to confirm that voting power correctly updates when a user withdraws funds.
How it was verified
Added a regression test case in
governance_tests.rs
.
Manually verified the consistency of total_balance tracking across
flexi
,
lock
,
goal
, and
group
modules.