Skip to content

Add Delegated Voting #2

@EGreg

Description

@EGreg

Read this about delegated voting.

Keep a mapping of mappings called _delegated[leader] => (follower => true).

The idea is that each participant should be able to call delegate(address). They can call it again to change the delegate, which does

// first part
if (leader1 = delegate[follower]) {
  delete delegated[leader1][follower];
  --delegatedCount[leader1];
}
// and then
delegate[follower] = leader2;
delegated[leader2][follower] = 0;
++delegatedCount[leader2];

If they call delegate(null) then do only the first part above, and then it goes back to using his own vote.

Also, if delegates parameter of contract is not true then calls to delegate() would always rollback with error "Error: delegating not allowed in this VotingContract".

Whenever someone casts a vote (when they are eligible), then everyone who delegated their vote to them would also be considered as casting a vote for the same thing at the same time. But that causes a new phenomenon -- because then when N people follow a delegate, their vote moves the result N times more. This is because smart contract code only executes when some EOA initiates a call.

So we have less "democracy" and more "representative democracy". During a vote, we call a specific functionSignature to actually implement what the vote does. We would need a way to pass delegatedCount to it, so it would take this into account (e.g. for N votes).

If we had a hook with names, values arrays we would just add weight as the third parameter. Why are we using functionSignature instead? In order to be compatible with any type of function? It's noble but do we really need it, considering that all hook functions would be whitelisted anyway, so they may as well be written KNOWING about VotingContract?

Let's just have two versions.
Let's change method to vote(names, values, weight=1) and it will call the function by its function type and pass the parameters, with weight = delegateCount otherwise = 1

And second version can be voteMethod(functionSignature) though it seems to me that this way, we cannot pass the weight and delegate stuff easily.

###analysis

This is a bit dangerous because it creates an 'arms race' of people collectivizing behind one or another 'representative', rather than expressing their own choices. However, we can have a "middle ground" where people can "copy" someone else's vote, when voting. This doesn't need to be implemented on-chain since we can have the client read the blockchain and copy someone else's vote. However, we do need to record how they voted, in event logs with indexes and event is named "voted".

Please also have a mapping of voted[address] = functionSignature which stores the latest vote of each address, on chain, the functionSignature string, even though this takes up space (one per user).

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions