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

Trait EnsureOriginWithArg

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§

type Success

A return type.

Required Methods§

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

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

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§

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§

§

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

§

type Success = Success

§

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

§

type Success = <EnsureRootWithSuccess<AccountId, Success> as EnsureOrigin<O>>::Success

§

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

§

type Success = <EnsureNone<AccountId> as EnsureOrigin<O>>::Success

§

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

§

type Success = <EnsureRoot<AccountId> as EnsureOrigin<O>>::Success

§

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

§

type Success = <EnsureSigned<AccountId> as EnsureOrigin<O>>::Success

§

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

§

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

§

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

§

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

§

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

§

type Success = <EnsureNever<Success> as EnsureOrigin<O>>::Success

§

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

§

type Success = <EnsureSignedBy<Who, AccountId> as EnsureOrigin<O>>::Success

§

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

§

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

§

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

§

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

§

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

§

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

§

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: 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>,