Struct PrefixedDenom

Source
pub struct PrefixedDenom {
    pub trace_path: TracePath,
    pub base_denom: BaseDenom,
}
Expand description

A type that contains the base denomination for ICS20 and the source tracing information path.

Fields§

§trace_path: TracePath

A series of {port-id}/{channel-id}s for tracing the source of the token.

§base_denom: BaseDenom

Base denomination of the relayed fungible token.

Implementations§

Source§

impl PrefixedDenom

Source

pub fn remove_trace_prefix(&mut self, prefix: &TracePrefix)

Removes the specified prefix from the trace path if there is a match, otherwise does nothing.

Source

pub fn add_trace_prefix(&mut self, prefix: TracePrefix)

Adds the specified prefix to the trace path.

Trait Implementations§

Source§

impl<'arbitrary> Arbitrary<'arbitrary> for PrefixedDenom

Source§

fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<PrefixedDenom, Error>

Generate an arbitrary value of Self from the given unstructured data. Read more
Source§

fn arbitrary_take_rest( u: Unstructured<'arbitrary>, ) -> Result<PrefixedDenom, Error>

Generate an arbitrary value of Self from the entirety of the given unstructured data. Read more
Source§

fn size_hint(depth: usize) -> (usize, Option<usize>)

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
Source§

fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
Source§

impl BorshDeserialize for PrefixedDenom

Source§

fn deserialize_reader<__R>(reader: &mut __R) -> Result<PrefixedDenom, Error>
where __R: Read,

Source§

fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>

Deserializes this instance from a given slice of bytes. Updates the buffer to point at the remaining bytes.
Source§

fn try_from_slice(v: &[u8]) -> Result<Self, Error>

Deserialize this instance from a slice of bytes.
Source§

fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>
where R: Read,

Source§

impl BorshSerialize for PrefixedDenom

Source§

fn serialize<__W>(&self, writer: &mut __W) -> Result<(), Error>
where __W: Write,

Source§

impl Clone for PrefixedDenom

Source§

fn clone(&self) -> PrefixedDenom

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PrefixedDenom

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Decode for PrefixedDenom

Source§

fn decode<__CodecInputEdqy>( __codec_input_edqy: &mut __CodecInputEdqy, ) -> Result<PrefixedDenom, Error>
where __CodecInputEdqy: Input,

Attempt to deserialise the value from input.
Source§

fn decode_into<I>( input: &mut I, dst: &mut MaybeUninit<Self>, ) -> Result<DecodeFinished, Error>
where I: Input,

Attempt to deserialize the value from input into a pre-allocated piece of memory. Read more
Source§

fn skip<I>(input: &mut I) -> Result<(), Error>
where I: Input,

Attempt to skip the encoded value from input. Read more
Source§

fn encoded_fixed_size() -> Option<usize>

Returns the fixed encoded size of the type. Read more
Source§

impl<'de> Deserialize<'de> for PrefixedDenom

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<PrefixedDenom, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for PrefixedDenom

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Encode for PrefixedDenom

Source§

fn size_hint(&self) -> usize

If possible give a hint of expected size of the encoding. Read more
Source§

fn encode_to<__CodecOutputEdqy>( &self, __codec_dest_edqy: &mut __CodecOutputEdqy, )
where __CodecOutputEdqy: Output + ?Sized,

Convert self to a slice and append it to the destination.
Source§

fn encode(&self) -> Vec<u8>

Convert self to an owned vector.
Source§

fn using_encoded<R, F>(&self, f: F) -> R
where F: FnOnce(&[u8]) -> R,

Convert self to a slice and then invoke the given closure with it.
Source§

fn encoded_size(&self) -> usize

Calculates the encoded size. Read more
Source§

impl From<BaseDenom> for PrefixedDenom

Source§

fn from(denom: BaseDenom) -> PrefixedDenom

Converts to this type from the input type.
Source§

impl From<PrefixedDenom> for DenomTrace

Source§

fn from(value: PrefixedDenom) -> DenomTrace

Converts to this type from the input type.
Source§

impl FromStr for PrefixedDenom

Source§

fn from_str(s: &str) -> Result<PrefixedDenom, <PrefixedDenom as FromStr>::Err>

Initializes a PrefixedDenom from a string that adheres to the format {nth-port-id/channel-<index>}/{(n-1)th-port-id/channel-<index>}/.../{1st-port-id/channel-<index>}/<base_denom>. A PrefixedDenom exhibits a sequence of {ith-port-id/channel-<index>} pairs. This sequence makes up the TracePath of the PrefixedDenom.

This PrefixedDenom::from_str implementation left-split-twice the argument string using / delimiter. Then it peeks into the first two segments and attempts to convert the first segment into a PortId and the second into a ChannelId. This continues on the third remaining segment in a loop until a {port-id/channel-id} pair cannot be created from the top two segments. The remaining parts of the string are then considered the BaseDenom.

For example, given the following denom trace: “transfer/channel-75/factory/stars16da2uus9zrsy83h23ur42v3lglg5rmyrpqnju4/dust”, the first two /-delimited segments are "transfer" and "channel-75". The first is a valid PortId, and the second is a valid ChannelId, so that becomes the first {port-id/channel-id} pair that gets added as part of the TracePath of the PrefixedDenom. The next two segments are "factory", a valid PortId, and "stars16da2uus9zrsy83h23ur42v3lglg5rmyrpqnju4", an invalid ChannelId. The loop breaks at this point, resulting in a TracePath of "transfer/channel-75" and a BaseDenom of "factory/stars16da2uus9zrsy83h23ur42v3lglg5rmyrpqnju4/dust".

Source§

type Err = DecodingError

The associated error which can be returned from parsing.
Source§

impl JsonSchema for PrefixedDenom

Source§

fn schema_name() -> String

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn is_referenceable() -> bool

Whether JSON Schemas generated for this type should be re-used where possible using the $ref keyword. Read more
Source§

impl Ord for PrefixedDenom

Source§

fn cmp(&self, other: &PrefixedDenom) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for PrefixedDenom

Source§

fn eq(&self, other: &PrefixedDenom) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for PrefixedDenom

Source§

fn partial_cmp(&self, other: &PrefixedDenom) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Serialize for PrefixedDenom

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl TryFrom<DenomTrace> for PrefixedDenom

Source§

type Error = DecodingError

The type returned in the event of a conversion error.
Source§

fn try_from( value: DenomTrace, ) -> Result<PrefixedDenom, <PrefixedDenom as TryFrom<DenomTrace>>::Error>

Performs the conversion.
Source§

impl TypeInfo for PrefixedDenom

Source§

type Identity = PrefixedDenom

The type identifying for which type info is provided. Read more
Source§

fn type_info() -> Type

Returns the static type identifier for Self.
Source§

impl EncodeLike for PrefixedDenom

Source§

impl Eq for PrefixedDenom

Source§

impl StructuralPartialEq for PrefixedDenom

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DecodeAll for T
where T: Decode,

Source§

fn decode_all(input: &mut &[u8]) -> Result<T, Error>

Decode Self and consume all of the given input data. Read more
Source§

impl<T> DecodeLimit for T
where T: Decode,

Source§

fn decode_all_with_depth_limit( limit: u32, input: &mut &[u8], ) -> Result<T, Error>

Decode Self and consume all of the given input data. Read more
Source§

fn decode_with_depth_limit<I>(limit: u32, input: &mut I) -> Result<T, Error>
where I: Input,

Decode Self with the given maximum recursion depth and advance input by the number of bytes consumed. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> KeyedVec for T
where T: Codec,

Source§

fn to_keyed_vec(&self, prepend_key: &[u8]) -> Vec<u8>

Return an encoding of Self prepended by given slice.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<S> Codec for S
where S: Decode + Encode,

Source§

impl<T, C> Convertible<C> for T
where T: TryFrom<C> + Into<C>,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> EncodeLike<&&T> for T
where T: Encode,

Source§

impl<T> EncodeLike<&T> for T
where T: Encode,

Source§

impl<T> EncodeLike<&mut T> for T
where T: Encode,

Source§

impl<T> EncodeLike<Arc<T>> for T
where T: Encode,

Source§

impl<T> EncodeLike<Box<T>> for T
where T: Encode,

Source§

impl<T> EncodeLike<Cow<'_, T>> for T
where T: ToOwned + Encode,

Source§

impl<T> EncodeLike<Rc<T>> for T
where T: Encode,

Source§

impl<S> FullCodec for S
where S: Decode + FullEncode,

Source§

impl<S> FullEncode for S
where S: Encode + EncodeLike,

Source§

impl<T> JsonSchemaMaybe for T

Source§

impl<T> StaticTypeInfo for T
where T: TypeInfo + 'static,