This repository has been archived by the owner on Dec 23, 2024. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.