fix: show delegatable balance in delegate modal, not current voting power#22
Open
marinom2 wants to merge 2 commits into
Open
fix: show delegatable balance in delegate modal, not current voting power#22marinom2 wants to merge 2 commits into
marinom2 wants to merge 2 commits into
Conversation
… delegated When a wallet is currently delegated to another address, the "Delegate to yourself" option is really an undelegate action. Rename it to "Return votes to yourself" in that case, with a subtitle explaining it restores your own voting power, and label the action button "Return votes". When the wallet is self-delegated, the wording stays "Delegate to yourself" as before. This is wording only; there is no change to the delegation logic.
…ower The modal displayed current voting power (getVotes) as the amount being delegated. That is wrong: delegating moves the weight of the tokens you hold (your balance), not the votes currently counted for you. The two diverge once you delegate away or receive delegations from others. On the native-votes chain this produced misleading numbers: - a wallet that delegated its votes away showed "0 to delegate" even though it can still re-delegate the weight of its balance - a wallet holding 0 tokens but holding votes delegated to it showed an amount it cannot actually delegate, since incoming delegations are not transitive Changes: - show "Your LCAI balance" (what you delegate) and "Your voting power" (what currently counts for you) as separate rows - add a "Delegated to you" row when others have delegated to you - show the delegated amount on the "Currently delegated to" line - drive the action note off balance, and when balance is 0 switch to a warning and disable the button since there is nothing to delegate
|
@marinom2 is attempting to deploy a commit to the Lightchain AI Team on Vercel. A member of the Team first needs to authorize it. |
lightchainaidev
previously approved these changes
Jul 1, 2026
The merge-base changed after approval.
lightchainaidev
approved these changes
Jul 1, 2026
lightchainaidev
approved these changes
Jul 1, 2026
lightchainaidev
previously approved these changes
Jul 1, 2026
The merge-base changed after approval.
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.
Summary
The modal displayed current voting power (
getVotes) as the amount being delegated. That is incorrect: delegating moves the weight of the tokens you hold (your balance), not the votes currently counted for you. This shows balance and voting power as separate values, surfaces incoming delegations, and disables the action when there is nothing to delegate.The bug
getVotesand balance diverge once you delegate away or receive delegations from others:getVotes0 but can still re-delegate the weight of its balance. The old UI showed "0 to delegate", which is wrong.getVotesgreater than 0 but can delegate nothing, since incoming delegations are not transitive. The old UI showed an amount it cannot actually delegate.The number that matters for delegating is always your token balance.
Changes
Note on stacking
This is stacked on #21 (the "Return votes to yourself" relabel). Until #21 merges, this PR's diff includes that commit as well, so review the second commit (
show delegatable balance...) here. Once #21 is merged I will rebase so this shows only its own change.Scope
One file,
components/delegation/delegate-modal.tsx.