This document describes the logic used by the Governance Portal to calculate voting results of governance polls and was written by the DUX team. Last updated Nov. 2022.

Summary:

The polling system uses Ethereum mainnet and Arbitrum events to log votes for polls. To efficiently get the data needed to calculate the poll results, the voting portal uses a backend that stores all relevant Ethereum events (create poll events, vote events, MKR token transfers, chief deposits/withdrawals, create vote proxy events)

Poll creation:

A poll is created when a PollCreated event is emitted by the v1 polling contract (not the v2 batch polling contract).  This event includes the poll number, start date and end date (unix timestamp), multihash of the poll document, and url hosting the poll document.  Only polls created by certain addresses show up in the voting portal frontend. This allow-list of addresses is stored in the backend.

Valid votes:

A vote in a poll is considered valid if:

(*) Note that we said voter, not address, since if a user with a vote proxy makes a vote with their cold wallet, and then with their hot wallet, only the latest valid vote is counted.

In addition to the voter address, the poll id and option selected are also specified in the Voted event.

Voting power:

The voting power associated with each vote is based on the total MKR balance of the voter at the block that the poll ends on.  Below are the calculations for total MKR balance:

If the voter has an active vote proxy(*), sum up the following balances: