Skip to content
This repository has been archived by the owner on Dec 23, 2024. It is now read-only.

Allow weighted votes #111

Closed
wants to merge 4 commits into from
Closed

Allow weighted votes #111

wants to merge 4 commits into from

Conversation

kazpot
Copy link

@kazpot kazpot commented Dec 9, 2021

This is the simple proposed solution to the issue #91. I implemented the weighted votes using voice credit. I know voice credit is supposed to be used for the different purpose like deciding each voter's preference, but it can be used for the weighted votes in the following way. Every voting period, exact 1 voting token is distributed for each voter by the contract owner. At the same time, the contract owner decides the weight of each voter (weight ranges from 1 to 100) and the weight is stored in the voting token contract as mapping of the voter's address. The voters votes later without caring about the weight, but the weight is recorded in the contract and the message is published with the weight automatically as the substitution to the voice credit. The tally result will be calculated based on the weight.

Note:
After implementing this, the withdraw function in the cream contract can not work as before. Once the weight is considered, mismatch between the number of voting token (1 voting token per voter) and the tally result (sqrt(weight) * voting) happens. Also, (sqrt(weight) * voting) tokens have to be transferred to recipients after the tally. I think this would cost much gas so better to use the tally result directly without executing withdraw function.

@kazuakiishiguro kazuakiishiguro self-requested a review February 14, 2022 04:50
@kazuakiishiguro
Copy link
Contributor

Close this PR since this is going to destruct the whole withdraw schemes.

After implementing this, the withdraw function in the cream contract can not work as before.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants