# Specification

*Authors: BlockScience and SDF, July 2023*

### Introduction

A notebook containing an end-to-end example implementation for this document can be found on the [`BlockScience/scf-voting-mechanism` GitHub repository](https://github.com/BlockScience/scf-voting-mechanism).

### General Definitions&#x20;

The admissible user actions for the SDF-Voting Mechansim in each round are (mutually exclusive):

* **Vote** (yes/no) and **Refrain from Voting** (abstain) on any number of project submissions
  * A "no" vote will cancel a "yes" vote with the same voting power. In other words, if someone has a Voting Power of `5`, then Yes would add `+5` to the Project Votes, No would add `-5` and Abstain would add `0`.
* **Delegate** full Voting Power to an **ordered** list of at least $$N\_d$$ users - called a Quorum. Quorums are only valid for the current round and should be re-initialized / re-activated for each new round.
  * The Actual Quorum will consist of the first $$N\_d$$ users that opted for Voting rather than Delegating. If there are less than $$N\_d$$ users any missing slot will be replaced by Abstain votes.

### **Logic**

Quorum Delegation is a novel delegation scheme inspired by the Stellar Consensus Protocol in which individual users privately select groups of other users that will indirectly determine the user's vote (as long as the group achieves internal consensus).

A user can select up to $$N\_{d, max}$$ other UUIDs (order sensitive) for creating their Quorum Candidates. The first-ranked $$N\_d$$ candidates that opted for Voting during the Round are going to be the Actual Quorum. Users that opted for Delegating are not taken into account for the Actual Quorum (to softly avoid issues around re-delegation).

Depending on the Quorum Consensus, the individual user will automatically vote Yes, No or Abstain for a given project. In order for a Yes or No vote to happen, a Quorum must have an active participation of at least $$f\_r$$ (Quorum Participation Threshold) of the members towards that given project (eg. 2/3 of the members did actively vote yes/no rather than abstaining).

If the Quorum Participation Threshold is met, then the Vote Decision for the individual user is going to be the simple majority of the Quorum Members decisions. If there's no majority, then the decision is to abstain.

Some examples can be listed as follows for an Quorum Participation Threshold of 2/3 and Quorum Size of 5:

* If all 5 Quorum members vote:
  * 3 Yes, 2 No -> Delegating User automatically votes **Yes**
  * 2 Yes, 3 No -> Delegating User automatically votes **No**
* If 4 Quorum members vote, while one abstains:
  * 3 Yes, 1 No -> Delegating User automatically votes **Yes**
  * 2 Yes, 2 No -> No absolute majority, Delegating User automatically **Abstains**.
* If 3 Quorum Members vote, while two abstain:
  * Quorum Participation Threshold is **not met**, Delegating User automatically **Abstains**

### **Example Implementation in Python**

{% embed url="<https://gist.github.com/danlessa/8d603085392cde726aa88e248de459ab>" %}

### Resources

* [SCF Voting Mechanisms - Decisions for the PoC](https://hackmd.io/BIh2LNprSoaSM-rRVjbAjA)
* [SCF Voting Mechanism PoC Design](https://hackmd.io/HzRrf1NtQ_a7nlSvX_stXg)
* [SCF Trust Bonus](https://hackmd.io/RQ-okLIHRduX0SL_NSbImQ)
* [External Notes](https://docs.google.com/document/d/12V2Z4zT-rtd_oDJ8Ra-xN25h7HQyVQJXDaWBw6BhutA/edit#heading=h.1tlh3k3l5n6q)
* [Ideation Report](https://docs.google.com/document/d/1heCWpDVLm0NkhDWKhgLhpPhSgGZTVCPc7PcMQkJrDpA/edit#heading=h.jd1juvrmxwtg)
* [Lucidchart](https://lucid.app/lucidchart/3233754a-d598-422a-9b91-38a4122d1ed7/edit?viewport_loc=20%2C-3886%2C8626%2C10225%2CnhW0MXQ7lP.Y\&invitationId=inv_c6d4cbe3-0807-4c14-960a-0289f7699022)
