referrerpolicy=no-referrer-when-downgrade

Trait polkadot_sdk_frame::traits::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.

Object Safety§

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: Into<Result<RawOrigin<AccountId>, O>> + From<RawOrigin<AccountId>>, 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: Into<Result<RawOrigin<AccountId>, O>> + From<RawOrigin<AccountId>>,

§

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

§

impl<O, AccountId, T> EnsureOriginWithArg<O, T> for EnsureRoot<AccountId>
where O: Into<Result<RawOrigin<AccountId>, O>> + From<RawOrigin<AccountId>>, AccountId: Decode,

§

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

§

impl<O, AccountId, T> EnsureOriginWithArg<O, T> for EnsureSigned<AccountId>
where O: Into<Result<RawOrigin<AccountId>, O>> + From<RawOrigin<AccountId>>, AccountId: Decode,

§

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: Into<Result<RawOrigin<AccountId>, O>> + From<RawOrigin<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 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<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>