Enum xcm::v0::prelude::MultiAsset[][src]

pub enum MultiAsset {
    None,
    All,
    AllFungible,
    AllNonFungible,
    AllAbstractFungible {
        id: Vec<u8>,
    },
    AllAbstractNonFungible {
        class: Vec<u8>,
    },
    AllConcreteFungible {
        id: MultiLocation,
    },
    AllConcreteNonFungible {
        class: MultiLocation,
    },
    AbstractFungible {
        id: Vec<u8>,
        amount: u128,
    },
    AbstractNonFungible {
        class: Vec<u8>,
        instance: AssetInstance,
    },
    ConcreteFungible {
        id: MultiLocation,
        amount: u128,
    },
    ConcreteNonFungible {
        class: MultiLocation,
        instance: AssetInstance,
    },
}
Expand description

A single general identifier for an asset.

Represents both fungible and non-fungible assets. May only be used to represent a single asset class.

Wildcards may or may not be allowed by the interpreting context.

Assets classes may be identified in one of two ways: either an abstract identifier or a concrete identifier. Implementations may support only one of these. A single asset may be referenced from multiple asset identifiers, though will tend to have only a single preferred identifier.

Abstract identifiers

Abstract identifiers are absolute identifiers that represent a notional asset which can exist within multiple consensus systems. These tend to be simpler to deal with since their broad meaning is unchanged regardless stay of the consensus system in which it is interpreted.

However, in the attempt to provide uniformity across consensus systems, they may conflate different instantiations of some notional asset (e.g. the reserve asset and a local reserve-backed derivative of it) under the same name, leading to confusion. It also implies that one notional asset is accounted for locally in only one way. This may not be the case, e.g. where there are multiple bridge instances each providing a bridged “BTC” token yet none being fungible between the others.

Since they are meant to be absolute and universal, a global registry is needed to ensure that name collisions do not occur.

An abstract identifier is represented as a simple variable-size byte string. As of writing, no global registry exists and no proposals have been put forth for asset labeling.

Concrete identifiers

Concrete identifiers are relative identifiers that specifically identify a single asset through its location in a consensus system relative to the context interpreting. Use of a MultiLocation ensures that similar but non fungible variants of the same underlying asset can be properly distinguished, and obviates the need for any kind of central registry.

The limitation is that the asset identifier cannot be trivially copied between consensus systems and must instead be “re-anchored” whenever being moved to a new consensus system, using the two systems’ relative paths.

Throughout XCM, messages are authored such that when interpreted from the receiver’s point of view they will have the desired meaning/effect. This means that relative paths should always by constructed to be read from the point of view of the receiving system, which may be have a completely different meaning in the authoring system.

Concrete identifiers are the preferred way of identifying an asset since they are entirely unambiguous.

A concrete identifier is represented by a MultiLocation. If a system has an unambiguous primary asset (such as Bitcoin with BTC or Ethereum with ETH), then it will conventionally be identified as the chain itself. Alternative and more specific ways of referring to an asset within a system include:

  • <chain>/PalletInstance(<id>) for a Frame chain with a single-asset pallet instance (such as an instance of the Balances pallet).
  • <chain>/PalletInstance(<id>)/GeneralIndex(<index>) for a Frame chain with an indexed multi-asset pallet instance (such as an instance of the Assets pallet).
  • <chain>/AccountId32 for an ERC-20-style single-asset smart-contract on a Frame-based contracts chain.
  • <chain>/AccountKey20 for an ERC-20-style single-asset smart-contract on an Ethereum-like chain.

Variants

None

No assets. Rarely used.

All

All assets. Typically used for the subset of assets to be used for an Order, and in that context means “all assets currently in holding”.

AllFungible

All fungible assets. Typically used for the subset of assets to be used for an Order, and in that context means “all fungible assets currently in holding”.

AllNonFungible

All non-fungible assets. Typically used for the subset of assets to be used for an Order, and in that context means “all non-fungible assets currently in holding”.

AllAbstractFungible

All fungible assets of a given abstract asset identifier.

Fields of AllAbstractFungible

id: Vec<u8>
AllAbstractNonFungible

All non-fungible assets of a given abstract asset class.

Fields of AllAbstractNonFungible

class: Vec<u8>
AllConcreteFungible

All fungible assets of a given concrete asset identifier.

Fields of AllConcreteFungible

id: MultiLocation
AllConcreteNonFungible

All non-fungible assets of a given concrete asset class.

Fields of AllConcreteNonFungible

class: MultiLocation
AbstractFungible

Some specific amount of the fungible asset identified by an abstract id.

Fields of AbstractFungible

id: Vec<u8>amount: u128
AbstractNonFungible

Some specific instance of the non-fungible asset whose class is identified abstractly.

Fields of AbstractNonFungible

class: Vec<u8>instance: AssetInstance
ConcreteFungible

Some specific amount of the fungible asset identified by an concrete id.

Fields of ConcreteFungible

id: MultiLocationamount: u128
ConcreteNonFungible

Some specific instance of the non-fungible asset whose class is identified concretely.

Fields of ConcreteNonFungible

class: MultiLocationinstance: AssetInstance

Implementations

Returns true if the MultiAsset is a wildcard and can refer to classes of assets, instead of just one.

Typically can also be inferred by the name starting with All.

Returns true if self is a super-set of the given inner.

Typically, any wildcard is never contained in anything else, and a wildcard can contain any other non-wildcard. For more details, see the implementation and tests.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Attempt to deserialise the value from input.

Attempt to skip the encoded value from input. Read more

Returns the fixed encoded size of the type. Read more

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

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

Convert self to an owned vector.

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

Calculates the encoded size. Read more

Performs the conversion.

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

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

Returns the static type identifier for Self.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Converts self into T using Into<T>. Read more

Converts self into a target type. Read more

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

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

Decode Self and advance input by the number of bytes consumed. Read more

Decode Self with the given maximum recursion depth. Read more

Causes self to use its Binary implementation when Debug-formatted.

Causes self to use its Display implementation when Debug-formatted. Read more

Causes self to use its LowerExp implementation when Debug-formatted. Read more

Causes self to use its LowerHex implementation when Debug-formatted. Read more

Causes self to use its Octal implementation when Debug-formatted.

Causes self to use its Pointer implementation when Debug-formatted. Read more

Causes self to use its UpperExp implementation when Debug-formatted. Read more

Causes self to use its UpperHex implementation when Debug-formatted. Read more

Performs the conversion.

Performs the conversion.

Return an encoding of Self prepended by given slice.

Pipes by value. This is generally the method you want to use. Read more

Borrows self and passes that borrow into the pipe function. Read more

Mutably borrows self and passes that borrow into the pipe function. Read more

Borrows self, then passes self.borrow() into the pipe function. Read more

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more

Borrows self, then passes self.as_ref() into the pipe function.

Mutably borrows self, then passes self.as_mut() into the pipe function. Read more

Borrows self, then passes self.deref() into the pipe function.

Mutably borrows self, then passes self.deref_mut() into the pipe function. Read more

Pipes a value into a function that cannot ordinarily be called in suffix position. Read more

Pipes a trait borrow into a function that cannot normally be called in suffix position. Read more

Pipes a trait mutable borrow into a function that cannot normally be called in suffix position. Read more

Pipes a trait borrow into a function that cannot normally be called in suffix position. Read more

Pipes a trait mutable borrow into a function that cannot normally be called in suffix position. Read more

Pipes a dereference into a function that cannot normally be called in suffix position. Read more

Pipes a mutable dereference into a function that cannot normally be called in suffix position. Read more

Pipes a reference into a function that cannot ordinarily be called in suffix position. Read more

Pipes a mutable reference into a function that cannot ordinarily be called in suffix position. Read more

Immutable access to a value. Read more

Mutable access to a value. Read more

Immutable access to the Borrow<B> of a value. Read more

Mutable access to the BorrowMut<B> of a value. Read more

Immutable access to the AsRef<R> view of a value. Read more

Mutable access to the AsMut<R> view of a value. Read more

Immutable access to the Deref::Target of a value. Read more

Mutable access to the Deref::Target of a value. Read more

Calls .tap() only in debug builds, and is erased in release builds.

Calls .tap_mut() only in debug builds, and is erased in release builds. Read more

Calls .tap_borrow() only in debug builds, and is erased in release builds. Read more

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds. Read more

Calls .tap_ref() only in debug builds, and is erased in release builds. Read more

Calls .tap_ref_mut() only in debug builds, and is erased in release builds. Read more

Calls .tap_deref() only in debug builds, and is erased in release builds. Read more

Calls .tap_deref_mut() only in debug builds, and is erased in release builds. Read more

Provides immutable access for inspection. Read more

Calls tap in debug builds, and does nothing in release builds.

Provides mutable access for modification. Read more

Calls tap_mut in debug builds, and does nothing in release builds.

Provides immutable access to the reference for inspection.

Calls tap_ref in debug builds, and does nothing in release builds.

Provides mutable access to the reference for modification.

Calls tap_ref_mut in debug builds, and does nothing in release builds.

Provides immutable access to the borrow for inspection. Read more

Calls tap_borrow in debug builds, and does nothing in release builds.

Provides mutable access to the borrow for modification.

Calls tap_borrow_mut in debug builds, and does nothing in release builds. Read more

Immutably dereferences self for inspection.

Calls tap_deref in debug builds, and does nothing in release builds.

Mutably dereferences self for modification.

Calls tap_deref_mut in debug builds, and does nothing in release builds. Read more

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

Attempts to convert self into T using TryInto<T>. Read more

Attempts to convert self into a target type. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.