Introduce EnsureOrigin to democracy.propose (#13410)

* feat: add submitorigin to democracy

* fix: democracy tests

* fix: SubmitOrigin doc comment

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

---------

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This commit is contained in:
Daniel Shiposha
2023-02-21 22:56:07 +00:00
committed by GitHub
parent d5beaa5542
commit 236bbbd5ef
3 changed files with 9 additions and 2 deletions
+6 -1
View File
@@ -308,6 +308,11 @@ pub mod pallet {
/// of a negative-turnout-bias (default-carries) referendum.
type ExternalDefaultOrigin: EnsureOrigin<Self::RuntimeOrigin>;
/// Origin from which the new proposal can be made.
///
/// The success variant is the account id of the depositor.
type SubmitOrigin: EnsureOrigin<Self::RuntimeOrigin, Success = Self::AccountId>;
/// Origin from which the next majority-carries (or more permissive) referendum may be
/// tabled to vote according to the `FastTrackVotingPeriod` asynchronously in a similar
/// manner to the emergency origin. It retains its threshold method.
@@ -590,7 +595,7 @@ pub mod pallet {
proposal: BoundedCallOf<T>,
#[pallet::compact] value: BalanceOf<T>,
) -> DispatchResult {
let who = ensure_signed(origin)?;
let who = T::SubmitOrigin::ensure_origin(origin)?;
ensure!(value >= T::MinimumDeposit::get(), Error::<T>::ValueLow);
let index = Self::public_prop_count();