Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Approval voting #576

Merged
merged 31 commits into from
Aug 9, 2022
Merged

Approval voting #576

merged 31 commits into from
Aug 9, 2022

Conversation

rafinskipg
Copy link
Contributor

@rafinskipg rafinskipg commented Jul 26, 2022

Approval voting

  • Added choose-free input format
  • Update filters to select by the right victory conditions
  • Add component to poll overview card to display the type of vote
  • Refactor MobileVoteSheet and QuickVote components to not duplicate logic
  • Component UI for choose-free, and refactor QuickVote component
  • Fix UI to publish goerli polls from the portal
  • Publish test approval poll in goerli (/polling/QmRzU3N7#vote-breakdown)
  • Added tests for validating new input_format / result_display and victory_conditions
  • (In progress) Add logic to fetch tally for approval
  • Modify docs to exclude the "options" field on the victory conditions and to include the "AND" logic
  • Update swagger docs for tally
  • Add unit tests for validating that poll parameters "default" must include a value
  • Introduce victory condition comparisson
  • Component UI for approval-breakdown display
  • Modify current components to display new vote type (colors, summaries on the poll card, etc)
  • Add poll with approval + majority + default on goerli
  • Added docs about poll vote types
  • Refactor code to reuse helpers correctly to determine different input formats / result displays
  • Add tests to calculate vote tally for approval
  • Add tests to calculate "comparison" threshold (10k MKR to determine winner)
  • Add tests to allow for AND / OR logic conditions on the poll parameters
  • Add tests to allow for majority (?)
  • Change voting weight colors for approval https://governance-portal-v2-git-approval-voting-dux-core-unit.vercel.app/polling/QmRzU3N7#vote-breakdown
  • Try to decouple "Abstain" from option 0

Poll parameters

  • The type "approval" include a "options" field that determine which options can be voted multiple times.
---
title: POLL PARAMETERS Approval voting + majority of 50%  with default to 3
summary: Signal your support or opposition for setting the Fee In (tin) and Fee Out (tout) parameters to 0% for all PSM vaults.
discussion_link: https://forum.makerdao.com/t/signal-request-set-psm-fees-to-0/10894
parameters:
  input_format: 
    type: choose-free
    options: [1,2]
    abstain: [0]
  victory_conditions:
    - { 
        type: 'and', 
        conditions: [
          { type : approval },
          { type: majority, percent: 50 },
          { type : comparison, comparator : '>=', value: 10000 }
        ]
      }
    - { type : default, value : 2 }
  result_display: approval-breakdown
options:
  0: Abstain
  1: Approve existing budget only (Business as usual)
  2: Approve increased budget
  3: Reject budget
  4: None of the above
version: v2.0.0   
start_date: 2022-03-06T16:00:00
end_date: 2029-11-05T16:00:00
---


Button changed if you don't have mkr to vote

image

Approval voting poll card
image

Approval vote poll summary
image

@vercel
Copy link

vercel bot commented Jul 26, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
governance-portal-v2 ✅ Ready (Inspect) Visit Preview Aug 9, 2022 at 11:30AM (UTC)

…format to introduce options, refactor existing tests and components
@rafinskipg rafinskipg marked this pull request as ready for review August 4, 2022 14:30
@@ -0,0 +1,39 @@
import invariant from 'tiny-invariant';
import { NextApiRequest, NextApiResponse } from 'next';
import { getPolls } from 'modules/polling/api/fetchPolls';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file will be deleted

package.json Outdated
@@ -1,7 +1,7 @@
{
"name": "governance-portal-v2",
"license": "AGPL-3.0-only",
"version": "0.7.3",
"version": "0.7.3-test",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be removed, i changed it to not collide with the other caches (since we use the version number on the cache string name)

if (rawValue) {
const ballotBuffer = toBuffer(rawValue, { endian: 'little' });
const ballot = paddedArray(32 - ballotBuffer.length, ballotBuffer);
rankedChoiceOption = ballot.reverse().filter(choice => choice !== 0);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

attention here, we removed the "filter" that removed before all the 0 options, since this assumed 0 is abstain and has to be ignored.

Copy link
Collaborator

@adamgoth adamgoth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screen Shot 2022-08-05 at 10 21 26 AM

I think poll type filters need to be fixed

Copy link
Collaborator

@adamgoth adamgoth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we sort these options descending by the amount of support?
Screen Shot 2022-08-05 at 10 37 44 AM

The leading option text says no winner found although the poll detail has leading options
Screen Shot 2022-08-05 at 10 36 45 AM
Screen Shot 2022-08-05 at 10 37 20 AM

Copy link
Collaborator

@adamgoth adamgoth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going to see if I can get rid of the jumping when clicking buttons

Edit: fixed now

Text updates for approval voting branch
@b-pmcg
Copy link
Collaborator

b-pmcg commented Aug 5, 2022

It might be nice to see what my vote was at first glance on the poll overview card and the poll detail page. Maybe the button for your voted option(s) could be colored/outlined. Or just list the option below "you voted"
Screen Shot 2022-08-05 at 1 15 59 PM

@b-pmcg
Copy link
Collaborator

b-pmcg commented Aug 5, 2022

I had an issue when filtering the polls, the availablePollsLength was a negative number and so throws an error creating a new array on this line. Maybe a cache/local storage issue?

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.

3 participants