Skip to content

Gate rounds voting by delegated Gnars votes#115

Open
xSatori wants to merge 1 commit into
r4topunk:mainfrom
xSatori:feat/rounds-voting-power
Open

Gate rounds voting by delegated Gnars votes#115
xSatori wants to merge 1 commit into
r4topunk:mainfrom
xSatori:feat/rounds-voting-power

Conversation

@xSatori

@xSatori xSatori commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

What this addresses

This PR upgrades rounds voting so future round votes are gated by delegated Gnars DAO governance voting power. A connected wallet now needs at least 1 delegated Gnars DAO vote from the Gnars token contract before it can vote in any rounds strategy.

Code to review

  • src/services/round-voting-power.ts

    • Adds the server-only delegated voting-power helper.
    • Reads DAO_ADDRESSES.token with serverPublicClient.readContract.
    • Uses getVotes(address) rather than balanceOf.
    • Validates and normalizes wallet addresses with Viem.
    • Returns 0 on RPC/read failure so voting is blocked instead of granted.
  • src/services/rounds.ts

    • Updates getRoundVotingPower to gate every strategy behind delegated Gnars votes.
    • one_per_wallet returns 1 only when delegated voting power is positive.
    • fixed_per_wallet returns round.votesPerWallet only when delegated voting power is positive.
    • one_per_nft now returns delegated governance voting power.
  • src/app/api/rounds/[slug]/voting-power/route.ts

    • Adds GET /api/rounds/[slug]/voting-power?wallet=....
    • Validates slug and wallet.
    • Returns walletAddress, votingPower, usedVotes, and remainingVotes.
  • src/components/rounds/RoundDetailView.tsx

    • Fetches voting power while voting is open and a wallet is connected.
    • Uses remainingVotes for allocation limits and submit enablement.
    • Shows clear copy when the wallet has no delegated Gnars voting power.
    • Hides voting controls for wallets with 0 voting power.
    • Refetches voting power and refreshes the route after successful submit.
  • Regression coverage

    • src/services/round-voting-power.test.ts
    • src/app/api/rounds/[slug]/voting-power/route.test.ts
    • src/components/rounds/RoundDetailView.test.tsx

Test plan

  • pnpm test
    • 11 test files passed
    • 86 tests passed
    • 1 todo
  • pnpm lint
    • passed with 0 errors
    • existing warnings remain for <img> usage outside the rounds files

Review notes

This branch was rebuilt from current upstream/main so the PR only contains the delegated-vote gating change. The main behavior to review is the mapping between delegated governance votes and each rounds voting strategy, especially one_per_nft, which now uses delegated Gnars DAO voting power directly instead of the previous safe one-wallet fallback.

@vercel

vercel Bot commented Jun 5, 2026

Copy link
Copy Markdown

@xSatori is attempting to deploy a commit to the r4to's projects Team on Vercel.

A member of the Team first needs to authorize it.

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