paritytech/substrate

"OR gate" for EnsureOrigin

Closed this issue · 1 comments

xlc commented

Enable something like this

type AddOrigin = EnsureOneOf<
    EnsureProportionMoreThan<_1, _2, AccountId, CouncilCollective>,
    EnsureProportionMoreThan<_1, _1, AccountId, TechnicalCollective>,
    EnsureRoot<AccountId>,
>

This can also replace all those code

T::AddOrigin::try_origin(origin)
.map(|_| ())
.or_else(ensure_root)?;

Relates to: paritytech/polkadot-sdk#369