2

I have a local rococo relay chain and my own parachain. For AssetTransactor type of xcm_executor I use my own implementation of TransactAsset trait.

When I send tokens from relaychain to parachain from Bob account to Alice using reserveTransfer on relaychain. On parachain side the deposit_asset method of TransactAsset trait implementation is called and it works well. It looks like I need a Origin Multilocation of a tokens sender(Bob) in my custom implementation - but there is no such argument in this function, only the Multilocation of tokens reciever(Alice).

Is there any way to send tokens with the sender address not erased? For example, TransactAsset trait has a transfer_asset method that takes the sender Multilocation - can it be used to send tokens in this case - and what XCM message should be used if it possible?

2
  • Why do you need the sender's origin? Dec 9, 2022 at 8:27
  • just need it in logic
    – N1ght
    Dec 20, 2022 at 9:59

1 Answer 1

2

In XCM v3, there is the DescendOrigin instruction which allows you to specify a Junction, which will be appended at the end of the current origin. We call this the Computed Origin. The origin that sent the XCM is called the Physical Origin.

To use a Web 2.0 analogy, a Computed Origin is akin to an IP address, whereas a Physical Origin is akin to a MAC address.

To answer your question more specifically, you can use the AccountId32 variant in the Junction enum and put it in a DescendOrigin instruction. That will mutate the origin register in the XCM executor, making sure that each subsequent XCM instruction processed afterwards would use the Computed Origin, which contains the account ID of the person who sent the XCM instruction.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.