Gate rounds voting by delegated Gnars votes#115
Conversation
|
@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. |
Automated multi-agent review — request changesReviewed in an isolated worktree by parallel Opus reviewers, then each finding was adversarially re-verified. Three findings confirmed; the voting-address mismatch blocks merge. 🔴 High — voting is impossible for external-wallet Gnars holdersThe UI gates on Fix: gate on the same address that signs/enforces. Either read voting power for the SA when the vote will be signed by the SA, or pass the signing address through consistently (client check ↔ 🟠 Medium —
|
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.tsDAO_ADDRESSES.tokenwithserverPublicClient.readContract.getVotes(address)rather thanbalanceOf.0on RPC/read failure so voting is blocked instead of granted.src/services/rounds.tsgetRoundVotingPowerto gate every strategy behind delegated Gnars votes.one_per_walletreturns1only when delegated voting power is positive.fixed_per_walletreturnsround.votesPerWalletonly when delegated voting power is positive.one_per_nftnow returns delegated governance voting power.src/app/api/rounds/[slug]/voting-power/route.tsGET /api/rounds/[slug]/voting-power?wallet=....walletAddress,votingPower,usedVotes, andremainingVotes.src/components/rounds/RoundDetailView.tsxremainingVotesfor allocation limits and submit enablement.0voting power.Regression coverage
src/services/round-voting-power.test.tssrc/app/api/rounds/[slug]/voting-power/route.test.tssrc/components/rounds/RoundDetailView.test.tsxTest plan
pnpm test11test files passed86tests passed1todopnpm lint0errors<img>usage outside the rounds filesReview notes
This branch was rebuilt from current
upstream/mainso 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, especiallyone_per_nft, which now uses delegated Gnars DAO voting power directly instead of the previous safe one-wallet fallback.