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.
Add support for multichoice
This PR adds support for for multichoice (i.e not only for / against / abstain). This PR does not add support for weighted voting or ranked choice.
The way multichoice is added here is instead of having fixed
0/1/2
choice, we now have anArray
of choices. Upon proposal creation, a number ofchoices
is passed in to specify the number of choices possible for this proposal.Interface changes
The
execute
function of a voting strategy replacesvotes_for, votes_against, votes_abstain
by a single arrayvotes
.The same goes for
get_proposal_status
.The
vote_power
takes au128
instead of an enum. Same goes forfn vote
on the space contract.The
propose
function on the space contract now takes achoices: u128
parameter that represents the number of choices. Same goes for theupdate_proposal
function.Typehashes for signature are modified see
starknet/src/utils/constants.cairo
.The
choice
enum has been removed from the code.Note
Although the execution strategy now takes
votes[]
as an array, it doesn't mean it should support any number of choices. For example, the l1 avatar executions strategy still uses a simple quorum, and will treat thevotes[]
array as an array of 3 elements, containingfor / against / abstain
votes.