You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue aims to enable communities to handle their own settings and treasury based on two governance systems: authoritative decisions (a.k.a. Voice), or voting mechanisms via polls (Members or Fraction).
Types
Origins
/// The origin of the comnunity governance, as well as the origin/// sent to emit on behalf of the pallet#[derive(TypeInfo,Encode,Decode,MaxEncodedLen,Clone,Eq,PartialEq,Debug)]#[scale_info(skip_type_params(T))]pubstructRawOrigin<T:Config>{/// The community id. Used to get the account of the/// community for certain origin conversionspubcommunity_id:T::CommunityId,/// The governance strategy. This defines how to behave/// when ensuring privileged calls and deciding executing/// callspubgovernance_strategy:CommunityGovernanceStrategy<AccountIdOf<T>,AssetIdOf<T>>,}
Structures
/// This structure holds a governance strategy. This defines how to behave/// when ensuring privileged calls and deciding executing/// calls#[derive(TypeInfo,Encode,Decode,MaxEncodedLen,Clone,Eq,PartialEq,Debug)]#[scale_info(skip_type_params(AccountId,AssetId))]pubenumCommunityGovernanceStrategy<AccountId,AssetId>{/// The community governance lies in the shoulders of the admin of it.////// This is equivalent to `RawOrigin::Member` on collectives-pallet, or/// `BodyPart::Voice` on XCM.AdminBased(AccountId),/// The community governance relies on a member count-based (one member,/// one vote) poll.////// This is equivalent to `RawOrigin::Members` on collectives-pallet, or/// `BodyPart::Members` on XCM.MemberCountPoll{count:u32,},/// The community governance relies on an asset-weighed (one token,/// one vote) poll.////// This is equivalent to `RawOrigin::Members` on collectives-pallet, or/// `BodyPart::Fraction` on XCM.AssetWeighedPoll{asset_id:AssetId,#[codec(compact)]num:u32,#[codec(compact)]denum:u32,},/// The community governance relies on an ranked-weighed (one member vote,/// the number of votes corresponding to the rank of member) poll,////// This is equivalent to `RawOrigin::Members` on collectives-pallet, or/// `BodyPart::Fraction` on XCM.RankedWeighedPoll{#[codec(compact)]num:u32,#[codec(compact)]denum:u32,},}/// This structure holds the basic definition of a proposal./// It includes the information about the proposer,/// the hash of the call to be executed if approved,/// and the information of the#[derive(TypeInfo,Encode,Decode,MaxEncodedLen,Clone,PartialEq,Eq)]#[scale_info(skip_type_params(T))]pubstructCommunityProposal<T:Config>{pub(crate)proposer:AccountIdOf<T>,pub(crate)call_hash:Hash,}/// This structure holds a poll and the methods to increase/decrease/// votes#[derive(TypeInfo,Encode,Decode,MaxEncodedLen,Clone)]pubstructCommunityPoll{#[codec(compact)]pub(crate)ayes:VotesCount,#[codec(compact)]pub(crate)nays:VotesCount,}
Storage
/// Stores the governance strategy for the community.#[pallet::storage]#[pallet::getter(fn governance_strategy)]pub(super)typeGovernanceStrategy<T> = StorageMap<_,Blake2_128Concat,CommunityIdOf<T>,CommunityGovernanceStrategy<AccountIdOf<T>,AssetIdOf<T>>>;/// Stores a queue of the proposals.#[pallet::storage]#[pallet::getter(fn proposals)]pub(super)typeProposals<T> = StorageMap<_,Blake2_128Concat,CommunityIdOf<T>,BoundedVec<CommunityProposal<T>, <TasConfig>::MaxProposals>>;/// Stores a poll representing the current proposal.#[pallet::storage]#[pallet::getter(fn poll)]pub(super)typePoll<T> = StorageMap<_,Blake2_128Concat,CommunityIdOf<T>,CommunityPoll>;/// Stores the list of votes for a community.#[pallet::storage]pub(super)typeVoteOf<T> = StorageDoubleMap<_,Blake2_128Concat,CommunityIdOf<T>,Blake2_128Concat,AccountIdOf<T>,()>;
Implementation
Permissioned Calls
open_proposal: Creates a proposal to execute a call on behalf of either the community origin or the community account.
vote_proposal: Creates a proposal to execute a call on behalf of either the community origin or the community account.
close_proposal: Closes a proposal, executing a call (to be dispatched by the runtime scheduler).
Privileged Calls
execute_call: Creates a proposal, and immediately closes a poll, effectively executing a call (to be dispatched by the runtime scheduler). Called by the community admin when the current governance strategy for the community is AdminBased.
Private methods
do_create_proposal: Enqueues a proposal with its corresponding (preimaged) BoundedCall. Is called by open_proposal.
ensure_poll_closed: Ensures whether a proposal is able to be closed. Is called by close_proposal.
get_poll_approval: Decides whether a proposal is approved. Is called by close_proposal.
do_clear_poll: Clears a poll once it's closed. Is called by close_proposal.
do_call_execute: Schedules a enqueued on behalf of the treasury. Is called by close_proposal or execute_call.
Deprecations
Remove assets_transfer and balances_transfer, as they should be dispatched by the governance mechanisms.
The text was updated successfully, but these errors were encountered:
Description
This issue aims to enable communities to handle their own settings and treasury based on two governance systems: authoritative decisions (a.k.a.
Voice
), or voting mechanisms via polls (Members
orFraction
).Types
Origins
Structures
Storage
Implementation
Permissioned Calls
open_proposal
: Creates a proposal to execute a call on behalf of either the community origin or the community account.vote_proposal
: Creates a proposal to execute a call on behalf of either the community origin or the community account.close_proposal
: Closes a proposal, executing a call (to be dispatched by the runtime scheduler).Privileged Calls
execute_call
: Creates a proposal, and immediately closes a poll, effectively executing a call (to be dispatched by the runtime scheduler). Called by the community admin when the current governance strategy for the community isAdminBased
.Private methods
do_create_proposal
: Enqueues a proposal with its corresponding (preimaged)BoundedCall
. Is called byopen_proposal
.ensure_poll_closed
: Ensures whether a proposal is able to be closed. Is called byclose_proposal
.get_poll_approval
: Decides whether a proposal is approved. Is called byclose_proposal
.do_clear_poll
: Clears a poll once it's closed. Is called byclose_proposal
.do_call_execute
: Schedules a enqueued on behalf of the treasury. Is called byclose_proposal
orexecute_call
.Deprecations
assets_transfer
andbalances_transfer
, as they should be dispatched by the governance mechanisms.The text was updated successfully, but these errors were encountered: