Skip to content
Unverified Commit a5fd7460 authored by Adrian Catangiu's avatar Adrian Catangiu
Browse files

pallet-xcm: enchance reserve_transfer_assets() to support various reserves

'reserve_transfer_assets()' assumed all provided `assets` (fees included)
have same, local reserve.

This commit enhances the extrinsic to support various scenarios:
- transferring assets with reserve on destination,
- transferring assets with reserve on remote/third-party chain,
- transferring assets with reserve different than the reserve of the
  asset to be used as fees - meaning can use to transfer random asset with
  random reserve while using DOT for fees on all involved chains, even
  if local chain is NOT a reserve location of DOT (aka most chains),
- transferring assets with any type of local/dest/remote reserve while
  using fees which can be teleported between involved chains.

All of the above is done by pallet inner logic without the user having to
specify which scenario/reserves/teleports/etc. The correct scenario and
corresponding XCM programs are identified, and respectively, built automatically
based on runtime configuration of trusted teleporters and trusted reserves.

Current limitations:
- while `fees` and "non-fee" `assets` CAN have different reserves (or fees CAN
  be teleported), the remaining "non-fee" `assets` CANNOT have different
  reserve locations (this is also implicitly enforced by
  `MAX_ASSETS_FOR_TRANSFER=2`, but this can be safely increased in the future).
- `fees` and "non-fee" `assets` CANNOT have **different remote** reserves (this
  can also be supported in the future, but adds even more complexity while
  possibly not being worth it - we'll see what the future holds).
parent ce215a14
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment