Trait frame_support::traits::EnsureOriginWithArg
source · pub trait EnsureOriginWithArg<OuterOrigin, Argument> {
type Success;
fn try_origin(
o: OuterOrigin,
a: &Argument
) -> Result<Self::Success, OuterOrigin>;
fn ensure_origin(
o: OuterOrigin,
a: &Argument
) -> Result<Self::Success, BadOrigin> { ... }
fn successful_origin(a: &Argument) -> OuterOrigin { ... }
fn try_successful_origin(a: &Argument) -> Result<OuterOrigin, ()> { ... }
}
Expand description
Some sort of check on the origin is performed by this object.
Required Associated Types§
Required Methods§
sourcefn try_origin(o: OuterOrigin, a: &Argument) -> Result<Self::Success, OuterOrigin>
fn try_origin(o: OuterOrigin, a: &Argument) -> Result<Self::Success, OuterOrigin>
Perform the origin check, returning the origin value if unsuccessful. This allows chaining.
Provided Methods§
sourcefn ensure_origin(
o: OuterOrigin,
a: &Argument
) -> Result<Self::Success, BadOrigin>
fn ensure_origin(
o: OuterOrigin,
a: &Argument
) -> Result<Self::Success, BadOrigin>
Perform the origin check.
sourcefn successful_origin(a: &Argument) -> OuterOrigin
fn successful_origin(a: &Argument) -> OuterOrigin
Returns an outer origin capable of passing try_origin
check.
NOTE: This should generally NOT be reimplemented. Instead implement
try_successful_origin
.
** Should be used for benchmarking only!!! **
sourcefn try_successful_origin(a: &Argument) -> Result<OuterOrigin, ()>
fn try_successful_origin(a: &Argument) -> Result<OuterOrigin, ()>
Attept to get an outer origin capable of passing try_origin
check. May return Err
if it
is impossible. Default implementation just uses successful_origin()
.
** Should be used for benchmarking only!!! **