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
impl PrefixedDenom
Sourcepub fn remove_trace_prefix(&mut self, prefix: &TracePrefix)
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.
Sourcepub fn add_trace_prefix(&mut self, prefix: TracePrefix)
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
impl<'arbitrary> Arbitrary<'arbitrary> for PrefixedDenom
Source§fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<PrefixedDenom, Error>
fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<PrefixedDenom, Error>
Self
from the given unstructured data. Read moreSource§fn arbitrary_take_rest(
u: Unstructured<'arbitrary>,
) -> Result<PrefixedDenom, Error>
fn arbitrary_take_rest( u: Unstructured<'arbitrary>, ) -> Result<PrefixedDenom, Error>
Self
from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Unstructured
this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Unstructured
this type
needs to construct itself. Read moreSource§impl BorshDeserialize for PrefixedDenom
impl BorshDeserialize for PrefixedDenom
fn deserialize_reader<__R>(reader: &mut __R) -> Result<PrefixedDenom, Error>where
__R: Read,
Source§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
Source§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
Source§impl BorshSerialize for PrefixedDenom
impl BorshSerialize for PrefixedDenom
Source§impl Clone for PrefixedDenom
impl Clone for PrefixedDenom
Source§fn clone(&self) -> PrefixedDenom
fn clone(&self) -> PrefixedDenom
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for PrefixedDenom
impl Debug for PrefixedDenom
Source§impl Decode for PrefixedDenom
impl Decode for PrefixedDenom
Source§fn decode<__CodecInputEdqy>(
__codec_input_edqy: &mut __CodecInputEdqy,
) -> Result<PrefixedDenom, Error>where
__CodecInputEdqy: Input,
fn decode<__CodecInputEdqy>(
__codec_input_edqy: &mut __CodecInputEdqy,
) -> Result<PrefixedDenom, Error>where
__CodecInputEdqy: Input,
Source§fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
Source§impl<'de> Deserialize<'de> for PrefixedDenom
impl<'de> Deserialize<'de> for PrefixedDenom
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<PrefixedDenom, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<PrefixedDenom, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Display for PrefixedDenom
impl Display for PrefixedDenom
Source§impl Encode for PrefixedDenom
impl Encode for PrefixedDenom
Source§fn size_hint(&self) -> usize
fn size_hint(&self) -> usize
Source§fn encode_to<__CodecOutputEdqy>(
&self,
__codec_dest_edqy: &mut __CodecOutputEdqy,
)
fn encode_to<__CodecOutputEdqy>( &self, __codec_dest_edqy: &mut __CodecOutputEdqy, )
Source§fn using_encoded<R, F>(&self, f: F) -> R
fn using_encoded<R, F>(&self, f: F) -> R
Source§fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
Source§impl From<BaseDenom> for PrefixedDenom
impl From<BaseDenom> for PrefixedDenom
Source§fn from(denom: BaseDenom) -> PrefixedDenom
fn from(denom: BaseDenom) -> PrefixedDenom
Source§impl From<PrefixedDenom> for DenomTrace
impl From<PrefixedDenom> for DenomTrace
Source§fn from(value: PrefixedDenom) -> DenomTrace
fn from(value: PrefixedDenom) -> DenomTrace
Source§impl FromStr for PrefixedDenom
impl FromStr for PrefixedDenom
Source§fn from_str(s: &str) -> Result<PrefixedDenom, <PrefixedDenom as FromStr>::Err>
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
type Err = DecodingError
Source§impl JsonSchema for PrefixedDenom
impl JsonSchema for PrefixedDenom
Source§fn schema_name() -> String
fn schema_name() -> String
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref
keyword. Read more