feat(web): DAO intelligence layer (voting power, quorum distance, one-click vote)#66
Merged
Merged
Conversation
…-click vote) Turn the governance panel from a read-only proposal list into an actionable DAO console, wired only to live-verified on-chain reads on both governance chains. - Voting power: per-wallet getVotes + delegation gap (balance vs active power) with a one-click delegate-to-self when undelegated. Ethereum reads the LCAIB ERC20Votes balance; LightChain reads native getBalance (the predeploy has no balanceOf). - Quorum distance: each proposal now exposes snapshotBlock + quorum(snapshot) from the route; the card shows "needs X more to pass" / "quorum met" (For + Abstain count, per GovernorCountingSimple), with a progress bar. - One-click vote: For/Against/Abstain on Active proposals via Governor castVote, signed by the wallet, guarded by hasVoted + non-zero power + chain switch, with the tx link. - Native DAO + treasury first-class: new dao-overview route surfaces the LightChain native treasury + FeePool balances and per-chain quorum config, alongside the Ethereum treasury and LCAIB supply. - LightChain gas fees pinned (estimateFeesPerGas) so MetaMask can render and confirm the tiny native gas on delegate/vote. Pure governance math extracted to dao-math.ts and unit-tested (16 tests).
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
What
Turns the governance panel from a read-only proposal list into an actionable DAO console, wired only to live-verified on-chain reads on both governance chains (Ethereum mainnet governor
0x6dfa…and the LightChain native governor0x262E…).Built straight from a verified probe pass: every read used here was confirmed live (no reverts) before wiring.
Features
1. Your voting power (per-wallet strip above the list)
getVotes+delegateson the vote token; shows the delegation gap (balance vs active power).balanceOf; LightChain reads nativegetBalance(the0x…1001predeploy has nobalanceOf- verified it reverts).2. Quorum distance (per proposal)
proposalSnapshot+quorum(snapshot)and exposessnapshotBlock+quorumWei.GovernorCountingSimple); Against excluded.3. One-click vote (Active proposals)
castVote, signed by the wallet.hasVoted+ non-zero power + chain switch; shows the tx link.4. Native DAO + treasury first-class
dao-overviewroute surfaces the LightChain native treasury (4.55 LCAI) + FeePool (1.08 LCAI) and per-chain quorum config, alongside the Ethereum treasury and LCAIB supply (10B, 3% quorum). This reflects the team's in-progress governance/treasury migration to LightChain.5. MetaMask gas fix - LightChain fees pinned via
estimateFeesPerGasso the wallet can render and confirm the tiny native gas on delegate/vote (same fix as the bridge).Structure
app/build/dao/dao-math.tsand unit-tested (16 new tests).dao-chain.ts; shared wallet wiring inuse-dao-wallet.ts; UI split intotreasury-bar,voting-power-card,quorum-line,cast-vote(each file/function within the size limits).Verification
tsc --noEmitclean,next buildclean, ESLint clean.dao-overviewreturns real treasury/feePool/quorum for both chains;dao-proposalsreturnsquorumWei(300M LCAIB = 3% of supply) +snapshotBlock.