Skip to content

orml-xtokens #266

@shaunxw

Description

@shaunxw

Cross-chain token transfer support.

orml-xtokens assumes other parachains also use xtoken protocol, and their impl is trustworthy (or exactly orml-xtokens).

Chains using orml-xtokens might need to whitelist para_id's to ensure this.

Basic data structure

/// To identify different chain
enum ChainId {
    RelayChain,
    ParaChain(ParaId)
}

/// To identify currency type and it's 'owner' chain
struct XCurrencyId {
    /// The owner chain
    chain_id: ChainId, 
    currency_id: Vec<u8>, // more flexible compared to int
}

enum XCMPMessage {
    Transfer {
        currency_id: XCurrencyId,
        dest: AccountId,
        amount: Balance,
    }
}

Dispatchable calls

transfer

  • Prerequisite: must be aware of self para_id
  • do transfer
    • To relaychain
    • To parachain
      • Relaychain tokens.
      • Owned parachain tokens.
      • Non-owned known parachain tokens.
      • Non-owned unknown parachain tokens.

Message handling

Bookkeeping

  • Impl DownwardMessageHandler
  • Impl XCMPMessageHandler

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions