referrerpolicy=no-referrer-when-downgrade
frame_support::traits

Trait EnsureOriginWithArg

Source
pub trait EnsureOriginWithArg<OuterOrigin, Argument> {
    type Success;

    // Required methods
    fn try_origin(
        o: OuterOrigin,
        a: &Argument,
    ) -> Result<Self::Success, OuterOrigin>;
    fn try_successful_origin(a: &Argument) -> Result<OuterOrigin, ()>;

    // Provided method
    fn ensure_origin(
        o: OuterOrigin,
        a: &Argument,
    ) -> Result<Self::Success, BadOrigin> { ... }
}
Expand description

Some sort of check on the origin is performed by this object.

Required Associated Types§

Source

type Success

A return type.

Required Methods§

Source

fn try_origin( o: OuterOrigin, a: &Argument, ) -> Result<Self::Success, OuterOrigin>

Perform the origin check, returning the origin value if unsuccessful. This allows chaining.

Source

fn try_successful_origin(a: &Argument) -> Result<OuterOrigin, ()>

Attempt to get an outer origin capable of passing try_origin check. May return Err if it is impossible.

** Should be used for benchmarking only!!! **

Provided Methods§

Source

fn ensure_origin( o: OuterOrigin, a: &Argument, ) -> Result<Self::Success, BadOrigin>

Perform the origin check.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<O, A, Morph: for<'a> TryMorph<&'a A>, Inner: for<'a> EnsureOriginWithArg<O, <Morph as TryMorph<&'a A>>::Outcome, Success = Success>, Success> EnsureOriginWithArg<O, A> for TryWithMorphedArg<O, A, Morph, Inner, Success>

Source§

type Success = Success

Source§

impl<O, Original: EnsureOriginWithArg<O, A>, Mutator: Morph<Original::Success>, A> EnsureOriginWithArg<O, A> for MapSuccess<Original, Mutator>

Source§

type Success = <Mutator as Morph<<Original as EnsureOriginWithArg<O, A>>::Success>>::Outcome

Source§

impl<O: Clone, Original: EnsureOriginWithArg<O, A>, Mutator: TryMorph<Original::Success>, A> EnsureOriginWithArg<O, A> for TryMapSuccess<Original, Mutator>

Source§

type Success = <Mutator as TryMorph<<Original as EnsureOriginWithArg<O, A>>::Success>>::Outcome

Source§

impl<OO, Success, A> EnsureOriginWithArg<OO, A> for NeverEnsureOrigin<Success>

Source§

impl<OuterOrigin, Argument, EO: EnsureOrigin<OuterOrigin>> EnsureOriginWithArg<OuterOrigin, Argument> for AsEnsureOriginWithArg<EO>

Source§

type Success = <EO as EnsureOrigin<OuterOrigin>>::Success

Source§

impl<OuterOrigin, L: EnsureOriginWithArg<OuterOrigin, Argument>, R: EnsureOriginWithArg<OuterOrigin, Argument>, Argument> EnsureOriginWithArg<OuterOrigin, Argument> for EitherOfDiverse<L, R>

Source§

type Success = Either<<L as EnsureOriginWithArg<OuterOrigin, Argument>>::Success, <R as EnsureOriginWithArg<OuterOrigin, Argument>>::Success>

Source§

impl<OuterOrigin, L: EnsureOriginWithArg<OuterOrigin, Argument>, R: EnsureOriginWithArg<OuterOrigin, Argument, Success = L::Success>, Argument> EnsureOriginWithArg<OuterOrigin, Argument> for EitherOf<L, R>

Source§

type Success = <L as EnsureOriginWithArg<OuterOrigin, Argument>>::Success

impl<IsForeign: ContainsPair<L, L>, AccountOf: ConvertLocation<AccountId>, AccountId: Clone, RuntimeOrigin: From<Origin> + OriginTrait + Clone + Debug, L: TryFrom<Location> + TryInto<Location> + Clone + Debug> EnsureOriginWithArg<RuntimeOrigin, L> for ForeignCreators<IsForeign, AccountOf, AccountId, L>
where for<'a> &'a RuntimeOrigin::PalletsOrigin: TryInto<&'a Origin>,

impl<O, Success, T> EnsureOriginWithArg<O, T> for EnsureNever<Success>

impl<O: OriginTrait<AccountId = AccountId>, AccountId, T> EnsureOriginWithArg<O, T> for EnsureNone<AccountId>

impl<O: OriginTrait<AccountId = AccountId>, AccountId: Decode + Clone, T> EnsureOriginWithArg<O, T> for EnsureSigned<AccountId>

impl<O: OriginTrait<AccountId = AccountId>, Who: SortedMembers<AccountId>, AccountId: PartialEq + Clone + Ord + Decode, T> EnsureOriginWithArg<O, T> for EnsureSignedBy<Who, AccountId>

impl<O: OriginTrait, AccountId: Decode, Success: TypedGet, T> EnsureOriginWithArg<O, T> for EnsureRootWithSuccess<AccountId, Success>

impl<O: OriginTrait, AccountId: Decode, T> EnsureOriginWithArg<O, T> for EnsureRoot<AccountId>

impl<O: OriginTrait + From<RawOrigin<AccountId, I>>, AccountId, I, const N: u32, T> EnsureOriginWithArg<O, T> for EnsureMembers<AccountId, I, N>
where for<'a> &'a O::PalletsOrigin: TryInto<&'a RawOrigin<AccountId, I>>,

impl<O: OriginTrait + From<RawOrigin<AccountId, I>>, AccountId, I, const N: u32, const D: u32, T> EnsureOriginWithArg<O, T> for EnsureProportionAtLeast<AccountId, I, N, D>
where for<'a> &'a O::PalletsOrigin: TryInto<&'a RawOrigin<AccountId, I>>,

impl<O: OriginTrait + From<RawOrigin<AccountId, I>>, AccountId, I, const N: u32, const D: u32, T> EnsureOriginWithArg<O, T> for EnsureProportionMoreThan<AccountId, I, N, D>
where for<'a> &'a O::PalletsOrigin: TryInto<&'a RawOrigin<AccountId, I>>,

impl<O: OriginTrait + From<RawOrigin<AccountId, I>>, I, AccountId: Decode + Clone, T> EnsureOriginWithArg<O, T> for EnsureMember<AccountId, I>
where for<'a> &'a O::PalletsOrigin: TryInto<&'a RawOrigin<AccountId, I>>,

impl<T: Config<I>, I: 'static, const MIN_RANK: u16, A> EnsureOriginWithArg<<T as Config>::RuntimeOrigin, A> for EnsureInducted<T, I, MIN_RANK>

impl<T: Config<I>, I: 'static> EnsureOriginWithArg<<T as Config>::RuntimeOrigin, u16> for EnsureOfRank<T, I>

impl<T: Config<I>, I: 'static, const MIN_RANK: u16, A> EnsureOriginWithArg<<T as Config>::RuntimeOrigin, A> for EnsureMember<T, I, MIN_RANK>

impl<T: Config<I>, I: 'static, const MIN_RANK: u16, A> EnsureOriginWithArg<<T as Config>::RuntimeOrigin, A> for EnsureRanked<T, I, MIN_RANK>

impl<T: Config<I>, I: 'static, const MIN_RANK: u16, A> EnsureOriginWithArg<<T as Config>::RuntimeOrigin, A> for EnsureRankedMember<T, I, MIN_RANK>

impl<T: Config, A> EnsureOriginWithArg<<T as Config>::RuntimeOrigin, A> for EnsureFounder<T>

impl<IsForeign: ContainsPair<L, L>, AssetInspect: Inspect<AccountId>, AccountId: Eq + Clone, LocationToAccountId: ConvertLocation<AccountId>, RuntimeOrigin: From<Origin> + OriginTrait + Clone, L: From<Location> + Into<Location> + Clone> EnsureOriginWithArg<RuntimeOrigin, L> for ForeignAssetOwner<IsForeign, AssetInspect, AccountId, LocationToAccountId, L>
where for<'a> &'a RuntimeOrigin::PalletsOrigin: TryInto<&'a Origin>, <AssetInspect as Inspect<AccountId>>::AssetId: From<Location>,

impl<MatchAssetId: MaybeEquivalence<L, AssetId>, AssetInspect: Inspect<AccountId>, AccountId: Eq + Clone + Into<L>, AssetId: Eq + Clone, RuntimeOrigin, L: From<Location> + Into<Location> + Clone> EnsureOriginWithArg<RuntimeOrigin, L> for LocalAssetOwner<MatchAssetId, AssetInspect, AccountId, AssetId, L>
where RuntimeOrigin: Into<Result<RawOrigin<AccountId>, RuntimeOrigin>> + From<RawOrigin<AccountId>> + OriginTrait + Clone, <AssetInspect as Inspect<AccountId>>::AssetId: From<AssetId>,