Skip to content

feat(web): DAO intelligence layer (voting power, quorum distance, one-click vote)#66

Merged
marinom2 merged 1 commit into
mainfrom
feat/dao-intelligence-layer
Jun 10, 2026
Merged

feat(web): DAO intelligence layer (voting power, quorum distance, one-click vote)#66
marinom2 merged 1 commit into
mainfrom
feat/dao-intelligence-layer

Conversation

@marinom2

Copy link
Copy Markdown
Owner

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 governor 0x262E…).

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)

  • Reads getVotes + delegates on the vote token; shows the delegation gap (balance vs active power).
  • One-click delegate-to-self when undelegated, signed by the wallet.
  • Ethereum reads the LCAIB ERC20Votes balanceOf; LightChain reads native getBalance (the 0x…1001 predeploy has no balanceOf - verified it reverts).

2. Quorum distance (per proposal)

  • Route now reads proposalSnapshot + quorum(snapshot) and exposes snapshotBlock + quorumWei.
  • Card shows "needs X more to pass" / "quorum met" with a progress bar. For + Abstain count toward quorum (OZ GovernorCountingSimple); Against excluded.

3. One-click vote (Active proposals)

  • For / Against / Abstain via Governor castVote, signed by the wallet.
  • Guarded by hasVoted + non-zero power + chain switch; shows the tx link.

4. Native DAO + treasury first-class

  • New dao-overview route 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 estimateFeesPerGas so the wallet can render and confirm the tiny native gas on delegate/vote (same fix as the bridge).

Structure

  • Pure governance math (quorum distance, delegation gap, formatting) extracted to app/build/dao/dao-math.ts and unit-tested (16 new tests).
  • Chain config + reads in dao-chain.ts; shared wallet wiring in use-dao-wallet.ts; UI split into treasury-bar, voting-power-card, quorum-line, cast-vote (each file/function within the size limits).

Verification

  • tsc --noEmit clean, next build clean, ESLint clean.
  • 473/473 unit tests pass (+16).
  • Both routes hit live end-to-end: dao-overview returns real treasury/feePool/quorum for both chains; dao-proposals returns quorumWei (300M LCAIB = 3% of supply) + snapshotBlock.

…-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).
@vercel

vercel Bot commented Jun 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
lightnode Ready Ready Preview, Comment Jun 10, 2026 11:28am

Request Review

@marinom2 marinom2 merged commit 4d3550d into main Jun 10, 2026
5 checks passed
@marinom2 marinom2 deleted the feat/dao-intelligence-layer branch June 10, 2026 11:31
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.

1 participant